[skeleton] Update Debian packaging template
Here are multiple updates to the Debian packaging template provided when
running `cubicweb-ctl newcube`:
* Switch to source format 3.0 (quilt).
* Switch to debhelper 9.
* Switch to dh-python.
* Add Python 3 packages.
* Name the binary packages `python-cubicweb-CUBENAME` and
`python3-cubicweb-CUBENAME` instead of just `cubicweb-CUBENAME` (which is
still the source package).
* Populate Depends using dh_python{2,3} support for Python requirements.
* Run test suite at build time using pytest.
* Add autopkgtest to run test suite against the installed package.
* Bump Standards-Version to 4.3.0.
--- a/MANIFEST.in Wed Jun 26 12:35:25 2019 +0200
+++ b/MANIFEST.in Wed Jul 10 14:57:58 2019 +0200
@@ -76,6 +76,6 @@
include cubicweb/web/data/jquery-treeview/*.md
-recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.tmpl rules
+recursive-include cubicweb/skeleton *.py *.css *.js *.po compat *.tmpl format options pytest control
prune cubicweb/misc/cwfs
--- a/cubicweb/skeleton/MANIFEST.in.tmpl Wed Jun 26 12:35:25 2019 +0200
+++ b/cubicweb/skeleton/MANIFEST.in.tmpl Wed Jul 10 14:57:58 2019 +0200
@@ -6,5 +6,5 @@
recursive-include cubicweb_%(cubename)s/wdoc *
recursive-include test/data bootstrap_cubes *.py
include *.ini
-recursive-include debian changelog compat control copyright rules
-include cubicweb-%(cubename)s.spec
+prune debian
+prune cubicweb-%(cubename)s.spec
--- a/cubicweb/skeleton/debian/changelog.tmpl Wed Jun 26 12:35:25 2019 +0200
+++ b/cubicweb/skeleton/debian/changelog.tmpl Wed Jul 10 14:57:58 2019 +0200
@@ -1,6 +1,6 @@
-%(distname)s (0.1.0-1) UNRELEASED; urgency=low
+%(distname)s (0.1.0-1) UNRELEASED; urgency=medium
- * initial release
+ * Initial release.
-- %(author)s <%(author-email)s> %(rfc2822-date)s
--- a/cubicweb/skeleton/debian/compat Wed Jun 26 12:35:25 2019 +0200
+++ b/cubicweb/skeleton/debian/compat Wed Jul 10 14:57:58 2019 +0200
@@ -1,1 +1,1 @@
-7
+9
--- a/cubicweb/skeleton/debian/control.tmpl Wed Jun 26 12:35:25 2019 +0200
+++ b/cubicweb/skeleton/debian/control.tmpl Wed Jul 10 14:57:58 2019 +0200
@@ -3,18 +3,23 @@
Priority: optional
Maintainer: %(author)s <%(author-email)s>
Build-Depends:
- debhelper (>= 7),
+ debhelper (>= 9),
dh-python,
- python (>= 2.6.5),
+ python-all,
python-setuptools,
-Standards-Version: 3.9.3
-X-Python-Version: >= 2.6
+ python-pytest,
+ python-cubicweb,
+ python3-all,
+ python3-setuptools,
+ python3-pytest,
+ python3-cubicweb,
+Standards-Version: 4.3.0
+X-Python-Version: >= 2.7
+X-Python3-Version: >= 3.4
-Package: %(distname)s
+Package: python-%(distname)s
Architecture: all
Depends:
- python-cubicweb (>= %(version)s),
- python-six (>= 1.4.0),
${python:Depends},
${misc:Depends},
Description: %(shortdesc)s
@@ -23,4 +28,17 @@
%(longdesc)s
.
This package will install all the components you need to run an application
- using the %(distname)s cube.
+ using the %(distname)s cube for Python 2.
+
+Package: python3-%(distname)s
+Architecture: all
+Depends:
+ ${python3:Depends},
+ ${misc:Depends},
+Description: %(shortdesc)s
+ CubicWeb is a semantic web application framework.
+ .
+ %(longdesc)s
+ .
+ This package will install all the components you need to run an application
+ using the %(distname)s cube for Python 3.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/pybuild.testfiles.tmpl Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,3 @@
+test
+tox.ini
+%(distname)s.egg-info
--- a/cubicweb/skeleton/debian/rules Wed Jun 26 12:35:25 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-#!/usr/bin/make -f
-
-%:
- dh $@ --with python2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/rules.tmpl Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+export PYBUILD_NAME = %(distname)s
+export PYBUILD_OPTION = --test-pytest
+
+%%:
+ dh $@ --with python2,python3 --buildsystem=pybuild
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/source/format Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,1 @@
+3.0 (quilt)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/source/options Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,1 @@
+extend-diff-ignore = "^([^/]*\.spec$)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/tests/control Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,9 @@
+Tests: pytest
+Depends:
+ @builddeps@,
+ # Uncomment if the tests require database access
+ #python3-cubicweb-postgresql-support
+Restrictions:
+ allow-stderr,
+ # Uncomment if the tests require database access
+ #isolation-container,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/tests/pytest Wed Jul 10 14:57:58 2019 +0200
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+set -x
+
+### Setup tests
+
+# Uncomment if tests require database access
+#service postgresql restart || service postgresql start
+#trap 'service postgresql stop' EXIT
+
+cp -r test tox.ini "$AUTOPKGTEST_TMP"
+chown -R nobody:nogroup "$AUTOPKGTEST_TMP"
+
+### Run tests
+
+for py in $(pyversions -r 2>/dev/null) $(py3versions -r 2>/dev/null); do
+ cd "$AUTOPKGTEST_TMP"
+ echo "Testing with $py:"
+ su nobody --shell /bin/sh \
+ -c "$py -m pytest -v"
+done