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
1=== modified file 'lib/lp/snappy/model/snapbuildbehaviour.py'
2--- lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-04 14:14:30 +0000
3+++ lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-20 18:03:04 +0000
4@@ -97,7 +97,7 @@
5 "{endpoint}/{token}".format(
6 endpoint=config.snappy.builder_proxy_auth_api_endpoint,
7 token=token['username']))
8- args["name"] = build.snap.name
9+ args["name"] = build.snap.store_name or build.snap.name
10 args["series"] = build.distro_series.name
11 args["arch_tag"] = build.distro_arch_series.architecturetag
12 # XXX cjwatson 2015-08-03: Allow tools_source to be overridden at
13
14=== modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py'
15--- lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-04 14:14:30 +0000
16+++ lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-20 18:03:04 +0000
17@@ -385,6 +385,14 @@
18 }, args)
19
20 @defer.inlineCallbacks
21+ def test_extraBuildArgs_prefers_store_name(self):
22+ # For the "name" argument, _extraBuildArgs prefers Snap.store_name
23+ # over Snap.name if the former is set.
24+ job = self.makeJob(store_name="something-else")
25+ args = yield job._extraBuildArgs()
26+ self.assertEqual("something-else", args["name"])
27+
28+ @defer.inlineCallbacks
29 def test_extraBuildArgs_archive_trusted_keys(self):
30 # If the archive has a signing key, _extraBuildArgs sends it.
31 yield self.useFixture(InProcessKeyServerFixture()).start()