[skeleton] Update Debian packaging template
authorJérémy Bobbio <jeremy.bobbio@irq7.fr>
Wed, 19 Jun 2019 09:51:38 +0200
changeset 12663 853e73456d0f
parent 12662 4b612e5b9d05
child 12672 2c7499bc675b
[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. * Switch to Python 3. * Name the binary package `python3-cubicweb-CUBENAME` instead of just `cubicweb-CUBENAME` (which is still the source package). * Populate Depends using dh_python3 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.
MANIFEST.in
cubicweb/skeleton/debian/changelog.tmpl
cubicweb/skeleton/debian/compat
cubicweb/skeleton/debian/control.tmpl
cubicweb/skeleton/debian/pybuild.testfiles.tmpl
cubicweb/skeleton/debian/rules
cubicweb/skeleton/debian/rules.tmpl
cubicweb/skeleton/debian/source/format
cubicweb/skeleton/debian/source/options
cubicweb/skeleton/debian/tests/control
cubicweb/skeleton/debian/tests/pytest
--- a/MANIFEST.in	Wed Jun 26 12:35:25 2019 +0200
+++ b/MANIFEST.in	Wed Jun 19 09:51:38 2019 +0200
@@ -77,6 +77,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/debian/changelog.tmpl	Wed Jun 26 12:35:25 2019 +0200
+++ b/cubicweb/skeleton/debian/changelog.tmpl	Wed Jun 19 09:51:38 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 Jun 19 09:51:38 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 Jun 19 09:51:38 2019 +0200
@@ -3,19 +3,18 @@
 Priority: optional
 Maintainer: %(author)s <%(author-email)s>
 Build-Depends:
- debhelper (>= 7),
+ debhelper (>= 9),
  dh-python,
- python (>= 2.6.5),
- python-setuptools,
-Standards-Version: 3.9.3
-X-Python-Version: >= 2.6
+ python3-all,
+ python3-setuptools,
+ python3-pytest,
+Standards-Version: 4.3.0
+X-Python3-Version: >= 3.4
 
-Package: %(distname)s
+Package: python3-%(distname)s
 Architecture: all
 Depends:
- python-cubicweb (>= %(version)s),
- python-six (>= 1.4.0),
- ${python:Depends},
+ ${python3:Depends},
  ${misc:Depends},
 Description: %(shortdesc)s
  CubicWeb is a semantic web application framework.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/pybuild.testfiles.tmpl	Wed Jun 19 09:51:38 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 Jun 19 09:51:38 2019 +0200
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+export PYBUILD_NAME = %(distname)s
+export PYBUILD_OPTION = --test-pytest
+
+%%:
+	dh $@ --with python3 --buildsystem=pybuild
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/skeleton/debian/source/format	Wed Jun 19 09:51:38 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 Jun 19 09:51:38 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 Jun 19 09:51:38 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 Jun 19 09:51:38 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 $(py3versions -r 2>/dev/null); do
+	cd "$AUTOPKGTEST_TMP"
+	echo "Testing with $py:"
+	su nobody --shell /bin/sh \
+		-c "$py -m pytest -v"
+done