[debian] Update debian packaging (closes #16133259) 3.24
authorDavid Douard <david.douard@logilab.fr>
Tue, 15 Nov 2016 10:13:47 +0100
branch3.24
changeset 11832 e8be49ecb522
parent 11831 d1fbe53885e9
child 11833 1212f0fa2d42
[debian] Update debian packaging (closes #16133259) - use dh_python, pybuild and debhelper>=9, - refactor and simplify the debian/rules, - rename binary packages (but cubicweb-ctl) to python-xxx - remove daemon handling stuff (initscripts...) from cubicweb-ctl (one should now use a standard WSGI delivery method),
MANIFEST.in
debian/changelog
debian/compat
debian/control
debian/cubicweb-common.install
debian/cubicweb-ctl.bash_completion
debian/cubicweb-ctl.cubicweb.init
debian/cubicweb-ctl.install
debian/cubicweb-ctl.logrotate
debian/cubicweb-ctl.postinst
debian/cubicweb-ctl.postrm
debian/cubicweb-dev.install
debian/cubicweb-dev.lintian-overrides
debian/cubicweb-documentation.doc-base
debian/cubicweb-documentation.install
debian/cubicweb-server.install
debian/cubicweb-server.postinst
debian/cubicweb-server.prerm
debian/cubicweb-twisted.install
debian/cubicweb-twisted.postinst
debian/cubicweb-twisted.prerm
debian/cubicweb-web.install
debian/cubicweb-web.lintian-overrides
debian/pydist-overrides
debian/python-cubicweb-common.install
debian/python-cubicweb-dev.install
debian/python-cubicweb-dev.lintian-overrides
debian/python-cubicweb-documentation.doc-base
debian/python-cubicweb-documentation.docs
debian/python-cubicweb-server.install
debian/python-cubicweb-twisted.install
debian/python-cubicweb-web.install
debian/python-cubicweb-web.lintian-overrides
debian/rules
extras/cubicweb-ctl.bash_completion
--- a/MANIFEST.in	Thu Nov 17 16:03:02 2016 +0100
+++ b/MANIFEST.in	Tue Nov 15 10:13:47 2016 +0100
@@ -9,6 +9,7 @@
 
 include bin/cubicweb-*
 include man/cubicweb-ctl.1
+recursive-include extras *.bash_completion
 
 include doc/*.rst
 include doc/*.txt
--- a/debian/changelog	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/changelog	Tue Nov 15 10:13:47 2016 +0100
@@ -1,3 +1,20 @@
+cubicweb (3.24.1-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+  * Rename binary packages to python-xxx (but cubicweb-ctl).
+
+  * New python-cubicweb-pyramid binary package.
+
+  * Remove cubicweb-mysql-support.
+
+  * Use dh_python and pybuild.
+
+  * Remove all daemon-related stuff from cubicweb-ctl package (since a
+    CubicWeb application should now be managed by a WSGI server).
+
+ -- David Douard <david.douard@logilab.fr>  Mon, 14 Nov 2016 17:34:06 +0100
+
 cubicweb (3.24.0-1) unstable; urgency=medium
 
   * New upstream release.
--- a/debian/compat	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/compat	Tue Nov 15 10:13:47 2016 +0100
@@ -1,1 +1,1 @@
-7
+9
--- a/debian/control	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/control	Tue Nov 15 10:13:47 2016 +0100
@@ -3,12 +3,15 @@
 Priority: optional
 Maintainer: Logilab S.A. <contact@logilab.fr>
 Uploaders: Sylvain Thenault <sylvain.thenault@logilab.fr>,
-           Adrien Di Mascio <Adrien.DiMascio@logilab.fr>,
-           Nicolas Chauvat <nicolas.chauvat@logilab.fr>
+           David Douard <david.douard@logilab.fr>,
 Build-Depends:
- debhelper (>= 7),
- python (>= 2.6),
+ debhelper (>= 9),
+ dh-python,
+ dh-systemd,
+ python-all,
+ python-setuptools,
  python-six (>= 1.4.0),
+ python-docutils,
  python-sphinx,
  python-logilab-common (>= 1.2.2),
  python-unittest2,
@@ -20,21 +23,27 @@
  python-lxml,
  python-setuptools,
  python-pyramid,
+ python-pyramid-multiauth,
  python-waitress,
-Standards-Version: 3.9.1
+ python-passlib,
+ python-wsgicors,
+ sphinx-common,
+Standards-Version: 3.9.6
 Homepage: https://www.cubicweb.org
-X-Python-Version: >= 2.6
+X-Python-Version: >= 2.7
+
 
-Package: cubicweb
+Package: python-cubicweb
 Architecture: all
+Replaces: cubicweb (<< 3.24.0-1~)
+Breaks: cubicweb (<< 3.24.0-1~)
+Provides: cubicweb
 Depends:
- ${misc:Depends},
- ${python:Depends},
- cubicweb-server (= ${source:Version}),
- cubicweb-twisted (= ${source:Version})
+ cubicweb-ctl (= ${source:Version}),
+ python-cubicweb-server (= ${source:Version}),
+ python-cubicweb-pyramid (= ${source:Version}),
 Recommends:
- postgresql
- | mysql
+ python-cubicweb-postgresql-support (= ${source:Version})
  | sqlite3
 Description: the complete CubicWeb framework
  CubicWeb is a semantic web application framework.
@@ -43,26 +52,27 @@
  single machine. You can also deploy cubicweb by running the different process
  on different computers, in which case you need to install the corresponding
  packages on the different hosts.
+  
 
-Package: cubicweb-server
+Package: python-cubicweb-server
 Architecture: all
 Conflicts:
- cubicweb-multisources
-Replaces: cubicweb-multisources
-Provides: cubicweb-multisources
+ cubicweb-multisources,
+Replaces: cubicweb-server (<< 3.24.0-1~)
+Breaks: cubicweb-server (<< 3.24.0-1~)
+Provides: cubicweb-server
 Depends:
  ${misc:Depends},
  ${python:Depends},
- cubicweb-common (= ${source:Version}),
  cubicweb-ctl (= ${source:Version}),
+ python-cubicweb-common (= ${source:Version}),
+ python-cubicweb-postgresql-support
+ | python-pysqlite2,
  python-logilab-database (>= 1.15.0),
- cubicweb-postgresql-support
- | cubicweb-mysql-support
- | python-pysqlite2,
  python-passlib,
  python-tz,
 Recommends:
- cubicweb-documentation (= ${source:Version}),
+ python-cubicweb-documentation (= ${source:Version}),
 Suggests:
  python-zmq,
  python-cwclientlib (>= 0.4.0),
@@ -74,9 +84,13 @@
  This package provides the repository server part of the library and
  necessary shared data files such as the schema library.
 
-Package: cubicweb-postgresql-support
+
+Package: python-cubicweb-postgresql-support
 Architecture: all
 # postgresql-client packages for backup/restore of non local database
+Replaces: cubicweb-postgresql-support (<< 3.24.0-1~)
+Breaks: cubicweb-postgresql-support (<< 3.24.0-1~)
+Provides: cubicweb-postgresql-support
 Depends:
  ${misc:Depends},
  ${python:Depends},
@@ -88,32 +102,22 @@
  This virtual package provides dependencies to use postgres for the
  cubicweb repository.
 
-Package: cubicweb-mysql-support
+
+Package: python-cubicweb-twisted
 Architecture: all
-# mysql-client packages for backup/restore of non local database
+Replaces: cubicweb-twisted (<< 3.24.0-1~)
+Breaks: cubicweb-twisted (<< 3.24.0-1~)
+Provides:
+ cubicweb-server,
+ cubicweb-web-frontend,
 Depends:
  ${misc:Depends},
  ${python:Depends},
- python-mysqldb,
- mysql-client
-Description: mysql support for the CubicWeb framework
- CubicWeb is a semantic web application framework.
- .
- This virtual package provides dependencies to use mysql for the
- cubicweb repository.
-
-
-Package: cubicweb-twisted
-Architecture: all
-Provides: cubicweb-web-frontend
-Depends:
- ${misc:Depends},
- ${python:Depends},
- cubicweb-web (= ${source:Version}),
  cubicweb-ctl (= ${source:Version}),
+ python-cubicweb-web (= ${source:Version}),
  python-twisted-web (<< 16.0.0),
 Recommends:
- cubicweb-documentation (= ${source:Version})
+ python-cubicweb-documentation (= ${source:Version})
 Description: twisted-based web interface for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
@@ -123,13 +127,13 @@
  This package provides only the twisted server part of the library.
 
 
-Package: cubicweb-pyramid
+Package: python-cubicweb-pyramid
 Architecture: all
 Depends:
  ${misc:Depends},
  ${python:Depends},
- cubicweb-web (= ${source:Version}),
  cubicweb-ctl (= ${source:Version}),
+ python-cubicweb-web (= ${source:Version}),
  python-pyramid (>= 1.5.0),
  python-pyramid-multiauth,
  python-waitress (>= 0.8.9),
@@ -147,12 +151,19 @@
  It prefigures what CubicWeb 4.0 will be.
 
 
-Package: cubicweb-web
+Package: python-cubicweb-web
 Architecture: all
+Provides: cubicweb-web
+Replaces: cubicweb-web (<< 3.24.0-1~)
+Breaks:
+ cubicweb-inlinedit (<< 1.1.1),
+ cubicweb-bootstrap (<< 0.6.6),
+ cubicweb-folder (<< 1.10.0),
+ cubicweb-web (<< 3.24.0-1~),
 Depends:
  ${misc:Depends},
  ${python:Depends},
- cubicweb-common (= ${source:Version}),
+ python-cubicweb-common (= ${source:Version}),
 Recommends:
  python-docutils (>= 0.6),
  python-vobject,
@@ -161,10 +172,6 @@
  python-imaging,
  python-rdflib,
  python-werkzeug,
-Breaks:
- cubicweb-inlinedit (<< 1.1.1),
- cubicweb-bootstrap (<< 0.6.6),
- cubicweb-folder (<< 1.10.0),
 Description: web interface library for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
@@ -176,7 +183,7 @@
  necessary shared data files such as defaut views, images...
 
 
-Package: cubicweb-common
+Package: python-cubicweb-common
 Architecture: all
 Depends:
  ${misc:Depends},
@@ -194,7 +201,10 @@
  python-simpletal (>= 4.0),
  python-crypto
 Conflicts: cubicweb-core
-Replaces: cubicweb-core
+Provides: cubicweb-common
+Replaces:
+ cubicweb-core,
+ cubicweb-common (<< 3.24.0-1~),
 Breaks:
  cubicweb-comment (<< 1.9.1),
  cubicweb-person (<< 1.8.0),
@@ -205,6 +215,7 @@
  cubicweb-registration (<< 0.4.3),
  cubicweb-vcsfile (<< 1.15.0),
  cubicweb-bootstrap (<< 0.6),
+ cubicweb-common (<< 3.24.0-1~),
 Description: common library for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
@@ -217,7 +228,7 @@
 Depends:
  ${misc:Depends},
  ${python:Depends},
- cubicweb-common (= ${source:Version})
+ python-cubicweb-common (= ${source:Version})
 Description: tool to manage the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
@@ -226,14 +237,17 @@
  to automatically start and stop CubicWeb applications on boot or shutdown.
 
 
-Package: cubicweb-dev
+Package: python-cubicweb-dev
 Architecture: all
+Replaces: cubicweb-dev (<< 3.24.0-1~)
+Breaks: cubicweb-dev (<< 3.24.0-1~)
+Provides: cubicweb-dev
 Depends:
  ${misc:Depends},
  ${python:Depends},
- cubicweb-server (= ${source:Version}),
- cubicweb-web (= ${source:Version}),
- cubicweb-twisted (= ${source:Version}),
+ python-cubicweb-server (= ${source:Version}),
+ python-cubicweb-web (= ${source:Version}),
+ python-cubicweb-pyramid (= ${source:Version}),
  python-unittest2 (>= 0.7.0),
  python-pysqlite2
 Suggests:
@@ -246,13 +260,102 @@
  helping in the creation of application.
 
 
-Package: cubicweb-documentation
+Package: python-cubicweb-documentation
 Architecture: all
+Section: doc
+Replaces: cubicweb-documentation (<< 3.24.0-1~)
+Breaks: cubicweb-documentation (<< 3.24.0-1~)
+Provides: cubicweb-documentation
 Depends:
  ${misc:Depends},
+ ${sphinxdoc:Depends},
 Recommends:
  doc-base
 Description: documentation for the CubicWeb framework
  CubicWeb is a semantic web application framework.
  .
  This package provides the system's documentation.
+
+
+# Transitional packages after renaming of (most) binary packages
+
+Package: cubicweb
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-server
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-server, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-postgresql-support
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-postgresql-support, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-twisted
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-twisted, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-web
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-web, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-common
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-common, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-dev
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-dev, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
+Package: cubicweb-documentation
+Architecture: all
+Priority: extra
+Section: oldlibs
+Depends:
+ python-cubicweb-documentation, ${misc:Depends}
+Description: transitional package
+  This is a transitional package. It can safely be removed.
+
+
--- a/debian/cubicweb-common.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-usr/lib/python2*/*-packages/cubicweb/entities/
-usr/lib/python2*/*-packages/cubicweb/ext/
-usr/share/cubicweb/cubes/
-usr/lib/python2*/*-packages/cubicweb/*.py
--- a/debian/cubicweb-ctl.bash_completion	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-# -*- shell-script -*-
-
-_ec_commands()
-{
-    local commands
-    commands="$("$ec" listcommands 2>/dev/null)" || commands=""
-    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur"))
-}
-
-_ec()
-{
-    local cur prev cmd cmd_index opts i
-    local ec="$1"
-
-    COMPREPLY=()
-    cur="$2"
-    prev="$3"
-
-    # searching for the command
-    # (first non-option argument that doesn't follow a global option that
-    #  receives an argument)
-    for ((i=1; $i<=$COMP_CWORD; i++)); do
-	if [[ ${COMP_WORDS[i]} != -* ]]; then
-	    cmd="${COMP_WORDS[i]}"
-	    cmd_index=$i
-	    break
-	fi
-    done
-
-    if [[ "$cur" == -* ]]; then
-        if [ -z "$cmd" ]; then
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '--help' -- "$cur"))
-	else
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || commands=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options' -- "$cur"))
-	fi
-	return
-    fi
-
-    if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then
-	_ec_commands
-	return
-    fi
-
-    # try to generate completion candidates for whatever command the user typed
-    if _ec_command_specific; then
-	return
-    fi
-}
-
-_ec_command_specific()
-{
-    if [ "$(type -t "_ec_cmd_$cmd")" = function ]; then
-	"_ec_cmd_$cmd"
-	return 0
-    fi
-
-    case "$cmd" in
-	client)
-	    if [ "$prev" == "-b" ] || [ "$prev" == "--batch" ]; then
-		COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
-		return
-	    fi
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
-	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
-	;;
-	db-dump)
-	    if [ "$prev" == "-o" ] || [ "$prev" == "--output" ]; then
-		COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
-		return
-	    fi
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
-	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
-	;;
-	# commands with template as argument
- 	i18ncube)
-	    cubes="$("$ec" listcubes 2>/dev/null)" || cubes=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $cubes' -- "$cur"))
- 	;;
-	# generic commands with instance as argument
- 	start|stop|reload|restart|upgrade|start-repository|db-create|db-init|db-check|db-grant-user)
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
-	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
- 	;;
-	# generic commands without argument
- 	list|newtemplate|i18ncubicweb|live-server)
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
- 	;;
-	# generic commands without option
- 	shell|i18ninstance|delete|status|schema-sync)
-	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
- 	;;
-	# XXX should do better
- 	create)
-	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
- 	;;
- 	db-copy,db-restore,mboximport)
-	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
-	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
- 	;;
- 	*)
- 	    return 1
- 	;;
-    esac
-
-    return 0
-}
-
-complete -o bashdefault -o default -F _ec cubicweb-ctl 2>/dev/null \
-    || complete -o default -F _ec cubicweb-ctl
--- a/debian/cubicweb-ctl.cubicweb.init	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#!/bin/sh -e
-
-### BEGIN INIT INFO
-# Provides:          cubicweb
-# Required-Start:    $remote_fs $syslog $local_fs $network
-# Required-Stop:     $remote_fs $syslog $local_fs $network
-# Should-Start:      postgresql
-# Should-Stop:       postgresql
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start cubicweb application at boot time
-### END INIT INFO
-
-# FIXME Seems to be inadequate here
-cd /tmp
-
-# FIXME Work-around about the following lintian error
-#     E: cubicweb-ctl: init.d-script-does-not-implement-required-option /etc/init.d/cubicweb start
-#
-# Check if we are sure to not want the start-stop-daemon machinery here
-# Refer to Debian Policy Manual section 9.3.2 (Writing the scripts) for details.
-
-case $1 in
-    force-reload)
-        python -W ignore /usr/bin/cubicweb-ctl reload --force
-        ;;
-    status)
-        python -W ignore /usr/bin/cubicweb-ctl status
-        ;;
-    start|stop|restart|*)
-        python -W ignore /usr/bin/cubicweb-ctl $1 --force
-        ;;
-esac
--- a/debian/cubicweb-ctl.install	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/cubicweb-ctl.install	Tue Nov 15 10:13:47 2016 +0100
@@ -1,3 +1,2 @@
-usr/bin/cubicweb-ctl usr/bin/
 usr/lib/python2*/*-packages/cubicweb/cwctl.py
-../cubicweb-ctl.bash_completion etc/bash_completion.d/cubicweb-ctl
+usr/bin/cubicweb-ctl
--- a/debian/cubicweb-ctl.logrotate	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/var/log/cubicweb/*.log {
-        weekly
-        missingok
-        rotate 10
-        compress
-        delaycompress
-        notifempty
-        create 640 root adm
-        sharedscripts
-        postrotate
-           if [ -x /usr/sbin/invoke-rc.d ]; then \
-              invoke-rc.d cubicweb reload > /dev/null 2>&1; \
-           else \
-              /etc/init.d/cubicweb reload > /dev/null 2>&1; \
-           fi; \
-        endscript
-}
--- a/debian/cubicweb-ctl.postinst	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#! /bin/sh -e
-
-case "$1" in
-    configure|abort-upgrade|abort-remove|abort-deconfigure)
-        update-rc.d cubicweb defaults 99 >/dev/null
-    ;;
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-#DEBHELPER#
-
-exit 0
--- a/debian/cubicweb-ctl.postrm	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/cubicweb-ctl.postrm	Tue Nov 15 10:13:47 2016 +0100
@@ -1,9 +1,5 @@
 #!/bin/sh -e
 
-if [ "$1" = "remove" ]; then
-        update-rc.d cubicweb remove >/dev/null
-fi
- 
 if [ "$1" = "purge" ] ; then
         rm -rf /etc/cubicweb.d/
         rm -rf /var/log/cubicweb/
--- a/debian/cubicweb-dev.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-usr/lib/python2*/*-packages/cubicweb/devtools/
-usr/lib/python2*/*-packages/cubicweb/skeleton/
-usr/lib/python2*/*-packages/cubicweb/test
-usr/lib/python2*/*-packages/cubicweb/dataimport/test
-usr/lib/python2*/*-packages/cubicweb/entities/test
-usr/lib/python2*/*-packages/cubicweb/ext/test
-usr/lib/python2*/*-packages/cubicweb/server/test
-usr/lib/python2*/*-packages/cubicweb/sobjects/test
-usr/lib/python2*/*-packages/cubicweb/hooks/test
-usr/lib/python2*/*-packages/cubicweb/web/test
-usr/lib/python2*/*-packages/cubicweb/etwist/test
--- a/debian/cubicweb-dev.lintian-overrides	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-missing-dep-for-interpreter make => make | build-essential | dpkg-dev (usr/*/cubicweb/skeleton/debian/rules)
--- a/debian/cubicweb-documentation.doc-base	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-Document: cubicweb-doc
-Title: CubicWeb documentation
-Author: Logilab
-Abstract: Some base documentation for CubicWeb users and developpers
-Section: Apps/Programming
-
-Format: HTML
-Index: /usr/share/doc/cubicweb-documentation/html/index.html
-Files: /usr/share/doc/cubicweb-documentation/html/*
--- a/debian/cubicweb-documentation.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-../../doc/book usr/share/doc/cubicweb-documentation
-../../doc/_build/html usr/share/doc/cubicweb-documentation
--- a/debian/cubicweb-server.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-usr/lib/python2*/*-packages/cubicweb/dataimport/
-usr/lib/python2*/*-packages/cubicweb/server/
-usr/lib/python2*/*-packages/cubicweb/hooks/
-usr/lib/python2*/*-packages/cubicweb/sobjects/
-usr/lib/python2*/*-packages/cubicweb/schemas/
-usr/share/cubicweb/migration/
--- a/debian/cubicweb-server.postinst	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#! /bin/sh -e
-
-if [ -x "/etc/init.d/cubicweb-ctl" ]; then
-    invoke-rc.d cubicweb-ctl restart || true
-fi
- 
- 
-#DEBHELPER#
- 
-exit 0
--- a/debian/cubicweb-server.prerm	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#! /bin/sh -e
- 
-case "$1" in
-    remove)
-	if [ -x "/etc/init.d/cubicweb-ctl" ]; then
-	    invoke-rc.d cubicweb-ctl stop || true
-	fi
-    ;;
-esac
- 
-#DEBHELPER#
- 
-exit 0
--- a/debian/cubicweb-twisted.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-usr/lib/python2*/*-packages/cubicweb/etwist/
--- a/debian/cubicweb-twisted.postinst	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-#! /bin/sh -e
-
-if [ -x "/etc/init.d/cubicweb-ctl" ]; then
-    invoke-rc.d cubicweb-ctl restart || true
-fi
- 
- 
-#DEBHELPER#
- 
-exit 0
--- a/debian/cubicweb-twisted.prerm	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#! /bin/sh -e
- 
-case "$1" in
-    remove)
-	if [ -x "/etc/init.d/cubicweb-ctl" ]; then
-	    invoke-rc.d cubicweb-ctl stop || true
-	fi
-    ;;
-esac
- 
-#DEBHELPER#
- 
-exit 0
--- a/debian/cubicweb-web.install	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-usr/lib/python2*/*-packages/cubicweb/web
-usr/lib/python2*/*-packages/cubicweb/wsgi
-usr/share/cubicweb/cubes/shared/data
-usr/share/cubicweb/cubes/shared/wdoc
--- a/debian/cubicweb-web.lintian-overrides	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-cubicweb-web: embedded-javascript-library usr/share/cubicweb/cubes/shared/data/jquery.js
--- a/debian/pydist-overrides	Thu Nov 17 16:03:02 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-cubicweb cubicweb-common
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-common.install	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,4 @@
+usr/lib/python2*/*-packages/cubicweb/entities/
+usr/lib/python2*/*-packages/cubicweb/ext/
+usr/share/cubicweb/cubes/
+usr/lib/python2*/*-packages/cubicweb/*.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-dev.install	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,11 @@
+usr/lib/python2*/*-packages/cubicweb/devtools/
+usr/lib/python2*/*-packages/cubicweb/skeleton/
+usr/lib/python2*/*-packages/cubicweb/test
+usr/lib/python2*/*-packages/cubicweb/dataimport/test
+usr/lib/python2*/*-packages/cubicweb/entities/test
+usr/lib/python2*/*-packages/cubicweb/ext/test
+usr/lib/python2*/*-packages/cubicweb/server/test
+usr/lib/python2*/*-packages/cubicweb/sobjects/test
+usr/lib/python2*/*-packages/cubicweb/hooks/test
+usr/lib/python2*/*-packages/cubicweb/web/test
+usr/lib/python2*/*-packages/cubicweb/etwist/test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-dev.lintian-overrides	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,1 @@
+missing-dep-for-interpreter make => make | build-essential | dpkg-dev (usr/*/cubicweb/skeleton/debian/rules)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-documentation.doc-base	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,9 @@
+Document: cubicweb-doc
+Title: CubicWeb Documentation
+Author: Logilab
+Abstract: Some base documentation for CubicWeb users and developpers
+Section: Apps/Programming
+
+Format: HTML
+Index: /usr/share/doc/python-cubicweb-documentation/html/index.html
+Files: /usr/share/doc/python-cubicweb-documentation/html/*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-documentation.docs	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,2 @@
+debian/cubicweb-doc/html 
+doc/book
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-server.install	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,6 @@
+usr/lib/python2*/*-packages/cubicweb/dataimport/
+usr/lib/python2*/*-packages/cubicweb/server/
+usr/lib/python2*/*-packages/cubicweb/hooks/
+usr/lib/python2*/*-packages/cubicweb/sobjects/
+usr/lib/python2*/*-packages/cubicweb/schemas/
+usr/share/cubicweb/migration/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-twisted.install	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,1 @@
+usr/lib/python2*/*-packages/cubicweb/etwist/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-web.install	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,4 @@
+usr/lib/python2*/*-packages/cubicweb/web
+usr/lib/python2*/*-packages/cubicweb/wsgi
+usr/share/cubicweb/cubes/shared/data
+usr/share/cubicweb/cubes/shared/wdoc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debian/python-cubicweb-web.lintian-overrides	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,1 @@
+cubicweb-web: embedded-javascript-library usr/share/cubicweb/cubes/shared/data/jquery.js
--- a/debian/rules	Thu Nov 17 16:03:02 2016 +0100
+++ b/debian/rules	Tue Nov 15 10:13:47 2016 +0100
@@ -3,82 +3,25 @@
 # GNU copyright 1997 to 1999 by Joey Hess.
 
 # Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-build: build-stamp
-build-stamp:
-	dh_testdir
-	python setup.py build
-	# cubicweb.foo needs to be importable by sphinx, so create a cubicweb symlink to the source dir
-	mkdir -p debian/pythonpath
-	ln -sf $(CURDIR)/cubicweb debian/pythonpath
-	# documentation build is now made optional since it can break for old
-	# distributions and we don't want to block a new release of Cubicweb
-	# because of documentation issues.
-	-PYTHONPATH=$${PYTHONPATH:+$${PYTHONPATH}:}$(CURDIR)/debian/pythonpath $(MAKE) -C doc all
-	rm -rf debian/pythonpath
-	touch build-stamp
+# export DH_VERBOSE=1
 
-clean:
-	dh_testdir
-	rm -f build-stamp configure-stamp
-	rm -rf build
-	#rm -rf debian/cubicweb-*/
-	find . -name "*.pyc" -delete
-	-$(MAKE) -C doc clean
-	dh_clean
+export PYBUILD_NAME=cubicweb
+export PYBUILD_DISABLE_python2=test
 
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean
-	dh_installdirs
-
-	python setup.py -q install --no-compile --prefix=debian/tmp/usr
+%:
+	dh $@ --with python2,sphinxdoc --buildsystem=pybuild
 
-	# Put all the python library and data in cubicweb-common
-	# and scripts in cubicweb-server
-	dh_install -vi --sourcedir=debian/tmp
-	# cwctl in the cubicweb-ctl package
-	rm -f debian/cubicweb-common/usr/lib/python*/*/cubicweb/cwctl.py
-        # wdoc in the cubicweb-web package
-	rm -rf debian/cubicweb-common/usr/share/cubicweb/cubes/shared/wdoc
-	rm -rf debian/cubicweb-common/usr/share/cubicweb/cubes/shared/data
-	dh_lintian
-
-	# Remove unittests directory (should be available in cubicweb-dev only)
-	rm -rf debian/cubicweb-server/usr/lib/python2*/*-packages/cubicweb/dataimport/test
-	rm -rf debian/cubicweb-server/usr/lib/python2*/*-packages/cubicweb/server/test
-	rm -rf debian/cubicweb-server/usr/lib/python2*/*-packages/cubicweb/hooks/test
-	rm -rf debian/cubicweb-server/usr/lib/python2*/*-packages/cubicweb/sobjects/test
-	rm -rf debian/cubicweb-web/usr/lib/python2*/*-packages/cubicweb/web/test
-	rm -rf debian/cubicweb-twisted/usr/lib/python2*/*-packages/cubicweb/etwist/test
-	rm -rf debian/cubicweb-common/usr/lib/python2*/*-packages/cubicweb/ext/test
-	rm -rf debian/cubicweb-common/usr/lib/python2*/*-packages/cubicweb/entities/test
-	rm -rf debian/cubicweb-pyramid/usr/lib/python2*/*-packages/cubicweb/pyramid/tests
-
+override_dh_auto_build: export http_proxy=127.0.0.1:9
+override_dh_auto_build: export https_proxy=127.0.0.1:9
+override_dh_auto_build:
+	dh_auto_build
+ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
+	PYTHONPATH=. sphinx-build -N -bhtml doc/ debian/cubicweb-doc/html
+endif
 
-# Build architecture-independent files here.
-binary-indep: build install
-	dh_testdir
-	dh_testroot -i
-	dh_python2 -i
-	dh_python2 -i /usr/share/cubicweb
-	dh_installinit -i -n --name cubicweb -u"defaults 99"
-	dh_installlogrotate -i
-	dh_installdocs -i -A README
-	dh_installman -i
-	dh_installchangelogs -i -Xdoc/changes
-	dh_link -i
-	dh_compress -i -X.py -X.ini -X.xml -X.js -X.rst -X.txt -Xchangelog.html
-	dh_fixperms -i
-	dh_installdeb -i
-	dh_gencontrol  -i
-	dh_md5sums -i
-	dh_builddeb -i
+override_dh_install:
+	dh_install --sourcedir=debian/python-${PYBUILD_NAME}
 
-binary-arch:
+override_dh_installchangelogs:
+	dh_installchangelogs -Xdoc/changes
 
-binary: binary-indep
-.PHONY: build clean binary binary-indep binary-arch
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extras/cubicweb-ctl.bash_completion	Tue Nov 15 10:13:47 2016 +0100
@@ -0,0 +1,116 @@
+# -*- shell-script -*-
+
+_ec_commands()
+{
+    local commands
+    commands="$("$ec" listcommands 2>/dev/null)" || commands=""
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur"))
+}
+
+_ec()
+{
+    local cur prev cmd cmd_index opts i
+    local ec="$1"
+
+    COMPREPLY=()
+    cur="$2"
+    prev="$3"
+
+    # searching for the command
+    # (first non-option argument that doesn't follow a global option that
+    #  receives an argument)
+    for ((i=1; $i<=$COMP_CWORD; i++)); do
+	if [[ ${COMP_WORDS[i]} != -* ]]; then
+	    cmd="${COMP_WORDS[i]}"
+	    cmd_index=$i
+	    break
+	fi
+    done
+
+    if [[ "$cur" == -* ]]; then
+        if [ -z "$cmd" ]; then
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '--help' -- "$cur"))
+	else
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || commands=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options' -- "$cur"))
+	fi
+	return
+    fi
+
+    if [ -z "$cmd" ] || [ $COMP_CWORD -eq $i ]; then
+	_ec_commands
+	return
+    fi
+
+    # try to generate completion candidates for whatever command the user typed
+    if _ec_command_specific; then
+	return
+    fi
+}
+
+_ec_command_specific()
+{
+    if [ "$(type -t "_ec_cmd_$cmd")" = function ]; then
+	"_ec_cmd_$cmd"
+	return 0
+    fi
+
+    case "$cmd" in
+	client)
+	    if [ "$prev" == "-b" ] || [ "$prev" == "--batch" ]; then
+		COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
+		return
+	    fi
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
+	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+	;;
+	db-dump)
+	    if [ "$prev" == "-o" ] || [ "$prev" == "--output" ]; then
+		COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
+		return
+	    fi
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
+	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+	;;
+	# commands with template as argument
+ 	i18ncube)
+	    cubes="$("$ec" listcubes 2>/dev/null)" || cubes=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $cubes' -- "$cur"))
+ 	;;
+	# generic commands with instance as argument
+ 	start|stop|reload|restart|upgrade|start-repository|db-create|db-init|db-check|db-grant-user)
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
+	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+ 	;;
+	# generic commands without argument
+ 	list|newtemplate|i18ncubicweb|live-server)
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+ 	;;
+	# generic commands without option
+ 	shell|i18ninstance|delete|status|schema-sync)
+	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+ 	;;
+	# XXX should do better
+ 	create)
+	    options="$("$ec" listcommands "$cmd" 2>/dev/null)" || options=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+ 	;;
+ 	db-copy,db-restore,mboximport)
+	    instances="$("$ec" listinstances 2>/dev/null)" || instances=""
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$options $instances' -- "$cur"))
+ 	;;
+ 	*)
+ 	    return 1
+ 	;;
+    esac
+
+    return 0
+}
+
+complete -o bashdefault -o default -F _ec cubicweb-ctl 2>/dev/null \
+    || complete -o default -F _ec cubicweb-ctl