Merge lp:~cjwatson/launchpad/snap-dispatch-store-name into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18620
Proposed branch: lp:~cjwatson/launchpad/snap-dispatch-store-name
Merge into: lp:launchpad
Diff against target: 31 lines (+9/-1)
2 files modified
lib/lp/snappy/model/snapbuildbehaviour.py (+1/-1)
lib/lp/snappy/tests/test_snapbuildbehaviour.py (+8/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/snap-dispatch-store-name
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+343713@code.launchpad.net

Commit message

Prefer Snap.store_name over Snap.name for the "name" argument dispatched to snap builds.

Description of the change

This is mostly just used for directory names at the builder end, although soon also for source tarball names. The store name is often more meaningful if it's set, particularly for things like build.snapcraft.io-managed snaps.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/snappy/model/snapbuildbehaviour.py'
--- lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-04 14:14:30 +0000
+++ lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-20 18:03:04 +0000
@@ -97,7 +97,7 @@
97 "{endpoint}/{token}".format(97 "{endpoint}/{token}".format(
98 endpoint=config.snappy.builder_proxy_auth_api_endpoint,98 endpoint=config.snappy.builder_proxy_auth_api_endpoint,
99 token=token['username']))99 token=token['username']))
100 args["name"] = build.snap.name100 args["name"] = build.snap.store_name or build.snap.name
101 args["series"] = build.distro_series.name101 args["series"] = build.distro_series.name
102 args["arch_tag"] = build.distro_arch_series.architecturetag102 args["arch_tag"] = build.distro_arch_series.architecturetag
103 # XXX cjwatson 2015-08-03: Allow tools_source to be overridden at103 # XXX cjwatson 2015-08-03: Allow tools_source to be overridden at
104104
=== modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py'
--- lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-04 14:14:30 +0000
+++ lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-20 18:03:04 +0000
@@ -385,6 +385,14 @@
385 }, args)385 }, args)
386386
387 @defer.inlineCallbacks387 @defer.inlineCallbacks
388 def test_extraBuildArgs_prefers_store_name(self):
389 # For the "name" argument, _extraBuildArgs prefers Snap.store_name
390 # over Snap.name if the former is set.
391 job = self.makeJob(store_name="something-else")
392 args = yield job._extraBuildArgs()
393 self.assertEqual("something-else", args["name"])
394
395 @defer.inlineCallbacks
388 def test_extraBuildArgs_archive_trusted_keys(self):396 def test_extraBuildArgs_archive_trusted_keys(self):
389 # If the archive has a signing key, _extraBuildArgs sends it.397 # If the archive has a signing key, _extraBuildArgs sends it.
390 yield self.useFixture(InProcessKeyServerFixture()).start()398 yield self.useFixture(InProcessKeyServerFixture()).start()