Merge ~cjwatson/launchpad:fix-bpb-librarian-auth into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 60aaf6718cb2bfe28184198f804b70e7ba8a82bb
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-bpb-librarian-auth
Merge into: launchpad:master
Diff against target: 44 lines (+8/-3)
3 files modified
lib/lp/buildmaster/interactor.py (+6/-1)
lib/lp/soyuz/model/binarypackagebuildbehaviour.py (+1/-1)
lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py (+1/-1)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+430027@code.launchpad.net

Commit message

Fix librarian URL generation for binary package builds

Description of the change

`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.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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:
326 if logger is not None:326 if logger is not None:
327 logger.info(327 logger.info(
328 "Asking %s to ensure it has %s (%s%s)"328 "Asking %s to ensure it has %s (%s%s)"
329 % (self.url, sha1, url, " with auth" if username else "")329 % (
330 self.url,
331 sha1,
332 url,
333 " with auth" if username or password else "",
334 )
330 )335 )
331 present, info = yield self.ensurepresent(sha1, url, username, password)336 present, info = yield self.ensurepresent(sha1, url, username, password)
332 if not present:337 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):
74 lfa = source_file.libraryfile74 lfa = source_file.libraryfile
75 filemap[lfa.filename] = {75 filemap[lfa.filename] = {
76 "sha1": lfa.content.sha1,76 "sha1": lfa.content.sha1,
77 "url": lfa.https_url,77 "url": lfa.getURL(),
78 }78 }
79 if self.build.archive.private:79 if self.build.archive.private:
80 if macaroon_raw is None:80 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):
147 )147 )
148 else:148 else:
149 password = ""149 password = ""
150 uploads.append((sprf.libraryfile.https_url, "", password))150 uploads.append((sprf.libraryfile.getURL(), "", password))
151 upload_logs = [151 upload_logs = [
152 MatchesListwise(152 MatchesListwise(
153 [Equals("ensurepresent")]153 [Equals("ensurepresent")]

Subscribers

People subscribed via source and target branches

to status/vote changes: