Merge lp:~mterry/snapcraft/debian-packaging into lp:~snappy-dev/snapcraft/core

Proposed by Michael Terry on 2015-07-06
Status: Merged
Merged at revision: 70
Proposed branch: lp:~mterry/snapcraft/debian-packaging
Merge into: lp:~snappy-dev/snapcraft/core
Diff against target: 215 lines (+131/-4)
12 files modified
.bzrignore (+3/-0)
bin/snapcraft (+12/-1)
debian/changelog (+5/-0)
debian/compat (+1/-0)
debian/control (+25/-0)
debian/copyright (+22/-0)
debian/rules (+11/-0)
debian/source/format (+1/-0)
debian/source/options (+7/-0)
setup.py (+41/-0)
snapcraft/common.py (+2/-0)
snapcraft/plugin.py (+1/-3)
To merge this branch: bzr merge lp:~mterry/snapcraft/debian-packaging
Reviewer Review Type Date Requested Status
Michael Vogt Approve on 2015-07-07
Ricardo Salveti (community) 2015-07-06 Needs Fixing on 2015-07-06
Review via email: mp+263937@code.launchpad.net

Commit Message

Add debian packaging.

Description of the Change

Add debian packaging.

I've also added a setup.py to make building snapcraft follow python conventions. And I've made bin/snapcraft look at whether it's running from trunk or an installed system and look for its data files appropriately.

To post a comment you must log in.
Ricardo Salveti (rsalveti) wrote :

Got the following when building with sbuild:

py3versions: no X-Python3-Version in control file, using supported versions
dh clean --with python3
   dh_testdir
   dh_auto_clean
Can't exec "pyversions": No such file or directory at /usr/share/perl5/Debian/Debhelper/Buildsystem/python_distutils.pm line 120.

From my system that is provided by python3-minimal, wonder if we need to manually depend on that instead.

review: Needs Fixing
Michael Terry (mterry) wrote :

Ah yes, I forgot the critical step of building in a chroot. /.\

Fixed now.

Michael Vogt (mvo) wrote :

Thanks, this looks good, great to see that the packaging is there now! I have one minor idea/suggestion inline but not important at all, this can land as is.

review: Approve
Michael Terry (mterry) :
Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~mterry/snapcraft/debian-packaging into lp:snapcraft failed. Below is the output from the failed tests.

/bin/sh: 1: ./.tarmac.sh: not found

Snappy Tarmac (snappydevtarmac) wrote :

The attempt to merge lp:~mterry/snapcraft/debian-packaging into lp:snapcraft failed. Below is the output from the failed tests.

++ pwd
+ export PATH=/tmp/tarmac/branch.FpXQ_I/bin:/usr/bin:/bin
+ PATH=/tmp/tarmac/branch.FpXQ_I/bin:/usr/bin:/bin
++ pwd
+ export PYTHONPATH=/tmp/tarmac/branch.FpXQ_I:
+ PYTHONPATH=/tmp/tarmac/branch.FpXQ_I:
+ SRC_PATHS='bin snapcraft tests/unit'
+ pep8 bin snapcraft tests/unit --ignore=E501
./runtests.sh: line 26: pep8: command not found

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-06-26 11:25:17 +0000
3+++ .bzrignore 2015-07-06 23:36:08 +0000
4@@ -1,3 +1,6 @@
5 **/parts/
6 **/snap/
7 **/stage/
8+build
9+dist
10+*.egg-info
11
12=== modified file 'bin/snapcraft'
13--- bin/snapcraft 2015-07-02 13:26:46 +0000
14+++ bin/snapcraft 2015-07-06 23:36:08 +0000
15@@ -19,8 +19,19 @@
16 import os
17 import sys
18
19-sys.path.append(os.path.abspath(os.path.join(__file__, "..", "..")))
20+inTrunk = False
21+topdir = os.path.abspath(os.path.join(__file__, "..", ".."))
22+if os.path.exists(os.path.join(topdir, 'setup.py')):
23+ inTrunk = True
24+ sys.path.append(topdir)
25+
26 import snapcraft.cmds
27+import snapcraft.common
28+
29+if inTrunk:
30+ snapcraft.common.plugindir = os.path.join(topdir, 'plugins')
31+else:
32+ snapcraft.common.plugindir = os.path.join(topdir, 'share', 'snapcraft', 'plugins')
33
34 root_parser = argparse.ArgumentParser()
35 subparsers = root_parser.add_subparsers(dest='cmd')
36
37=== added directory 'debian'
38=== added file 'debian/changelog'
39--- debian/changelog 1970-01-01 00:00:00 +0000
40+++ debian/changelog 2015-07-06 23:36:08 +0000
41@@ -0,0 +1,5 @@
42+snapcraft (0) UNRELEASED; urgency=low
43+
44+ * Testing (just a dummy changelog, will be replaced by daily build scripts)
45+
46+ -- Michael Terry <mterry@ubuntu.com> Mon, 6 Jul 2015 21:55:21 -0500
47
48=== added file 'debian/compat'
49--- debian/compat 1970-01-01 00:00:00 +0000
50+++ debian/compat 2015-07-06 23:36:08 +0000
51@@ -0,0 +1,1 @@
52+9
53
54=== added file 'debian/control'
55--- debian/control 1970-01-01 00:00:00 +0000
56+++ debian/control 2015-07-06 23:36:08 +0000
57@@ -0,0 +1,25 @@
58+Source: snapcraft
59+Section: utils
60+Priority: extra
61+Maintainer: Snapcraft Team <snappy-devel@lists.ubuntu.com>
62+Build-Depends: debhelper (>= 9),
63+ dh-python,
64+ pep8,
65+ plainbox,
66+ pyflakes,
67+ python3,
68+ python3-setuptools,
69+ python3-yaml,
70+Homepage: https://launchpad.net/snapcraft
71+Standards-Version: 3.9.6
72+
73+Package: snapcraft
74+Architecture: any
75+Depends: ${misc:Depends},
76+ ${python3:Depends},
77+ python3-yaml,
78+Description: easily craft snaps
79+ Snapcraft aims to make upstream developers' lives easier and as such is not
80+ a single toolset, but instead is a collection of tools that enable the
81+ natural workflow of an upstream to be extended with a simple release step
82+ into Snappy.
83
84=== added file 'debian/copyright'
85--- debian/copyright 1970-01-01 00:00:00 +0000
86+++ debian/copyright 2015-07-06 23:36:08 +0000
87@@ -0,0 +1,22 @@
88+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
89+Upstream-Name: Snapcraft
90+Upstream-Contact: Snapcraft Team <snappy-devel@lists.ubuntu.com>
91+Source: https://launchpad.net/snapcraft
92+
93+Files: *
94+Copyright: 2015 Canonical Ltd
95+License: GPL-3
96+ This program is free software: you can redistribute it and/or modify
97+ it under the terms of the GNU General Public License version 3 as
98+ published by the Free Software Foundation.
99+ .
100+ This program is distributed in the hope that it will be useful,
101+ but WITHOUT ANY WARRANTY; without even the implied warranty of
102+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103+ GNU General Public License for more details.
104+ .
105+ You should have received a copy of the GNU General Public License
106+ along with this program. If not, see <http://www.gnu.org/licenses/>.
107+ .
108+ On Debian systems, the full text of the GNU General Public License
109+ version 3 can be found in the file /usr/share/common-licenses/GPL-3.
110
111=== added file 'debian/rules'
112--- debian/rules 1970-01-01 00:00:00 +0000
113+++ debian/rules 2015-07-06 23:36:08 +0000
114@@ -0,0 +1,11 @@
115+#!/usr/bin/make -f
116+# -*- Mode:Makefile; indent-tabs-mode:t; tab-width:4 -*-
117+
118+%:
119+ dh $@ --with python3 --buildsystem=pybuild
120+
121+override_dh_auto_test:
122+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
123+ python3 setup.py test
124+endif
125+
126
127=== added directory 'debian/source'
128=== added file 'debian/source/format'
129--- debian/source/format 1970-01-01 00:00:00 +0000
130+++ debian/source/format 2015-07-06 23:36:08 +0000
131@@ -0,0 +1,1 @@
132+3.0 (native)
133
134=== added file 'debian/source/options'
135--- debian/source/options 1970-01-01 00:00:00 +0000
136+++ debian/source/options 2015-07-06 23:36:08 +0000
137@@ -0,0 +1,7 @@
138+# Ignore standard files (like .bzr)
139+tar-ignore
140+
141+# Ignore examples folder because it likely contains a bunch of stuff we don't
142+# care about (like downloaded go1.4 binaries and such). It's not important
143+# for it to be distributed with the source.
144+tar-ignore = "examples"
145
146=== added file 'setup.py'
147--- setup.py 1970-01-01 00:00:00 +0000
148+++ setup.py 2015-07-06 23:36:08 +0000
149@@ -0,0 +1,41 @@
150+#!/usr/bin/env python3
151+# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
152+#
153+# Copyright (C) 2015 Canonical Ltd
154+#
155+# This program is free software: you can redistribute it and/or modify
156+# it under the terms of the GNU General Public License version 3 as
157+# published by the Free Software Foundation.
158+#
159+# This program is distributed in the hope that it will be useful,
160+# but WITHOUT ANY WARRANTY; without even the implied warranty of
161+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
162+# GNU General Public License for more details.
163+#
164+# You should have received a copy of the GNU General Public License
165+# along with this program. If not, see <http://www.gnu.org/licenses/>.
166+
167+import os
168+import subprocess
169+
170+from setuptools import setup
171+from setuptools.command.test import test
172+
173+
174+class TestCommand(test):
175+ def run(self):
176+ subprocess.check_call(['./runtests.sh'])
177+
178+
179+setup(name="snapcraft",
180+ version="0",
181+ description="Easily craft snaps",
182+ author_email="snappy-devel@lists.ubuntu.com",
183+ url="https://launchpad.net/snapcraft",
184+ packages=['snapcraft',
185+ 'snapcraft.plugins'],
186+ package_data={'snapcraft.plugins': ['manifest.txt']},
187+ scripts=['bin/snapcraft'],
188+ data_files=[('share/snapcraft/plugins', ['plugins/' + x for x in os.listdir('plugins')])],
189+ cmdclass={'test': TestCommand},
190+)
191
192=== modified file 'snapcraft/common.py'
193--- snapcraft/common.py 2015-07-02 14:16:40 +0000
194+++ snapcraft/common.py 2015-07-06 23:36:08 +0000
195@@ -45,3 +45,5 @@
196 commandOrder = ["pull", "build", "stage", "snap"]
197 stagedir = os.path.join(os.getcwd(), "stage")
198 snapdir = os.path.join(os.getcwd(), "snap")
199+
200+plugindir = '/usr/share/snapcraft/plugins'
201
202=== modified file 'snapcraft/plugin.py'
203--- snapcraft/plugin.py 2015-07-02 20:27:20 +0000
204+++ snapcraft/plugin.py 2015-07-06 23:36:08 +0000
205@@ -37,9 +37,7 @@
206 self.statefile = os.path.join(os.getcwd(), "parts", partName, "state")
207
208 if loadConfig:
209- # FIXME: use env var for this
210- pluginDir = os.path.abspath(os.path.join(__file__, '..', '..', 'plugins'))
211- configPath = os.path.join(pluginDir, name + ".yaml")
212+ configPath = os.path.join(snapcraft.common.plugindir, name + ".yaml")
213 if not os.path.exists(configPath):
214 snapcraft.common.log("Missing config for part %s" % (name), file=sys.stderr)
215 return

Subscribers

People subscribed via source and target branches