Merge lp:~longsleep/snapcraft/snapcraft-debs-plugin into lp:~snappy-dev/snapcraft/core

Proposed by Simon Eisenmann
Status: Work in progress
Proposed branch: lp:~longsleep/snapcraft/snapcraft-debs-plugin
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 90 lines (+75/-0)
2 files modified
snapcraft/plugins/debs.py (+74/-0)
snapcraft/tests/test_cmds.py (+1/-0)
To merge this branch: bzr merge lp:~longsleep/snapcraft/snapcraft-debs-plugin
Reviewer Review Type Date Requested Status
Simon Eisenmann (community) Needs Fixing
Snappy Developers Pending
Review via email: mp+266650@code.launchpad.net

Description of the change

Adds a debs plugin which allows to directly use .deb files either from local file or URL.

To post a comment you must log in.
116. By Leo Arias

Send error logs to stderr and message logs to stdout. by elopio approved by mterry

Revision history for this message
Michael Terry (mterry) wrote :

Neat, thanks! But what's the use case for this? Pointing at a PPA's deb file? Grabbing debs from Debian directly?

It seems fragile to point to a single deb on a server since when the repository gets updated, the url will be dead.

Maybe it would be better to add PPA support to the ubuntu plugin?

Revision history for this message
Simon Eisenmann (longsleep) wrote :

The use case is to have reproduceable builds of defined and we'll known deb files, independent of local system arch, dist an version. I guess one could go so far to even comitt deb files along with the snapcraft file. In my case this makes it simple to build armhf snaps on amd64 from defined builds done by pbuilder. For reference please also see https://bugs.launchpad.net/bugs/1480144

review: Needs Fixing
117. By Michael Terry

Include the multiarch triplet to LD_LIBRARY_PATH and set the 'architecture' key in package.yaml if not present for the user. by mterry approved by rsalveti

118. By Michael Terry

Add intro and tutorial docs.

The intro file explains Snappy and the general Snapcraft concepts a bit. It covers the same material as flow.md, so I dropped that file.

The tutorial file goes through crafting a webcam demo snap [1].

I want to add an installing/testing/uploading-to-store section too, but I want to get some experience using the webcam bit and dealing with apparmor for it (seeing if I can get kvm to use my laptop webcam or if I need to have a real USB webcam with a beaglebone). But that addition can happen in a separate branch.

This is taking over from lp:~mvo/snapcraft/docs-1 since mvo is on vacation.

[1] Very similar to https://developer.ubuntu.com/en/snappy/guides/appliance-builder-guide-webcam/ by snappy-dev approved by elopio

119. By Leo Arias

Added unit tests for the base plugin.
Added python3-testscenarios and wget as a dependency. by elopio approved by mterry

120. By Michael Terry

Add python2 and python2-project plugins.

I did this branch when testing the python3 branch (to make sure there was no python bits on the system interfering with the bundled python).

It's basically a straight copy of python3, with appropriate string changes.

I also dropped the configflags option from python3-project. I think that was a copy/paste error. by mterry approved by elopio,sergiusens

121. By Daniel Holbach

Add some next steps. by dholbach approved by sergiusens,longsleep

122. By Daniel Holbach

Small doc markup fixes. by dholbach approved by sergiusens,longsleep

123. By Daniel Holbach

Rename docs/tutorial.md to be less generic. by dholbach approved by elopio

124. By Leo Arias

Refactored the plugin makedirs, with tests. Added python3 >= 3.2 as a dependency, needed by makedirs exist_ok argument. by elopio approved by mterry

125. By Leo Arias

Fixed the call to the log from the ubuntu plugin, with a test. by elopio approved by mterry

Revision history for this message
Michael Terry (mterry) wrote :

Some comments

126. By Ted Gould

QML Plugin by ted approved by mterry

127. By Michael Terry

Tiny packaging fixes

128. By Sergio Schvezov

Adding support for mercurial sources (includes debian/control dependency change). by sergiusens approved by elopio

129. By Sergio Schvezov

Recommends defaulting to None when not part of options by sergiusens approved by elopio

Revision history for this message
Simon Eisenmann (longsleep) wrote :

Rebased on latest upstream and updates to match comments from mterry.

review: Needs Resubmitting
Revision history for this message
Michael Terry (mterry) wrote :

This feels better, thanks. :) Less code duplication. Some further comments though.

130. By Sergio Schvezov

debian/control: adding devscripts as a dep as dget is needed by the ubuntu plugin by sergiusens approved by ogra

131. By Simon Eisenmann

Fix symlinks for directories as well. by longsleep approved by elopio,mterry

132. By Michael Terry

Support the Go compiler on all arches, not just amd64.

This switches from using Google's pre-built binaries to using our archive builds of Google's compiler, thus giving us all platforms we support. And matching what we do for Python and Java.

Since this means we use whichever version of Go the host platform has, I've dropped the "1.4" from the plugin names.

I've tested this on wily and trusty. by mterry approved by sergiusens

133. By Sergio Schvezov

go as build-deps instead of plugged by sergiusens approved by chipaca

134. By Loïc Minier

Add initial and trivial mvn plugin; runs "mvn package" and copies resulting *.jar and *.war files. by lool approved by sergiusens

135. By Zygmunt Krynicki

Correct logging setup by zyga approved by mvo

136. By Zygmunt Krynicki

Ensure that snapcraft run kills qemu by zyga approved by mvo

137. By Zygmunt Krynicki

Correct all the logging calls to pass arguments directly by zyga approved by mvo

138. By Zygmunt Krynicki

Fix numerous issues in snapcraft run by zyga approved by mvo

139. By Zygmunt Krynicki

Add support for SNAPCRAFT_RUN_QEMU_ARGS by zyga approved by mvo

140. By Sergio Schvezov

Generate meta (package.yaml and readme.md) from snapcraft.yaml by sergiusens approved by chipaca,elopio

141. By Sergio Schvezov

Initial json schema support by sergiusens approved by chipaca,elopio

142. By Sergio Schvezov

Multiple testing additions by sergiusens approved by elopio

143. By Sergio Schvezov

icon support for snapcraft.yaml by sergiusens approved by chipaca

144. By Sergio Schvezov

Reducing mccabe complexity from 10 to 3 for PluginHandler.collect_snap_files by sergiusens approved by elopio

145. By Daniel Holbach

Open 0.2 for development, so the daily build (https://code.launchpad.net/~snappy-dev/+recipe/snapcraft-daily) can trump what's in the archive. by dholbach approved by mvo

146. By Sergio Schvezov

Moving source management complexity out of the base plugin by sergiusens approved by sergiusens

147. By Sergio Schvezov

Unit tests for sources by sergiusens approved by sergiusens,mvo

148. By Sergio Schvezov

Remove embedded functions from snapcraft.cmd.run by sergiusens approved by sergiusens,mvo

149. By Daniel Holbach

Fix syntax error in debian/control by dholbach approved by mvo

150. By Daniel Holbach

To use the ant-project plugin, you need to have ant installed as a build-tool. by dholbach approved by mvo

151. By Michael Nelson

Fix snapcraft.yaml's reference to go-package plugin to match changes in r132. by michael.nelson approved by sergiusens

152. By Ted Gould

Add demo.qml back to the snapcraft.yaml for the QML Demo by ted approved by sergiusens,dholbach

153. By Daniel Holbach

Update tomcat upstream URL, fixes example again. by dholbach approved by sergiusens

154. By Sergio Schvezov

Replace Ubuntu plugin with a builtin solution by sergiusens approved by mvo

155. By Sergio Schvezov

Simplifying snapcraft.yaml.Config.__init__ by sergiusens approved by elopio

156. By Sergio Schvezov

Provide a nice error when tabs found in snapcraft.yaml by sergiusens approved by ted

157. By Sergio Schvezov

Plugins are of a type by sergiusens approved by ted

158. By Björn Tillenius

Add support for setuptools based python projects. by bjornt approved by sergiusens,ted

159. By Sergio Schvezov

Filesets based filtering for stage and snap by sergiusens approved by sergiusens,mvo

160. By Sergio Schvezov

snapcraft init with templated values by sergiusens approved by mvo

161. By Sergio Schvezov

regex for binary and service names by sergiusens approved by mvo

162. By Sergio Schvezov

docs refresh by sergiusens approved by chipaca

163. By Sergio Schvezov

Collision logic updates with an introduction of _BUILTIN_OPTIONS so all parts have a certain set of options by default even if not declared. by sergiusens approved by mvo

164. By Daniel Holbach

fix crash when stage_packages is defined in the yaml for the plugin, but empty (getattr does not use [] as default return value in that case) by dholbach approved by sergiusens

165. By Daniel Holbach

Fix small typo. by dholbach approved by sergiusens

166. By Sergio Schvezov

Support config by sergiusens approved by sergiusens,chipaca

167. By Sergio Schvezov

Try to use wiki when after in part is not local by sergiusens approved by sergiusens,chipaca,dholbach

168. By Daniel Holbach

Depend and Build-Depend on python3-requests. by dholbach approved by sergiusens

169. By Sergio Schvezov

apparmor and seccomp by sergiusens approved by chipaca

170. By Sergio Schvezov

Fetch from the wiki only once by sergiusens approved by chipaca,dholbach

171. By Sergio Schvezov

Robustness for stage and snap which follow the spec more closely now by sergiusens approved by chipaca

172. By Sergio Schvezov

Conflicting files that are essentially the same file should not cause problems by sergiusens approved by chipaca

173. By Daniel Holbach

Add autopkgtest, reshuffle build-deps accordingly and run wrap-and-sort. by dholbach approved by elopio,sergiusens

174. By Sergio Schvezov

Fixing pep issues with bin/snapcraft by sergiusens approved by elopio

175. By Sergio Schvezov

Add a clean command by sergiusens approved by chipaca

176. By Sergio Schvezov

setup.py using pypy to setup a config integration test by sergiusens approved by elopio

177. By Daniel Holbach

add libgudev-1.0-dev as build-tools for godd example by dholbach approved by sergiusens

178. By Ted Gould

Add in support for PIP requirements.txt files in the python plugins. by ted approved by sergiusens

179. By Zygmunt Krynicki

Ignore __pycache__ by zyga approved by sergiusens,dholbach

180. By Sergio Schvezov

build-packages instead of build-tools to follow the spec by sergiusens approved by mvo

181. By Leo Arias

On clean, check the contents of the parts dir only if it exists. by elopio approved by sergiusens

182. By Sergio Schvezov

Implementation of the organize keyword from the spec by sergiusens approved by sergiusens,ted

183. By Ted Gould

Wrap setup.py calls to configure the shebang writer by ted approved by sergiusens

184. By Sergio Schvezov

Config hook examples update by sergiusens approved by sergiusens,dholbach

185. By Sergio Schvezov

Using a map instead of list for binaries and services as defined by the spec by sergiusens approved by sergiusens

186. By Ted Gould

Improving stage-package handling by snappy-dev approved by mvo

187. By Sergio Schvezov

Used builddir as a base for setup.py overrides by sergiusens approved by ted

188. By Sergio Schvezov

Use relative paths for image creation by sergiusens approved by elopio

189. By Sergio Schvezov

Notify user why the password is being requested by sergiusens approved by elopio

190. By Sergio Schvezov

Load the config before trying to run by sergiusens approved by elopio

191. By Sergio Schvezov

Remove modules from plugins and infer it from the file name to follow the spec by sergiusens approved by elopio

192. By Sergio Schvezov

Enable ports for architectures that are not amd64 or i386 by sergiusens approved by ogra

193. By Sergio Schvezov

Local plugins as fallback instead of special casing to follow the spec by sergiusens approved by sergiusens,elopio

194. By Michael Vogt

Fetch all packages in a single download run with proper progress by mvo approved by dholbach

195. By Michael Vogt

stage package libgudev-1.0-0, which makes the godd snap actually work by dholbach approved by sergiusens

196. By Sergio Schvezov

Update docs to reflect list to dictionary change for services example by sergiusens approved by elopio

197. By Federico Gimenez

plainbox test for building the examples by fgimenez approved by dholbach

198. By Leo Arias

Fixed the python depends on the snapcraft-examples package. by elopio approved by sergiusens

199. By Ted Gould

Choose the python path based on the version installed by ted approved by sergiusens

200. By Zygmunt Krynicki

Add 'simple' and 'has-leftovers' flags to all integration tests job units. by zyga approved by dholbach,elopio

201. By Michael Vogt

Add quotes around $TEST_PLAN and pass the $1 directly to run_test_plan instead of indirectly in runtests.sh by mvo approved by sergiusens,fgimenez,dholbach

202. By Sergio Schvezov

Make the py 2 and 3 projects smarter and have dependencies pulled during the pull phase by sergiusens approved by chipaca

203. By Sergio Schvezov

do NOT print in tests by sergiusens approved by fgimenez

204. By Sergio Schvezov

Show skipped packages only once per filter by sergiusens approved by chipaca

205. By Ted Gould

Ensure C library configuration tools don't use system paths by ted approved by sergiusens

206. By Michael Vogt

The go plugin should only download in the pull phase by mvo approved by sergiusens

207. By Sergio Schvezov

preparing a changelog by sergiusens approved by sergiusens,dholbach

208. By Sergio Schvezov

Allow using local sources through an env var (mostly useful for launchpad building) by sergiusens approved by mvo,dholbach,cjwatson

209. By Daniel Holbach

Open 0.3 for development. by dholbach approved by sergiusens

210. By Daniel Holbach

Brown paperbag release (install examples into the right directory). by dholbach approved by mvo

211. By Daniel Holbach

Reopen 0.3 for development (after 0.2.1 brown paperbag release). by dholbach approved by sergiusens

212. By Leo Arias

Fixed the heading on the build section of the docs. by elopio approved by dholbach

213. By Sergio Schvezov

Mask tar files so they are writable and set an extraction parameter to start with a clean build dir by sergiusens approved by sergiusens,mvo

214. By Sergio Schvezov

Auto detect tar sources by sergiusens approved by sergiusens,zyga

215. By Sergio Schvezov

Adding a simple scons plugin by sergiusens approved by chipaca

216. By Zygmunt Krynicki

Make integration tests easier to write by zyga approved by sergiusens

217. By Sergio Schvezov

Revert type to plugin by sergiusens approved by sergiusens,zyga

218. By Daniel Holbach

add a tour which details and explains relevant snapcraft features in the examples directory by dholbach approved by elopio

219. By Sergio Schvezov

Allow parameters/options for scons by sergiusens approved by elopio

220. By Colin Watson

Apply better logging and progress behaviour if stdout is not a tty. by cjwatson approved by sergiusens,mvo

221. By Sergio Schvezov

Support framework policies by sergiusens approved by mvo

222. By Sergio Schvezov

Use the series of the host for stage-packages. by sergiusens approved by chipaca

223. By Sergio Schvezov

Do not infer a plugin from the part name by sergiusens approved by sergiusens,chipaca

224. By Sergio Schvezov

Backwards compatibility for using type by sergiusens approved by mvo

225. By Sergio Schvezov

Remove the -project from plugin names that have been released and add a deprecation message by sergiusens approved by chipaca

226. By Leo Arias

Added the make plugin name in the py2-project example. by elopio approved by sergiusens

227. By Sergio Schvezov

Add a buildpackages for libpython2.7-dev by sergiusens approved by elopio

228. By Leo Arias

Return to the branch root to make the test coverage report. by elopio approved by dholbach

229. By Sergio Schvezov

Improving error message when missing the plugin statement by sergiusens approved by elopio

230. By Yasushi SHOJI

Support multiple supported-versions in py3versions by sergiusens approved by chipaca

231. By Sergio Schvezov

Build packages failing to install on the host or not found should be the cause of of a failure by sergiusens approved by chipaca

232. By Daniel Holbach

Fix markdown indentation, make pep8 and pyflakes3 happy. by elopio approved by elopio

233. By Sergio Schvezov

Updating tomcat pull version in examples by sergiusens approved by dholbach

234. By Sergio Schvezov

Copy links to packages we did not download and also untarring not world writable. by sergiusens approved by chipaca

Revision history for this message
Simon Eisenmann (longsleep) wrote :

Synced and rebased with latest snapcraft trunk. Going to add an example next.

Revision history for this message
Simon Eisenmann (longsleep) wrote :

This plugin needs an example.

review: Needs Fixing
235. By Sergio Schvezov

Removing suid/guid bits from extracted debs by sergiusens approved by chipaca

236. By Sergio Schvezov

Plugin yaml's are obsolete by sergiusens approved by elopio,chipaca

237. By Sergio Schvezov

debian/changelog for 0.3 by sergiusens approved by elopio

238. By Daniel Holbach

Open 0.4 for development. by dholbach approved by sergiusens

239. By Sergio Schvezov

Run unit tests when building the deb and make a failing test work by sergiusens approved by fgimenez,chipaca

240. By Sergio Schvezov

Exit cleanly with an error when using the source keyword with a local file by sergiusens approved by elopio

241. By Sergio Schvezov

Search the wiki if the plugin keyword is missing for a part. Tests related to wiki searches are improved by sergiusens approved by elopio

242. By Sergio Schvezov

debian/control: adding python3-requests to Build-Depends by sergiusens approved by chipaca

243. By Ted Gould

Adding a catkin plugin by ted approved by sergiusens

244. By Ted Gould

Make sure there is a directory before trying to copy to it. by ted approved by sergiusens

245. By Ted Gould

Fixes needed for some autotools builds by ted approved by sergiusens

246. By Daniel Holbach

add python3-autopilot as build-depends by dholbach approved by sergiusens

247. By Sergio Schvezov

Document and cleanup the plugin base class

This cleans up the base class to only expose things plugins will need, since the basic schema includes 'source' options it makes sense for pull to implement that as well automatically if supported.

This also moves everything from the base plugin the plugin.py (which should be renamed to lifecycle.py in a future MP, this one is already too big) and any other thing to its own supporting class.

This branch also includes all the plugin cleanup required for things to keep on working. by sergiusens approved by elopio,chipaca

248. By Sergio Schvezov

Rename snapcraft.plugin to snapcraft.lifecycle by sergiusens approved by elopio

249. By Sergio Schvezov

Add support for maven options by sergiusens approved by chipaca

250. By Sergio Schvezov

Query the apt cache to verify if a package is installed or not by sergiusens approved by mvo

251. By Daniel Holbach

Subtle first-sight readability changes on intro doc. by dholbach approved by elopio

252. By Sergio Schvezov

Plugins raise exception instead of true/false by sergiusens approved by elopio

253. By Sergio Schvezov

Add list-plugins by sergiusens approved by elopio,chipaca

254. By Simon Eisenmann

Implemented debs plugin to directly use debs files without local apt.

255. By Simon Eisenmann

Added debs plugin to test.

256. By Simon Eisenmann

Updated to latest snapcraft.

Unmerged revisions

256. By Simon Eisenmann

Updated to latest snapcraft.

255. By Simon Eisenmann

Added debs plugin to test.

254. By Simon Eisenmann

Implemented debs plugin to directly use debs files without local apt.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'snapcraft/plugins/debs.py'
2--- snapcraft/plugins/debs.py 1970-01-01 00:00:00 +0000
3+++ snapcraft/plugins/debs.py 2015-10-27 14:24:07 +0000
4@@ -0,0 +1,74 @@
5+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
6+#
7+# Copyright (C) 2015 struktur AG
8+# Copyright (C) 2015 Canonical Ltd
9+#
10+# This program is free software: you can redistribute it and/or modify
11+# it under the terms of the GNU General Public License version 3 as
12+# published by the Free Software Foundation.
13+#
14+# This program is distributed in the hope that it will be useful,
15+# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+# GNU General Public License for more details.
18+#
19+# You should have received a copy of the GNU General Public License
20+# along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
22+import os
23+import urllib.parse
24+import snapcraft
25+
26+from snapcraft.repo import _fix_contents
27+from snapcraft.common import isurl
28+
29+
30+class DebsPlugin(snapcraft.BasePlugin):
31+
32+ @classmethod
33+ def schema(cls):
34+ return {
35+ 'properties': {
36+ 'debs': {
37+ 'type': 'array',
38+ },
39+ },
40+ 'required': [
41+ 'debs',
42+ ]
43+ }
44+
45+ def __init__(self, name, options):
46+ super().__init__(name, options)
47+ packages = set()
48+ debs = set()
49+ for source in sorted(self.options.debs):
50+ if isurl(source):
51+ filename = os.path.split(urllib.parse.urlparse(source).path)[1]
52+ else:
53+ # Local file.
54+ filename = source
55+ packages.add(filename)
56+ debs.add(source)
57+ self.packages = sorted(packages)
58+ self.debs = sorted(debs)
59+
60+ def pull(self):
61+ for source in self.debs:
62+ self.pull_file(source, destdir=self.sourcedir)
63+
64+ def build(self):
65+ self.unpack_debs(self.packages, self.installdir, debdir=self.sourcedir)
66+ _fix_contents(debdir=self.installdir)
67+
68+ def pull_file(self, source, destdir=None):
69+ if isurl(source):
70+ self.run(['wget', '-q', '-c', source], cwd=destdir)
71+ else:
72+ self.run(['cp', os.path.join(os.getcwd(), source), destdir])
73+
74+ def unpack_debs(self, pkgs, targetDir, debdir=None):
75+ debdir = debdir or self.builddir
76+
77+ for p in pkgs:
78+ self.run(['dpkg-deb', '--extract', p, targetDir], cwd=debdir)
79
80=== modified file 'snapcraft/tests/test_cmds.py'
81--- snapcraft/tests/test_cmds.py 2015-10-26 15:54:30 +0000
82+++ snapcraft/tests/test_cmds.py 2015-10-27 14:24:07 +0000
83@@ -87,6 +87,7 @@
84 catkin
85 cmake
86 copy
87+debs
88 go
89 jdk
90 make

Subscribers

People subscribed via source and target branches