mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
archive: Update PersonalPackageArchiveSourcePackage to handle private PPA
Unfortunately private PPAs require downloading files from the special server private-ppa.launchpad.net, and all the usual urls provided by the LP api fail. So add code to handle using those custom private URLs, and use authentication when downloading.
This commit is contained in:
parent
3f2983c157
commit
86276665cd
@ -659,6 +659,27 @@ class PersonalPackageArchiveSourcePackage(UbuntuSourcePackage):
|
||||
Logger.debug(f"Using PPA '{ppa.web_link}'")
|
||||
return ppa
|
||||
|
||||
def _private_ppa_url(self, filename):
|
||||
"Format the URL for a filename using the private PPA server"
|
||||
url = self.getArchive().getMySubscriptionURL()
|
||||
pkg = self.source
|
||||
subdir = pkg[:4] if pkg.startswith('lib') else pkg[:1]
|
||||
return f'{url}/pool/main/{subdir}/{pkg}/{filename}'
|
||||
|
||||
def _source_urls(self, name):
|
||||
"Generator of sources for name"
|
||||
if self.getArchive().private:
|
||||
yield self._private_ppa_url(name)
|
||||
else:
|
||||
yield super()._source_urls(name)
|
||||
|
||||
def _binary_urls(self, name, bpph):
|
||||
"Generator of URLs for name"
|
||||
if self.getArchive().private:
|
||||
yield self._private_ppa_url(name)
|
||||
else:
|
||||
yield super()._binary_urls(name, bpph)
|
||||
|
||||
|
||||
class UbuntuCloudArchiveSourcePackage(PersonalPackageArchiveSourcePackage):
|
||||
"Download / unpack an Ubuntu Cloud Archive source package"
|
||||
|
Loading…
x
Reference in New Issue
Block a user