Merge lp:~sergiusens/snapcraft/1501413 into lp:~snappy-dev/snapcraft/core

Proposed by Sergio Schvezov
Status: Merged
Approved by: John Lenton
Approved revision: 223
Merged at revision: 223
Proposed branch: lp:~sergiusens/snapcraft/1501413
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 118 lines (+20/-3)
9 files modified
integration-tests/data/assemble/snapcraft.yaml (+1/-0)
integration-tests/data/build-tools/snapcraft.yaml (+1/-0)
integration-tests/data/local-plugin/snapcraft.yaml (+1/-0)
integration-tests/data/local-source/snapcraft.yaml (+1/-0)
integration-tests/data/simple-cmake/snapcraft.yaml (+1/-0)
integration-tests/data/simple-make-filesets/snapcraft.yaml (+1/-0)
integration-tests/data/simple-make/snapcraft.yaml (+1/-0)
snapcraft/cmds.py (+5/-0)
snapcraft/yaml.py (+8/-3)
To merge this branch: bzr merge lp:~sergiusens/snapcraft/1501413
Reviewer Review Type Date Requested Status
Sergio Schvezov Approve
John Lenton (community) Approve
Review via email: mp+272953@code.launchpad.net

Commit message

Do not infer a plugin from the part name

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) wrote :

LGTM; a nit and a hint.

review: Approve
Revision history for this message
John Lenton (chipaca) wrote :

(not top-approving in case you want to address the nit&hint, but feel free to do so irrespectively.

Revision history for this message
John Lenton (chipaca) wrote :

)

lp:~sergiusens/snapcraft/1501413 updated
223. By Sergio Schvezov

review fixes

Revision history for this message
Sergio Schvezov (sergiusens) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'integration-tests/data/assemble/snapcraft.yaml'
2--- integration-tests/data/assemble/snapcraft.yaml 2015-09-21 05:04:31 +0000
3+++ integration-tests/data/assemble/snapcraft.yaml 2015-09-30 19:44:37 +0000
4@@ -16,4 +16,5 @@
5
6 parts:
7 make-project:
8+ plugin: make-project
9 source: .
10
11=== modified file 'integration-tests/data/build-tools/snapcraft.yaml'
12--- integration-tests/data/build-tools/snapcraft.yaml 2015-09-22 14:57:05 +0000
13+++ integration-tests/data/build-tools/snapcraft.yaml 2015-09-30 19:44:37 +0000
14@@ -7,6 +7,7 @@
15
16 parts:
17 make-project:
18+ plugin: make-project
19 source: .
20 stage-packages:
21 - libxml2-dev
22
23=== modified file 'integration-tests/data/local-plugin/snapcraft.yaml'
24--- integration-tests/data/local-plugin/snapcraft.yaml 2015-08-27 21:33:56 +0000
25+++ integration-tests/data/local-plugin/snapcraft.yaml 2015-09-30 19:44:37 +0000
26@@ -7,4 +7,5 @@
27
28 parts:
29 x-local-plugin:
30+ plugin: x-local-plugin
31 source: .
32
33=== modified file 'integration-tests/data/local-source/snapcraft.yaml'
34--- integration-tests/data/local-source/snapcraft.yaml 2015-08-27 21:33:56 +0000
35+++ integration-tests/data/local-source/snapcraft.yaml 2015-09-30 19:44:37 +0000
36@@ -7,4 +7,5 @@
37
38 parts:
39 make-project:
40+ plugin: make-project
41 source: .
42
43=== modified file 'integration-tests/data/simple-cmake/snapcraft.yaml'
44--- integration-tests/data/simple-cmake/snapcraft.yaml 2015-08-27 21:33:56 +0000
45+++ integration-tests/data/simple-cmake/snapcraft.yaml 2015-09-30 19:44:37 +0000
46@@ -7,4 +7,5 @@
47
48 parts:
49 cmake-project:
50+ plugin: cmake-project
51 source: .
52
53=== modified file 'integration-tests/data/simple-make-filesets/snapcraft.yaml'
54--- integration-tests/data/simple-make-filesets/snapcraft.yaml 2015-09-18 19:06:34 +0000
55+++ integration-tests/data/simple-make-filesets/snapcraft.yaml 2015-09-30 19:44:37 +0000
56@@ -7,6 +7,7 @@
57
58 parts:
59 make-project:
60+ plugin: make-project
61 filesets:
62 files:
63 - share/file1
64
65=== modified file 'integration-tests/data/simple-make/snapcraft.yaml'
66--- integration-tests/data/simple-make/snapcraft.yaml 2015-08-27 21:33:56 +0000
67+++ integration-tests/data/simple-make/snapcraft.yaml 2015-09-30 19:44:37 +0000
68@@ -7,4 +7,5 @@
69
70 parts:
71 make-project:
72+ plugin: make-project
73 source: .
74
75=== modified file 'snapcraft/cmds.py'
76--- snapcraft/cmds.py 2015-09-23 04:14:51 +0000
77+++ snapcraft/cmds.py 2015-09-30 19:44:37 +0000
78@@ -360,6 +360,11 @@
79 msg = "Issues while validating snapcraft.yaml: {}".format(e.message)
80 logger.error(msg)
81 sys.exit(1)
82+ except snapcraft.yaml.PluginNotDefinedError as e:
83+ logger.error(
84+ 'Issues while validating snapcraft.yaml: the plugin keyword is '
85+ 'missing and wiki support for the feature is still in progress.')
86+ sys.exit(1)
87 except snapcraft.yaml.SnapcraftLogicError as e:
88 logger.error('Issue detected while analyzing snapcraft.yaml: {}'.format(e.message))
89 sys.exit(1)
90
91=== modified file 'snapcraft/yaml.py'
92--- snapcraft/yaml.py 2015-09-29 13:36:43 +0000
93+++ snapcraft/yaml.py 2015-09-30 19:44:37 +0000
94@@ -65,6 +65,10 @@
95 self._message = message
96
97
98+class PluginNotDefinedError(Exception):
99+ pass
100+
101+
102 class Config:
103
104 def __init__(self):
105@@ -80,9 +84,10 @@
106 for part_name in self.data.get("parts", []):
107 properties = self.data["parts"][part_name] or {}
108
109- plugin_name = properties.get("plugin", part_name)
110- if "plugin" in properties:
111- del properties["plugin"]
112+ plugin_name = properties.pop("plugin", None)
113+ # TODO search the wiki
114+ if not plugin_name:
115+ raise PluginNotDefinedError
116
117 if "after" in properties:
118 after_requests[part_name] = properties["after"]

Subscribers

People subscribed via source and target branches