Merge lp:~cjwatson/launchpad/snap-source-tarball into lp:launchpad
- snap-source-tarball
- Merge into devel
Proposed by
Colin Watson
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 18623 | ||||
Proposed branch: | lp:~cjwatson/launchpad/snap-source-tarball | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
388 lines (+91/-9) 11 files modified
lib/lp/snappy/browser/snap.py (+4/-0) lib/lp/snappy/browser/tests/test_snap.py (+27/-0) lib/lp/snappy/interfaces/snap.py (+7/-0) lib/lp/snappy/model/snap.py (+10/-4) lib/lp/snappy/model/snapbuildbehaviour.py (+1/-0) lib/lp/snappy/templates/snap-edit.pt (+4/-0) lib/lp/snappy/templates/snap-index.pt (+9/-0) lib/lp/snappy/templates/snap-new.pt (+3/-0) lib/lp/snappy/tests/test_snap.py (+4/-0) lib/lp/snappy/tests/test_snapbuildbehaviour.py (+14/-0) lib/lp/testing/factory.py (+8/-5) |
||||
To merge this branch: | bzr merge lp:~cjwatson/launchpad/snap-source-tarball | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+343727@code.launchpad.net |
Commit message
Add an option to build source tarballs for snaps.
Description of the change
See https:/
Landing https:/
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/browser/snap.py' | |||
2 | --- lib/lp/snappy/browser/snap.py 2018-04-04 13:28:28 +0000 | |||
3 | +++ lib/lp/snappy/browser/snap.py 2018-04-21 10:15:59 +0000 | |||
4 | @@ -320,6 +320,7 @@ | |||
5 | 320 | 'private', | 320 | 'private', |
6 | 321 | 'require_virtualized', | 321 | 'require_virtualized', |
7 | 322 | 'allow_internet', | 322 | 'allow_internet', |
8 | 323 | 'build_source_tarball', | ||
9 | 323 | 'auto_build', | 324 | 'auto_build', |
10 | 324 | 'store_upload', | 325 | 'store_upload', |
11 | 325 | ]) | 326 | ]) |
12 | @@ -374,6 +375,7 @@ | |||
13 | 374 | 'owner', | 375 | 'owner', |
14 | 375 | 'name', | 376 | 'name', |
15 | 376 | 'store_distro_series', | 377 | 'store_distro_series', |
16 | 378 | 'build_source_tarball', | ||
17 | 377 | 'auto_build', | 379 | 'auto_build', |
18 | 378 | 'auto_build_archive', | 380 | 'auto_build_archive', |
19 | 379 | 'auto_build_pocket', | 381 | 'auto_build_pocket', |
20 | @@ -511,6 +513,7 @@ | |||
21 | 511 | auto_build_archive=data['auto_build_archive'], | 513 | auto_build_archive=data['auto_build_archive'], |
22 | 512 | auto_build_pocket=data['auto_build_pocket'], | 514 | auto_build_pocket=data['auto_build_pocket'], |
23 | 513 | processors=data['processors'], private=private, | 515 | processors=data['processors'], private=private, |
24 | 516 | build_source_tarball=data['build_source_tarball'], | ||
25 | 514 | store_upload=data['store_upload'], | 517 | store_upload=data['store_upload'], |
26 | 515 | store_series=data['store_distro_series'].snappy_series, | 518 | store_series=data['store_distro_series'].snappy_series, |
27 | 516 | store_name=data['store_name'], | 519 | store_name=data['store_name'], |
28 | @@ -681,6 +684,7 @@ | |||
29 | 681 | 'vcs', | 684 | 'vcs', |
30 | 682 | 'branch', | 685 | 'branch', |
31 | 683 | 'git_ref', | 686 | 'git_ref', |
32 | 687 | 'build_source_tarball', | ||
33 | 684 | 'auto_build', | 688 | 'auto_build', |
34 | 685 | 'auto_build_archive', | 689 | 'auto_build_archive', |
35 | 686 | 'auto_build_pocket', | 690 | 'auto_build_pocket', |
36 | 687 | 691 | ||
37 | === modified file 'lib/lp/snappy/browser/tests/test_snap.py' | |||
38 | --- lib/lp/snappy/browser/tests/test_snap.py 2018-04-04 14:14:30 +0000 | |||
39 | +++ lib/lp/snappy/browser/tests/test_snap.py 2018-04-21 10:15:59 +0000 | |||
40 | @@ -243,6 +243,9 @@ | |||
41 | 243 | "Source:\n%s\nEdit snap package" % source_display, | 243 | "Source:\n%s\nEdit snap package" % source_display, |
42 | 244 | MatchesTagText(content, "source")) | 244 | MatchesTagText(content, "source")) |
43 | 245 | self.assertThat( | 245 | self.assertThat( |
44 | 246 | "Build source tarball:\nNo\nEdit snap package", | ||
45 | 247 | MatchesTagText(content, "build_source_tarball")) | ||
46 | 248 | self.assertThat( | ||
47 | 246 | "Build schedule:\n(?)\nBuilt on request\nEdit snap package\n", | 249 | "Build schedule:\n(?)\nBuilt on request\nEdit snap package\n", |
48 | 247 | MatchesTagText(content, "auto_build")) | 250 | MatchesTagText(content, "auto_build")) |
49 | 248 | self.assertThat( | 251 | self.assertThat( |
50 | @@ -277,6 +280,9 @@ | |||
51 | 277 | "Source:\n%s\nEdit snap package" % source_display, | 280 | "Source:\n%s\nEdit snap package" % source_display, |
52 | 278 | MatchesTagText(content, "source")) | 281 | MatchesTagText(content, "source")) |
53 | 279 | self.assertThat( | 282 | self.assertThat( |
54 | 283 | "Build source tarball:\nNo\nEdit snap package", | ||
55 | 284 | MatchesTagText(content, "build_source_tarball")) | ||
56 | 285 | self.assertThat( | ||
57 | 280 | "Build schedule:\n(?)\nBuilt on request\nEdit snap package\n", | 286 | "Build schedule:\n(?)\nBuilt on request\nEdit snap package\n", |
58 | 281 | MatchesTagText(content, "auto_build")) | 287 | MatchesTagText(content, "auto_build")) |
59 | 282 | self.assertThat( | 288 | self.assertThat( |
60 | @@ -355,6 +361,20 @@ | |||
61 | 355 | extract_text(find_tag_by_id(browser.contents, "privacy")) | 361 | extract_text(find_tag_by_id(browser.contents, "privacy")) |
62 | 356 | ) | 362 | ) |
63 | 357 | 363 | ||
64 | 364 | def test_create_new_snap_build_source_tarball(self): | ||
65 | 365 | # We can create a new snap and ask for it to build a source tarball. | ||
66 | 366 | branch = self.factory.makeAnyBranch() | ||
67 | 367 | browser = self.getViewBrowser( | ||
68 | 368 | branch, view_name="+new-snap", user=self.person) | ||
69 | 369 | browser.getControl(name="field.name").value = "snap-name" | ||
70 | 370 | browser.getControl("Build source tarball").selected = True | ||
71 | 371 | browser.getControl("Create snap package").click() | ||
72 | 372 | |||
73 | 373 | content = find_main_content(browser.contents) | ||
74 | 374 | self.assertThat( | ||
75 | 375 | "Build source tarball:\nYes\nEdit snap package", | ||
76 | 376 | MatchesTagText(content, "build_source_tarball")) | ||
77 | 377 | |||
78 | 358 | def test_create_new_snap_auto_build(self): | 378 | def test_create_new_snap_auto_build(self): |
79 | 359 | # Creating a new snap and asking for it to be automatically built | 379 | # Creating a new snap and asking for it to be automatically built |
80 | 360 | # sets all the appropriate fields. | 380 | # sets all the appropriate fields. |
81 | @@ -686,6 +706,7 @@ | |||
82 | 686 | browser.getControl("Git repository").value = ( | 706 | browser.getControl("Git repository").value = ( |
83 | 687 | new_git_ref.repository.identity) | 707 | new_git_ref.repository.identity) |
84 | 688 | browser.getControl("Git branch").value = new_git_ref.path | 708 | browser.getControl("Git branch").value = new_git_ref.path |
85 | 709 | browser.getControl("Build source tarball").selected = True | ||
86 | 689 | browser.getControl( | 710 | browser.getControl( |
87 | 690 | "Automatically build when branch changes").selected = True | 711 | "Automatically build when branch changes").selected = True |
88 | 691 | browser.getControl("PPA").click() | 712 | browser.getControl("PPA").click() |
89 | @@ -705,6 +726,9 @@ | |||
90 | 705 | "Source:\n%s\nEdit snap package" % new_git_ref.display_name, | 726 | "Source:\n%s\nEdit snap package" % new_git_ref.display_name, |
91 | 706 | MatchesTagText(content, "source")) | 727 | MatchesTagText(content, "source")) |
92 | 707 | self.assertThat( | 728 | self.assertThat( |
93 | 729 | "Build source tarball:\nYes\nEdit snap package", | ||
94 | 730 | MatchesTagText(content, "build_source_tarball")) | ||
95 | 731 | self.assertThat( | ||
96 | 708 | "Build schedule:\n(?)\nBuilt automatically\nEdit snap package\n", | 732 | "Build schedule:\n(?)\nBuilt automatically\nEdit snap package\n", |
97 | 709 | MatchesTagText(content, "auto_build")) | 733 | MatchesTagText(content, "auto_build")) |
98 | 710 | self.assertThat( | 734 | self.assertThat( |
99 | @@ -1223,6 +1247,7 @@ | |||
100 | 1223 | Owner: Test Person | 1247 | Owner: Test Person |
101 | 1224 | Distribution series: Ubuntu Shiny | 1248 | Distribution series: Ubuntu Shiny |
102 | 1225 | Source: lp://dev/~test-person/\\+junk/snap-branch | 1249 | Source: lp://dev/~test-person/\\+junk/snap-branch |
103 | 1250 | Build source tarball: No | ||
104 | 1226 | Build schedule: \(\?\) | 1251 | Build schedule: \(\?\) |
105 | 1227 | Built on request | 1252 | Built on request |
106 | 1228 | Source archive for automatic builds: | 1253 | Source archive for automatic builds: |
107 | @@ -1250,6 +1275,7 @@ | |||
108 | 1250 | Owner: Test Person | 1275 | Owner: Test Person |
109 | 1251 | Distribution series: Ubuntu Shiny | 1276 | Distribution series: Ubuntu Shiny |
110 | 1252 | Source: ~test-person/\\+git/snap-repository:master | 1277 | Source: ~test-person/\\+git/snap-repository:master |
111 | 1278 | Build source tarball: No | ||
112 | 1253 | Build schedule: \(\?\) | 1279 | Build schedule: \(\?\) |
113 | 1254 | Built on request | 1280 | Built on request |
114 | 1255 | Source archive for automatic builds: | 1281 | Source archive for automatic builds: |
115 | @@ -1277,6 +1303,7 @@ | |||
116 | 1277 | Owner: Test Person | 1303 | Owner: Test Person |
117 | 1278 | Distribution series: Ubuntu Shiny | 1304 | Distribution series: Ubuntu Shiny |
118 | 1279 | Source: https://git.example.org/foo master | 1305 | Source: https://git.example.org/foo master |
119 | 1306 | Build source tarball: No | ||
120 | 1280 | Build schedule: \(\?\) | 1307 | Build schedule: \(\?\) |
121 | 1281 | Built on request | 1308 | Built on request |
122 | 1282 | Source archive for automatic builds: | 1309 | Source archive for automatic builds: |
123 | 1283 | 1310 | ||
124 | === modified file 'lib/lp/snappy/interfaces/snap.py' | |||
125 | --- lib/lp/snappy/interfaces/snap.py 2018-04-15 16:23:14 +0000 | |||
126 | +++ lib/lp/snappy/interfaces/snap.py 2018-04-21 10:15:59 +0000 | |||
127 | @@ -498,6 +498,13 @@ | |||
128 | 498 | "The Git branch containing a snap/snapcraft.yaml, snapcraft.yaml, " | 498 | "The Git branch containing a snap/snapcraft.yaml, snapcraft.yaml, " |
129 | 499 | "or .snapcraft.yaml recipe at the top level."))) | 499 | "or .snapcraft.yaml recipe at the top level."))) |
130 | 500 | 500 | ||
131 | 501 | build_source_tarball = exported(Bool( | ||
132 | 502 | title=_("Build source tarball"), | ||
133 | 503 | required=True, readonly=False, | ||
134 | 504 | description=_( | ||
135 | 505 | "Whether builds of this snap package should also build a tarball " | ||
136 | 506 | "containing all source code, including external dependencies."))) | ||
137 | 507 | |||
138 | 501 | auto_build = exported(Bool( | 508 | auto_build = exported(Bool( |
139 | 502 | title=_("Automatically build when branch changes"), | 509 | title=_("Automatically build when branch changes"), |
140 | 503 | required=True, readonly=False, | 510 | required=True, readonly=False, |
141 | 504 | 511 | ||
142 | === modified file 'lib/lp/snappy/model/snap.py' | |||
143 | --- lib/lp/snappy/model/snap.py 2018-04-04 14:14:30 +0000 | |||
144 | +++ lib/lp/snappy/model/snap.py 2018-04-21 10:15:59 +0000 | |||
145 | @@ -200,6 +200,8 @@ | |||
146 | 200 | 200 | ||
147 | 201 | allow_internet = Bool(name='allow_internet', allow_none=False) | 201 | allow_internet = Bool(name='allow_internet', allow_none=False) |
148 | 202 | 202 | ||
149 | 203 | build_source_tarball = Bool(name='build_source_tarball', allow_none=False) | ||
150 | 204 | |||
151 | 203 | store_upload = Bool(name='store_upload', allow_none=False) | 205 | store_upload = Bool(name='store_upload', allow_none=False) |
152 | 204 | 206 | ||
153 | 205 | store_series_id = Int(name='store_series', allow_none=True) | 207 | store_series_id = Int(name='store_series', allow_none=True) |
154 | @@ -216,8 +218,9 @@ | |||
155 | 216 | auto_build_archive=None, auto_build_pocket=None, | 218 | auto_build_archive=None, auto_build_pocket=None, |
156 | 217 | auto_build_channels=None, require_virtualized=True, | 219 | auto_build_channels=None, require_virtualized=True, |
157 | 218 | date_created=DEFAULT, private=False, allow_internet=True, | 220 | date_created=DEFAULT, private=False, allow_internet=True, |
160 | 219 | store_upload=False, store_series=None, store_name=None, | 221 | build_source_tarball=False, store_upload=False, |
161 | 220 | store_secrets=None, store_channels=None): | 222 | store_series=None, store_name=None, store_secrets=None, |
162 | 223 | store_channels=None): | ||
163 | 221 | """Construct a `Snap`.""" | 224 | """Construct a `Snap`.""" |
164 | 222 | super(Snap, self).__init__() | 225 | super(Snap, self).__init__() |
165 | 223 | self.registrant = registrant | 226 | self.registrant = registrant |
166 | @@ -236,6 +239,7 @@ | |||
167 | 236 | self.date_last_modified = date_created | 239 | self.date_last_modified = date_created |
168 | 237 | self.private = private | 240 | self.private = private |
169 | 238 | self.allow_internet = allow_internet | 241 | self.allow_internet = allow_internet |
170 | 242 | self.build_source_tarball = build_source_tarball | ||
171 | 239 | self.store_upload = store_upload | 243 | self.store_upload = store_upload |
172 | 240 | self.store_series = store_series | 244 | self.store_series = store_series |
173 | 241 | self.store_name = store_name | 245 | self.store_name = store_name |
174 | @@ -672,8 +676,9 @@ | |||
175 | 672 | auto_build_archive=None, auto_build_pocket=None, | 676 | auto_build_archive=None, auto_build_pocket=None, |
176 | 673 | auto_build_channels=None, require_virtualized=True, | 677 | auto_build_channels=None, require_virtualized=True, |
177 | 674 | processors=None, date_created=DEFAULT, private=False, | 678 | processors=None, date_created=DEFAULT, private=False, |
180 | 675 | allow_internet=True, store_upload=False, store_series=None, | 679 | allow_internet=True, build_source_tarball=False, |
181 | 676 | store_name=None, store_secrets=None, store_channels=None): | 680 | store_upload=False, store_series=None, store_name=None, |
182 | 681 | store_secrets=None, store_channels=None): | ||
183 | 677 | """See `ISnapSet`.""" | 682 | """See `ISnapSet`.""" |
184 | 678 | if not registrant.inTeam(owner): | 683 | if not registrant.inTeam(owner): |
185 | 679 | if owner.is_team: | 684 | if owner.is_team: |
186 | @@ -717,6 +722,7 @@ | |||
187 | 717 | auto_build_channels=auto_build_channels, | 722 | auto_build_channels=auto_build_channels, |
188 | 718 | require_virtualized=require_virtualized, date_created=date_created, | 723 | require_virtualized=require_virtualized, date_created=date_created, |
189 | 719 | private=private, allow_internet=allow_internet, | 724 | private=private, allow_internet=allow_internet, |
190 | 725 | build_source_tarball=build_source_tarball, | ||
191 | 720 | store_upload=store_upload, store_series=store_series, | 726 | store_upload=store_upload, store_series=store_series, |
192 | 721 | store_name=store_name, store_secrets=store_secrets, | 727 | store_name=store_name, store_secrets=store_secrets, |
193 | 722 | store_channels=store_channels) | 728 | store_channels=store_channels) |
194 | 723 | 729 | ||
195 | === modified file 'lib/lp/snappy/model/snapbuildbehaviour.py' | |||
196 | --- lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-04 14:14:30 +0000 | |||
197 | +++ lib/lp/snappy/model/snapbuildbehaviour.py 2018-04-21 10:15:59 +0000 | |||
198 | @@ -132,6 +132,7 @@ | |||
199 | 132 | raise CannotBuild( | 132 | raise CannotBuild( |
200 | 133 | "Source branch/repository for ~%s/%s has been deleted." % | 133 | "Source branch/repository for ~%s/%s has been deleted." % |
201 | 134 | (build.snap.owner.name, build.snap.name)) | 134 | (build.snap.owner.name, build.snap.name)) |
202 | 135 | args["build_source_tarball"] = build.snap.build_source_tarball | ||
203 | 135 | defer.returnValue(args) | 136 | defer.returnValue(args) |
204 | 136 | 137 | ||
205 | 137 | @defer.inlineCallbacks | 138 | @defer.inlineCallbacks |
206 | 138 | 139 | ||
207 | === modified file 'lib/lp/snappy/templates/snap-edit.pt' | |||
208 | --- lib/lp/snappy/templates/snap-edit.pt 2017-03-27 19:28:36 +0000 | |||
209 | +++ lib/lp/snappy/templates/snap-edit.pt 2018-04-21 10:15:59 +0000 | |||
210 | @@ -60,6 +60,10 @@ | |||
211 | 60 | </td> | 60 | </td> |
212 | 61 | </tr> | 61 | </tr> |
213 | 62 | 62 | ||
214 | 63 | <tal:widget define="widget nocall:view/widgets/build_source_tarball"> | ||
215 | 64 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> | ||
216 | 65 | </tal:widget> | ||
217 | 66 | |||
218 | 63 | <tal:widget define="widget nocall:view/widgets/auto_build"> | 67 | <tal:widget define="widget nocall:view/widgets/auto_build"> |
219 | 64 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> | 68 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> |
220 | 65 | </tal:widget> | 69 | </tal:widget> |
221 | 66 | 70 | ||
222 | === modified file 'lib/lp/snappy/templates/snap-index.pt' | |||
223 | --- lib/lp/snappy/templates/snap-index.pt 2017-01-04 20:52:12 +0000 | |||
224 | +++ lib/lp/snappy/templates/snap-index.pt 2018-04-21 10:15:59 +0000 | |||
225 | @@ -61,6 +61,15 @@ | |||
226 | 61 | <a tal:replace="structure view/menu:overview/edit/fmt:icon"/> | 61 | <a tal:replace="structure view/menu:overview/edit/fmt:icon"/> |
227 | 62 | </dd> | 62 | </dd> |
228 | 63 | </dl> | 63 | </dl> |
229 | 64 | <dl id="build_source_tarball" | ||
230 | 65 | tal:define="build_source_tarball context/build_source_tarball"> | ||
231 | 66 | <dt>Build source tarball:</dt> | ||
232 | 67 | <dd> | ||
233 | 68 | <span tal:condition="build_source_tarball">Yes</span> | ||
234 | 69 | <span tal:condition="not: build_source_tarball">No</span> | ||
235 | 70 | <a tal:replace="structure view/menu:overview/edit/fmt:icon"/> | ||
236 | 71 | </dd> | ||
237 | 72 | </dl> | ||
238 | 64 | 73 | ||
239 | 65 | <dl id="auto_build"> | 74 | <dl id="auto_build"> |
240 | 66 | <dt>Build schedule: | 75 | <dt>Build schedule: |
241 | 67 | 76 | ||
242 | === modified file 'lib/lp/snappy/templates/snap-new.pt' | |||
243 | --- lib/lp/snappy/templates/snap-new.pt 2017-03-27 19:28:36 +0000 | |||
244 | +++ lib/lp/snappy/templates/snap-new.pt 2018-04-21 10:15:59 +0000 | |||
245 | @@ -35,6 +35,9 @@ | |||
246 | 35 | <tal:widget define="widget nocall:view/widgets/processors"> | 35 | <tal:widget define="widget nocall:view/widgets/processors"> |
247 | 36 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> | 36 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> |
248 | 37 | </tal:widget> | 37 | </tal:widget> |
249 | 38 | <tal:widget define="widget nocall:view/widgets/build_source_tarball"> | ||
250 | 39 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> | ||
251 | 40 | </tal:widget> | ||
252 | 38 | 41 | ||
253 | 39 | <tal:widget define="widget nocall:view/widgets/auto_build"> | 42 | <tal:widget define="widget nocall:view/widgets/auto_build"> |
254 | 40 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> | 43 | <metal:block use-macro="context/@@launchpad_form/widget_row" /> |
255 | 41 | 44 | ||
256 | === modified file 'lib/lp/snappy/tests/test_snap.py' | |||
257 | --- lib/lp/snappy/tests/test_snap.py 2018-04-15 16:23:14 +0000 | |||
258 | +++ lib/lp/snappy/tests/test_snap.py 2018-04-21 10:15:59 +0000 | |||
259 | @@ -654,6 +654,7 @@ | |||
260 | 654 | self.assertTrue(snap.require_virtualized) | 654 | self.assertTrue(snap.require_virtualized) |
261 | 655 | self.assertFalse(snap.private) | 655 | self.assertFalse(snap.private) |
262 | 656 | self.assertTrue(snap.allow_internet) | 656 | self.assertTrue(snap.allow_internet) |
263 | 657 | self.assertFalse(snap.build_source_tarball) | ||
264 | 657 | 658 | ||
265 | 658 | def test_creation_git(self): | 659 | def test_creation_git(self): |
266 | 659 | # The metadata entries supplied when a Snap is created for a Git | 660 | # The metadata entries supplied when a Snap is created for a Git |
267 | @@ -676,6 +677,7 @@ | |||
268 | 676 | self.assertTrue(snap.require_virtualized) | 677 | self.assertTrue(snap.require_virtualized) |
269 | 677 | self.assertFalse(snap.private) | 678 | self.assertFalse(snap.private) |
270 | 678 | self.assertTrue(snap.allow_internet) | 679 | self.assertTrue(snap.allow_internet) |
271 | 680 | self.assertFalse(snap.build_source_tarball) | ||
272 | 679 | 681 | ||
273 | 680 | def test_creation_git_url(self): | 682 | def test_creation_git_url(self): |
274 | 681 | # A Snap can be backed directly by a URL for an external Git | 683 | # A Snap can be backed directly by a URL for an external Git |
275 | @@ -1381,6 +1383,7 @@ | |||
276 | 1381 | self.assertIsNone(snap["git_ref_link"]) | 1383 | self.assertIsNone(snap["git_ref_link"]) |
277 | 1382 | self.assertTrue(snap["require_virtualized"]) | 1384 | self.assertTrue(snap["require_virtualized"]) |
278 | 1383 | self.assertTrue(snap["allow_internet"]) | 1385 | self.assertTrue(snap["allow_internet"]) |
279 | 1386 | self.assertFalse(snap["build_source_tarball"]) | ||
280 | 1384 | 1387 | ||
281 | 1385 | def test_new_git(self): | 1388 | def test_new_git(self): |
282 | 1386 | # Ensure Snap creation based on a Git branch works. | 1389 | # Ensure Snap creation based on a Git branch works. |
283 | @@ -1402,6 +1405,7 @@ | |||
284 | 1402 | self.assertEqual(self.getURL(ref), snap["git_ref_link"]) | 1405 | self.assertEqual(self.getURL(ref), snap["git_ref_link"]) |
285 | 1403 | self.assertTrue(snap["require_virtualized"]) | 1406 | self.assertTrue(snap["require_virtualized"]) |
286 | 1404 | self.assertTrue(snap["allow_internet"]) | 1407 | self.assertTrue(snap["allow_internet"]) |
287 | 1408 | self.assertFalse(snap["build_source_tarball"]) | ||
288 | 1405 | 1409 | ||
289 | 1406 | def test_new_private(self): | 1410 | def test_new_private(self): |
290 | 1407 | # Ensure private Snap creation works. | 1411 | # Ensure private Snap creation works. |
291 | 1408 | 1412 | ||
292 | === modified file 'lib/lp/snappy/tests/test_snapbuildbehaviour.py' | |||
293 | --- lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-04 14:14:30 +0000 | |||
294 | +++ lib/lp/snappy/tests/test_snapbuildbehaviour.py 2018-04-21 10:15:59 +0000 | |||
295 | @@ -278,6 +278,7 @@ | |||
296 | 278 | "archives": expected_archives, | 278 | "archives": expected_archives, |
297 | 279 | "arch_tag": "i386", | 279 | "arch_tag": "i386", |
298 | 280 | "branch": branch.bzr_identity, | 280 | "branch": branch.bzr_identity, |
299 | 281 | "build_source_tarball": False, | ||
300 | 281 | "build_url": canonical_url(job.build), | 282 | "build_url": canonical_url(job.build), |
301 | 282 | "name": "test-snap", | 283 | "name": "test-snap", |
302 | 283 | "proxy_url": self.proxy_url, | 284 | "proxy_url": self.proxy_url, |
303 | @@ -300,6 +301,7 @@ | |||
304 | 300 | "archive_private": False, | 301 | "archive_private": False, |
305 | 301 | "archives": expected_archives, | 302 | "archives": expected_archives, |
306 | 302 | "arch_tag": "i386", | 303 | "arch_tag": "i386", |
307 | 304 | "build_source_tarball": False, | ||
308 | 303 | "build_url": canonical_url(job.build), | 305 | "build_url": canonical_url(job.build), |
309 | 304 | "git_repository": ref.repository.git_https_url, | 306 | "git_repository": ref.repository.git_https_url, |
310 | 305 | "git_path": ref.name, | 307 | "git_path": ref.name, |
311 | @@ -325,6 +327,7 @@ | |||
312 | 325 | "archive_private": False, | 327 | "archive_private": False, |
313 | 326 | "archives": expected_archives, | 328 | "archives": expected_archives, |
314 | 327 | "arch_tag": "i386", | 329 | "arch_tag": "i386", |
315 | 330 | "build_source_tarball": False, | ||
316 | 328 | "build_url": canonical_url(job.build), | 331 | "build_url": canonical_url(job.build), |
317 | 329 | "git_repository": ref.repository.git_https_url, | 332 | "git_repository": ref.repository.git_https_url, |
318 | 330 | "name": "test-snap", | 333 | "name": "test-snap", |
319 | @@ -350,6 +353,7 @@ | |||
320 | 350 | "archive_private": False, | 353 | "archive_private": False, |
321 | 351 | "archives": expected_archives, | 354 | "archives": expected_archives, |
322 | 352 | "arch_tag": "i386", | 355 | "arch_tag": "i386", |
323 | 356 | "build_source_tarball": False, | ||
324 | 353 | "build_url": canonical_url(job.build), | 357 | "build_url": canonical_url(job.build), |
325 | 354 | "git_repository": url, | 358 | "git_repository": url, |
326 | 355 | "git_path": "master", | 359 | "git_path": "master", |
327 | @@ -375,6 +379,7 @@ | |||
328 | 375 | "archive_private": False, | 379 | "archive_private": False, |
329 | 376 | "archives": expected_archives, | 380 | "archives": expected_archives, |
330 | 377 | "arch_tag": "i386", | 381 | "arch_tag": "i386", |
331 | 382 | "build_source_tarball": False, | ||
332 | 378 | "build_url": canonical_url(job.build), | 383 | "build_url": canonical_url(job.build), |
333 | 379 | "git_repository": url, | 384 | "git_repository": url, |
334 | 380 | "name": "test-snap", | 385 | "name": "test-snap", |
335 | @@ -414,6 +419,7 @@ | |||
336 | 414 | self.assertFalse(isProxy(args["channels"])) | 419 | self.assertFalse(isProxy(args["channels"])) |
337 | 415 | self.assertEqual({"snapcraft": "edge"}, args["channels"]) | 420 | self.assertEqual({"snapcraft": "edge"}, args["channels"]) |
338 | 416 | 421 | ||
339 | 422 | @defer.inlineCallbacks | ||
340 | 417 | def test_extraBuildArgs_disallow_internet(self): | 423 | def test_extraBuildArgs_disallow_internet(self): |
341 | 418 | # If external network access is not allowed for the snap, | 424 | # If external network access is not allowed for the snap, |
342 | 419 | # _extraBuildArgs does not dispatch a proxy token. | 425 | # _extraBuildArgs does not dispatch a proxy token. |
343 | @@ -423,6 +429,14 @@ | |||
344 | 423 | self.assertNotIn("revocation_endpoint", args) | 429 | self.assertNotIn("revocation_endpoint", args) |
345 | 424 | 430 | ||
346 | 425 | @defer.inlineCallbacks | 431 | @defer.inlineCallbacks |
347 | 432 | def test_extraBuildArgs_build_source_tarball(self): | ||
348 | 433 | # If the snap requests building of a source tarball, _extraBuildArgs | ||
349 | 434 | # sends the appropriate arguments. | ||
350 | 435 | job = self.makeJob(build_source_tarball=True) | ||
351 | 436 | args = yield job._extraBuildArgs() | ||
352 | 437 | self.assertTrue(args["build_source_tarball"]) | ||
353 | 438 | |||
354 | 439 | @defer.inlineCallbacks | ||
355 | 426 | def test_composeBuildRequest_proxy_url_set(self): | 440 | def test_composeBuildRequest_proxy_url_set(self): |
356 | 427 | job = self.makeJob() | 441 | job = self.makeJob() |
357 | 428 | build_request = yield job.composeBuildRequest(None) | 442 | build_request = yield job.composeBuildRequest(None) |
358 | 429 | 443 | ||
359 | === modified file 'lib/lp/testing/factory.py' | |||
360 | --- lib/lp/testing/factory.py 2018-04-04 14:14:30 +0000 | |||
361 | +++ lib/lp/testing/factory.py 2018-04-21 10:15:59 +0000 | |||
362 | @@ -4673,8 +4673,9 @@ | |||
363 | 4673 | auto_build_channels=None, is_stale=None, | 4673 | auto_build_channels=None, is_stale=None, |
364 | 4674 | require_virtualized=True, processors=None, | 4674 | require_virtualized=True, processors=None, |
365 | 4675 | date_created=DEFAULT, private=False, allow_internet=True, | 4675 | date_created=DEFAULT, private=False, allow_internet=True, |
368 | 4676 | store_upload=False, store_series=None, store_name=None, | 4676 | build_source_tarball=False, store_upload=False, |
369 | 4677 | store_secrets=None, store_channels=None): | 4677 | store_series=None, store_name=None, store_secrets=None, |
370 | 4678 | store_channels=None): | ||
371 | 4678 | """Make a new Snap.""" | 4679 | """Make a new Snap.""" |
372 | 4679 | if registrant is None: | 4680 | if registrant is None: |
373 | 4680 | registrant = self.makePerson() | 4681 | registrant = self.makePerson() |
374 | @@ -4699,9 +4700,11 @@ | |||
375 | 4699 | auto_build=auto_build, auto_build_archive=auto_build_archive, | 4700 | auto_build=auto_build, auto_build_archive=auto_build_archive, |
376 | 4700 | auto_build_pocket=auto_build_pocket, | 4701 | auto_build_pocket=auto_build_pocket, |
377 | 4701 | auto_build_channels=auto_build_channels, private=private, | 4702 | auto_build_channels=auto_build_channels, private=private, |
381 | 4702 | allow_internet=allow_internet, store_upload=store_upload, | 4703 | allow_internet=allow_internet, |
382 | 4703 | store_series=store_series, store_name=store_name, | 4704 | build_source_tarball=build_source_tarball, |
383 | 4704 | store_secrets=store_secrets, store_channels=store_channels) | 4705 | store_upload=store_upload, store_series=store_series, |
384 | 4706 | store_name=store_name, store_secrets=store_secrets, | ||
385 | 4707 | store_channels=store_channels) | ||
386 | 4705 | if is_stale is not None: | 4708 | if is_stale is not None: |
387 | 4706 | removeSecurityProxy(snap).is_stale = is_stale | 4709 | removeSecurityProxy(snap).is_stale = is_stale |
388 | 4707 | IStore(snap).flush() | 4710 | IStore(snap).flush() |