launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29205
[Merge] ~cjwatson/launchpad:fix-bpb-librarian-auth into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-bpb-librarian-auth into launchpad:master.
Commit message:
Fix librarian URL generation for binary package builds
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/430027
`LibraryFileAlias.https_url` is (confusingly) not the right thing to use here, since it just takes the HTTP URL and unconditionally replaces its scheme with "https". We need to use `getURL()` instead, which uses `https_url` for public files and constructs a URL on the appropriate restricted domain for private files.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-bpb-librarian-auth into launchpad:master.
diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py
index 3fe83c6..cd46eb4 100644
--- a/lib/lp/buildmaster/interactor.py
+++ b/lib/lp/buildmaster/interactor.py
@@ -326,7 +326,12 @@ class BuilderWorker:
if logger is not None:
logger.info(
"Asking %s to ensure it has %s (%s%s)"
- % (self.url, sha1, url, " with auth" if username else "")
+ % (
+ self.url,
+ sha1,
+ url,
+ " with auth" if username or password else "",
+ )
)
present, info = yield self.ensurepresent(sha1, url, username, password)
if not present:
diff --git a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
index 9cef29a..15f374d 100644
--- a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
@@ -74,7 +74,7 @@ class BinaryPackageBuildBehaviour(BuildFarmJobBehaviourBase):
lfa = source_file.libraryfile
filemap[lfa.filename] = {
"sha1": lfa.content.sha1,
- "url": lfa.https_url,
+ "url": lfa.getURL(),
}
if self.build.archive.private:
if macaroon_raw is None:
diff --git a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
index f3625ec..8f4d199 100644
--- a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
@@ -147,7 +147,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
)
else:
password = ""
- uploads.append((sprf.libraryfile.https_url, "", password))
+ uploads.append((sprf.libraryfile.getURL(), "", password))
upload_logs = [
MatchesListwise(
[Equals("ensurepresent")]