Hashar has submitted this change and it was merged.

Change subject: Package python deps with dh-virtualenv
......................................................................


Package python deps with dh-virtualenv

Require dh-virtualenv 0.9 package from upstream.

Build command of doom:

  echo USENETWORK=yes >> /root/.pbuilderrc

DEB_BUILD_OPTIONS=nocheck git-buildpackage -nc \
    --git-pbuilder \
    --git-dist="precise-wikimedia" \
    --git-pbuilder-options="--bindmount /packaging/deps/precise"

See debian/changelog for details.

Bug: T48552
Change-Id: I7eb60ed9ffbbb60140e1dcfd516db51732167ed0
---
M debian/changelog
M debian/compat
M debian/control
M debian/copyright
M debian/dirs
D debian/docs
M debian/gbp.conf
D debian/install
M debian/links
A debian/patches/0005-Replace-python-shebang-with-python2.7.patch
M debian/patches/series
M debian/postinst
D debian/postrm
A debian/prerm
M debian/rules
A debian/source/lintian-overrides
A debian/zuul-merger.default
C debian/zuul-merger.init
A debian/zuul.default
R debian/zuul.init
A debian/zuul.lintian-overrides
A debian/zuul.triggers
22 files changed, 492 insertions(+), 135 deletions(-)

Approvals:
  Hashar: Verified; Looks good to me, approved



diff --git a/debian/changelog b/debian/changelog
index b586d61..60a46d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,28 @@
+zuul (2.0.0-304-g685ca22-wmf1precise1) precise-wikimedia; urgency=low
+
+  * Snapshot from upstream, target is Wikimedia Ubuntu Precise which has some
+    updated packages for python modules packages.
+  * Adjust debian/gbp.conf to match our repository layout
+  * Bump debian/compat from 8 to 9
+  * Bump standard from 3.9.3 to 3.9.7
+
+  * Build for python 2.7 so we can get rid of the OrderDict and argparse
+    python modules which are only needed for python 2.6.
+  * Skip building sphinx doc entirely due to sphinx.programoutput not being
+    able to find the shipped commands (zuul, zuul-merger, zuul-cloner)
+  * Add dh-virtualenv to bring in additional dependencies not available in
+    Wikimedia Ubuntu Precise. Require an unreleased snapshot of dh-virtualenv
+    0.9, see:
+        https://phabricator.wikimedia.org/T91631
+        https://github.com/spotify/dh-virtualenv/issues/78
+
+  * Add init script for the zuul-merger
+  * Keep the zuul user on purge and thus delete noop debian/postrm
+  * Improve the init scripts to recognize START_DAEMON and do not start
+    daemons.
+
+ -- Antoine Musso <has...@free.fr>  Sat, 07 Mar 2015 21:00:13 +0100
+
 zuul (1.3.0-1) UNRELEASED; urgency=low
 
   * Initial release (Closes: #705844)
diff --git a/debian/compat b/debian/compat
index 45a4fb7..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-8
+9
diff --git a/debian/control b/debian/control
index d6dd685..5d0b8cd 100644
--- a/debian/control
+++ b/debian/control
@@ -1,50 +1,100 @@
 Source: zuul
 Maintainer: Paul Belanger <paul.belan...@polybeacon.com>
+Uploaders: Antoine Musso <has...@free.fr>
 Section: python
 Priority: optional
-Build-Depends: debhelper (>= 8.0.0),
+Build-Depends: debhelper (>= 9),
+ python-virtualenv (>= 1.11),
+ dh-virtualenv (>= 0.9),
  openstack-pkg-tools,
- python (>= 2.6)
-Build-Depends-Indep:
- python-extras,
- python-git (>= 0.3.2~RC1),
- python-jenkins,
- python-lockfile,
- python-nose,
- python-paramiko,
+ python2.7,
+## Following was Build-Depends-Indep
+#
+# Dependencies comes from upstream sources, they are not available under
+# Wikimedia Ubuntu Precise distribution and will be provided via dh-virtualenv.
+#
+###################################
+# requirements.txt
+###################################
+ python-pbr (>= 0.5.21),
+#Build in python 2.7:
+#python-argparse,
+ python-yaml (>= 3.1.0),
  python-paste,
- python-setuptools,
- python-sphinx (>= 1.0.7+dfsg),
- python-statsd,
- python-voluptuous (<< 0.7),
  python-webob,
- python-yaml
-Standards-Version: 3.9.3
-X-Python-Version: >= 2.6
+ python-paramiko,
+ python-git (= 0.3.2.RC1-1),
+ python-gitdb,
+ python-smmap,
+ python-lockfile (>= 0.8),
+#Build in python 2.7:
+#python-orderdict
+ python-daemon,
+ python-extras,
+#python-statsd (>= 1.0.0, <3.0)
+ python-voluptuous (>= 0.7),
+ python-gear (>= 0.5.4),
+ python-apscheduler (>= 2.1.1),
+#python-prettytable (>= 0.6),
+ python-tz,
+#python-babel (>= 1.0),
+ python-six (>= 1.6.0),
+###################################
+# test-requirements.txt
+###################################
+#python-hacking (>= 0.9.2),
+#python-coverage (>= 3.6),
+#python-sphinx (>= 1.0.7+dfsg),
+#python-sphinxcontrib.blockdiag (>= 0.5.5),  added by dh-virtualenv
+#python-discover,
+#python-fixtures (>= 0.3.14),
+#python-keystoneclient (>= 0.4.2),
+ python-subunit,
+#python-swiftclient (>= 1.6),
+#python-testrepository (>= 0.0.17),
+#python-testtools (>= 0.9.32),
+#python-sphinxcontrib.programoutput    added by dh-virtualenv
+###################################
+# Debian packaging dependencies
+###################################
+ python-nose
+Standards-Version: 3.9.6
+X-Python-Version: = 2.7
 Homepage: https://launchpad.net/zuul
 Vcs-Git: git://github.com/pabelanger/zuul-deb.git
 Vcs-Browser: https://github.com/pabelanger/zuul-deb
 
 Package: zuul
-Architecture: all
+# any since dh-virtualenv includes python
+Architecture: any
+Pre-Depends: dpkg (>= 1.16.1),
+ python2.7,
+ ${misc:Pre-Depends}
 Depends: adduser,
  libjs-jquery,
  libjs-underscore,
+ python-pbr (>= 0.5.21),
+ python-yaml (>= 3.1.0),
+ python-paste,
+ python-webob,
+ python-paramiko,
+ python-git (= 0.3.2.RC1-1),
+ python-gitdb,
+ python-smmap,
+ python-lockfile (>= 0.8),
  python-daemon,
  python-extras,
- python-git (>= 0.3.2~RC1),
- python-jenkins,
- python-lockfile,
- python-paramiko,
- python-paste,
- python-voluptuous (<< 0.7),
- python-webob,
- python-yaml,
+ python-voluptuous (>= 0.7),
+ python-gear (>= 0.5.4),
+ python-apscheduler (>= 2.1.1),
+ python-six (>= 1.6.0),
+ python-tz,
  ${misc:Depends},
- ${python:Depends}
+ ${python:Depends},
+# shlibs since dh-virtualenv includes python
+ ${shlibs:Depends}
 Suggests:
  jenkins (>= 1.426),
- python-statsd
 Description: Trunk gating system
  Zuul is a program that is used to gate the source code repository of a project
  so that changes are only merged if they pass tests.
diff --git a/debian/copyright b/debian/copyright
index aa25f45..70c22e3 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -14,8 +14,8 @@
 
 Files: debian/*
 Copyright: 2012-2013 Paul Belanger <paul.belan...@polybeacon.com>
-           2013 Antoine Musso <has...@free.fr>
-           2013 Wikimedia Foundation Inc.
+           2013-2015 Antoine Musso <has...@free.fr>
+           2013-2015 Wikimedia Foundation Inc.
 License: Apache
 
 License: Apache
diff --git a/debian/dirs b/debian/dirs
index 68f6c2a..731fe5f 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -2,3 +2,5 @@
 /var/lib/zuul
 /var/lib/zuul/git
 /var/log/zuul
+/var/run/zuul
+/var/run/zuul-merger
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 6f20e48..0000000
--- a/debian/docs
+++ /dev/null
@@ -1 +0,0 @@
-build/docs/html
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 1245b6f..3568935 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,6 +1,10 @@
 [git-buildpackage]
-export-dir = ../build-area/
-tarball-dir = ../tarballs/
-overlay = True
 pristine-tar = False
 compression = gzip
+
+ignore-branch = True
+
+# source and /debian/ are in the same tree and we have a branch per repository.
+# To avoid having to pass -git-debian-branch when checking out branches, just
+# point to HEAD which has the appropriate /debian/
+debian-branch = HEAD
diff --git a/debian/install b/debian/install
deleted file mode 100644
index dd68bd5..0000000
--- a/debian/install
+++ /dev/null
@@ -1 +0,0 @@
-debian/etc/zuul/* etc/zuul/
diff --git a/debian/links b/debian/links
index 078bdc9..8c9b27e 100644
--- a/debian/links
+++ b/debian/links
@@ -5,3 +5,8 @@
 # Overwrite underscore.js from upstream tarball with a link to 
underscore.min.js
 # provided by Underscore Debian package
 /usr/share/javascript/underscore/underscore.min.js 
usr/share/doc/zuul/html/_static/underscore.js
+
+/usr/share/python/zuul/bin/zuul usr/bin/zuul
+/usr/share/python/zuul/bin/zuul-cloner usr/bin/zuul-cloner
+/usr/share/python/zuul/bin/zuul-merger usr/bin/zuul-merger
+/usr/share/python/zuul/bin/zuul-server usr/bin/zuul-server
diff --git a/debian/patches/0005-Replace-python-shebang-with-python2.7.patch 
b/debian/patches/0005-Replace-python-shebang-with-python2.7.patch
new file mode 100644
index 0000000..120b43e
--- /dev/null
+++ b/debian/patches/0005-Replace-python-shebang-with-python2.7.patch
@@ -0,0 +1,187 @@
+From: Antoine Musso <has...@free.fr>
+Date: Tue, 10 Mar 2015 12:48:13 +0100
+Subject: Replace python shebang with python2.7
+
+The Precise package is only meant for python2.7, get rid of some lintian
+errors by pointing to python2.7.
+
+Change-Id: I68b805d0e1b49971063ed98ccc187f4456f9501d
+---
+ setup.py                      | 2 +-
+ tests/base.py                 | 2 +-
+ tests/test_cloner.py          | 2 +-
+ tests/test_layoutvalidator.py | 2 +-
+ tests/test_merger_repo.py     | 2 +-
+ tests/test_requirements.py    | 2 +-
+ tests/test_scheduler.py       | 2 +-
+ tests/test_webapp.py          | 2 +-
+ tests/test_zuultrigger.py     | 2 +-
+ tools/trigger-job.py          | 2 +-
+ tools/zuul-changes.py         | 2 +-
+ zuul/cmd/__init__.py          | 2 +-
+ zuul/cmd/client.py            | 2 +-
+ zuul/cmd/cloner.py            | 2 +-
+ zuul/cmd/merger.py            | 2 +-
+ zuul/cmd/server.py            | 2 +-
+ 16 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 70c2b3f..4ec20a6 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+diff --git a/tests/base.py b/tests/base.py
+index 46c7087..79b6c76 100755
+--- a/tests/base.py
++++ b/tests/base.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ #
+diff --git a/tests/test_cloner.py b/tests/test_cloner.py
+index ab2683d..b0e2784 100644
+--- a/tests/test_cloner.py
++++ b/tests/test_cloner.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2014 Wikimedia Foundation Inc.
+diff --git a/tests/test_layoutvalidator.py b/tests/test_layoutvalidator.py
+index 5a8fc46..60824d3 100644
+--- a/tests/test_layoutvalidator.py
++++ b/tests/test_layoutvalidator.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2013 OpenStack Foundation
+ #
+diff --git a/tests/test_merger_repo.py b/tests/test_merger_repo.py
+index 0cc53bd..b25b505 100644
+--- a/tests/test_merger_repo.py
++++ b/tests/test_merger_repo.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2014 Wikimedia Foundation Inc.
+diff --git a/tests/test_requirements.py b/tests/test_requirements.py
+index 120e37e..7e56cd1 100644
+--- a/tests/test_requirements.py
++++ b/tests/test_requirements.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
+ #
+diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
+index e3c98ed..82312f8 100755
+--- a/tests/test_scheduler.py
++++ b/tests/test_scheduler.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ #
+diff --git a/tests/test_webapp.py b/tests/test_webapp.py
+index b127c51..8a88261 100644
+--- a/tests/test_webapp.py
++++ b/tests/test_webapp.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2014 Hewlett-Packard Development Company, L.P.
+ # Copyright 2014 Rackspace Australia
+diff --git a/tests/test_zuultrigger.py b/tests/test_zuultrigger.py
+index 9a90a98..22d8076 100644
+--- a/tests/test_zuultrigger.py
++++ b/tests/test_zuultrigger.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ 
+ # Copyright 2014 Hewlett-Packard Development Company, L.P.
+ #
+diff --git a/tools/trigger-job.py b/tools/trigger-job.py
+index dff4e3f..4651d7d 100755
+--- a/tools/trigger-job.py
++++ b/tools/trigger-job.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2013 OpenStack Foundation
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
+diff --git a/tools/zuul-changes.py b/tools/zuul-changes.py
+index 7fc541b..a963b10 100755
+--- a/tools/zuul-changes.py
++++ b/tools/zuul-changes.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2013 OpenStack Foundation
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
+diff --git a/zuul/cmd/__init__.py b/zuul/cmd/__init__.py
+index d754815..a0bf1ad 100644
+--- a/zuul/cmd/__init__.py
++++ b/zuul/cmd/__init__.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2013 OpenStack Foundation
+ #
+diff --git a/zuul/cmd/client.py b/zuul/cmd/client.py
+index 766a4ef..00e529d 100644
+--- a/zuul/cmd/client.py
++++ b/zuul/cmd/client.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2013 OpenStack Foundation
+ #
+diff --git a/zuul/cmd/cloner.py b/zuul/cmd/cloner.py
+index 8922161..d94df97 100755
+--- a/zuul/cmd/cloner.py
++++ b/zuul/cmd/cloner.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ #
+ # Copyright 2014 Antoine "hashar" Musso
+ # Copyright 2014 Wikimedia Foundation Inc.
+diff --git a/zuul/cmd/merger.py b/zuul/cmd/merger.py
+index dc3484a..6007368 100644
+--- a/zuul/cmd/merger.py
++++ b/zuul/cmd/merger.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2013-2014 OpenStack Foundation
+ #
+diff --git a/zuul/cmd/server.py b/zuul/cmd/server.py
+index 25dab6f..db27b18 100755
+--- a/zuul/cmd/server.py
++++ b/zuul/cmd/server.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2.7
+ # Copyright 2012 Hewlett-Packard Development Company, L.P.
+ # Copyright 2013 OpenStack Foundation
+ #
diff --git a/debian/patches/series b/debian/patches/series
index 7dfca9d..8cbe3e8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 0002-Merger-ensure_cloned-now-looks-for-.git.patch
 0003-Update-merge-status-after-merge-merge-is-submitted.patch
 0004-Ensure-the-repository-configuration-lock-is-released.patch
+0005-Replace-python-shebang-with-python2.7.patch
diff --git a/debian/postinst b/debian/postinst
index e4fd1bc..6b02c01 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -29,15 +29,25 @@
                                --gecos "Zuul trunk gating daemon" \
                                zuul
                fi
-               chown -R zuul:zuul /etc/zuul
-               chown -R zuul:zuul /var/lib/zuul
-               chown -R zuul:adm /var/log/zuul
 
-               chmod 0640 -R /etc/zuul/*
+               chown zuul:zuul /etc/zuul
+               chown zuul:zuul /var/lib/zuul
+               chown zuul:adm /var/log/zuul
 
-               chmod 0750 /etc/zuul
-               chmod 0750 /var/lib/zuul
-               chmod 0750 /var/log/zuul
+               chmod 0755 /etc/zuul
+               chmod 0755 /var/lib/zuul
+               chmod 0755 /var/log/zuul
+
+               # compile the installed modules, not the whole hierarchy since 
there
+               # are symlink back to python2.7 built in modules
+               pycompile --package='zuul' 
/usr/share/python/zuul/lib/python2.7/site-packages
+
+               # Populate python2.7 in Zuul virtualenv
+               # Make sure it is properly up-to-date even if the trigger is 
supposed
+               # to take care of it.
+               if ! cmp -s /usr/bin/python2.7 
/usr/share/python/zuul/bin/python2.7; then
+                       cp -a /usr/bin/python2.7 /usr/share/python/zuul/bin
+               fi
        ;;
 
        abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/postrm b/debian/postrm
deleted file mode 100644
index 2ac4fcc..0000000
--- a/debian/postrm
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# postrm script for #PACKAGE#
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <overwriter>
-#          <overwriter-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-       purge)
-               userdel -r zuul 2>/dev/null || true
-       ;;
-       remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-       ;;
-
-       *)
-               echo "postrm called with unknown argument \`$1'" >&2
-               exit 1
-       ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 0000000..8bb26b3
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,46 @@
+#!/bin/sh
+# prerm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+               # clean the installed modules, not the whole hierarchy since 
there
+               # are symlink back to python2.7 built in modules
+               pyclean --package='zuul' 
/usr/share/python/zuul/lib/python2.7/site-packages
+
+               # Left over by dh-virtualenv trigger
+               if [ -e /usr/share/python/zuul/bin/python2.7,orig ]; then
+                       rm /usr/share/python/zuul/bin/python2.7,orig
+               fi
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
index d7c9807..a1fc9e9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,30 +1,45 @@
 #!/usr/bin/make -f
 
 # Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+export DH_VERBOSE=1
 
 UPSTREAM_GIT = git://github.com/openstack-infra/zuul.git
 
 include /usr/share/openstack-pkg-tools/pkgos.make
 
-export OSLO_PACKAGE_VERSION=$(VERSION)
+# Make pbr to use the version from the Debian changelog
+export OSLO_PACKAGE_VERSION=$(DEBVERS)
 
 %:
-       dh $@ --with python2,sphinxdoc
+       dh $@ --with python-virtualenv
 
 override_dh_auto_build:
        dh_auto_build
-       $(MAKE) -C doc html man BUILDDIR=$(CURDIR)/build/docs
+       # Ubuntu Precise is missing blockdiag/pillow. Skip doc
+       #PYTHONPATH=. http_proxy='.' https_proxy='.' $(MAKE) -C doc html man 
BUILDDIR=$(CURDIR)/build/docs
 
 override_dh_auto_clean:
        dh_auto_clean
        rm -rf *.egg*
 
-override_dh_auto_install:
-       dh_auto_install
-       install -D -m 0644 $(CURDIR)/etc/layout.yaml-sample 
$(CURDIR)/debian/etc/zuul/layout.yaml
-       install -D -m 0644 $(CURDIR)/etc/logging.conf-sample 
$(CURDIR)/debian/etc/zuul/logging.conf
-       install -D -m 0644 $(CURDIR)/etc/zuul.conf-sample 
$(CURDIR)/debian/etc/zuul/zuul.conf
+override_dh_installinit:
+       dh_installinit --name=zuul
+       dh_installinit --name=zuul-merger
+
+override_dh_virtualenv:
+       # Needs dh_virtualenv 0.9+ for --use-system-packages
+       # The .pyc are generated in postinst
+       PIP_NO_COMPILE=1 PYTHONDONTWRITEBYTECODE=true VIRTUALENV_VERBOSE=true 
dh_virtualenv \
+               --python '/usr/bin/python2.7' \
+               --use-system-packages \
+               --no-package ordereddict \
+               --no-package paramiko \
+               --no-package WebOb \
+               --extra-pip-arg '--no-compile' \
+               --pypi-url https://pypi.python.org/simple
+       find $(CURDIR)/debian/zuul/usr/share/python/zuul -type f -name '*.pyc' 
-delete
+       # python2.7 is populated in postinst and refreshed by dh-virtualenv 
trigger
+       rm $(CURDIR)/debian/zuul/usr/share/python/zuul/bin/python2.7
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..5361481
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1,5 @@
+# dh-virtualenv is not recognized by lintian
+zuul source: python-depends-but-no-python-helper
+
+# Wikimedia distribution is 'precise-wikimedia'
+zuul source: bad-distribution-in-changes-file
diff --git a/debian/zuul-merger.default b/debian/zuul-merger.default
new file mode 100644
index 0000000..32e3fe0
--- /dev/null
+++ b/debian/zuul-merger.default
@@ -0,0 +1,7 @@
+# START_DAEMON:
+#   Set to 1 to start the zuul-merger daemon
+START_DAEMON=0
+
+# DAEMON_ARGS:
+#   Arguments passed to the Zuul merger
+#DAEMON_ARGS='-c /etc/zuul/zuul-merger.conf'
diff --git a/debian/init b/debian/zuul-merger.init
similarity index 81%
copy from debian/init
copy to debian/zuul-merger.init
index 436ac91..dad6e41 100644
--- a/debian/init
+++ b/debian/zuul-merger.init
@@ -1,11 +1,11 @@
 #! /bin/sh
 ### BEGIN INIT INFO
-# Provides:          zuul
+# Provides:          zuul-merger
 # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
-# Short-Description: Zuul
+# Short-Description: Zuul Merger
 # Description:       Trunk gating system
 ### END INIT INFO
 
@@ -13,9 +13,9 @@
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="Zuul"
-NAME=zuul
-DAEMON=/usr/bin/zuul-server
+DESC="Zuul Merger"
+NAME=zuul-merger
+DAEMON=/usr/bin/$NAME
 PIDFILE=/var/run/$NAME/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 USER=zuul
@@ -23,8 +23,8 @@
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
 
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+START_DAEMON=0
+DAEMON_ARGS=''
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -32,6 +32,17 @@
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
+
+# Read configuration variable file if it is present
+if [ -r /etc/default/$NAME ] ; then
+       . /etc/default/$NAME
+fi
+
+if ! [ "${START_DAEMON}" = "1" ] ; then
+       log_daemon_msg "$DESC: /etc/default/$NAME is not set to START_DAEMON=1: 
exiting"
+       log_end_msg 1
+       exit 0
+fi
 
 #
 # Function that starts the daemon/service
@@ -43,8 +54,9 @@
        #   1 if daemon was already running
        #   2 if daemon could not be started
 
-        mkdir -p /var/run/$NAME
+       mkdir -p /var/run/$NAME
        chown $USER /var/run/$NAME
+       ulimit -n 8192
        start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec 
$DAEMON --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec 
$DAEMON -- \
@@ -73,31 +85,6 @@
 }
 
 #
-# Function that stops the daemon/service
-#
-do_graceful_stop()
-{
-       PID=`cat $PIDFILE`
-       kill -USR1 $PID
-
-       # wait until really stopped
-       if [ -n "${PID:-}" ]; then
-               i=0
-               while kill -0 "${PID:-}" 2> /dev/null;  do
-                       if [ $i -eq '0' ]; then
-                               echo -n " ... waiting "
-                       else
-                               echo -n "."
-                       fi
-                       i=$(($i+1))
-                       sleep 1
-               done
-       fi
-
-       rm -f /var/run/$NAME/*
-}
-
-#
 # Function that sends a SIGHUP to the daemon/service
 #
 do_reload() {
@@ -106,7 +93,7 @@
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        #
-       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name 
zuul-server
+       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name 
$NAME
        return 0
 }
 
@@ -128,8 +115,8 @@
        esac
        ;;
   status)
-       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-       ;;
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
   reload|force-reload)
        #
        # If do_reload() is not implemented then leave this commented out
@@ -145,7 +132,7 @@
        # 'force-reload' alias
        #
        log_daemon_msg "Restarting $DESC" "$NAME"
-       do_graceful_stop
+       do_stop
        do_start
        ;;
   *)
diff --git a/debian/zuul.default b/debian/zuul.default
new file mode 100644
index 0000000..197fd5b
--- /dev/null
+++ b/debian/zuul.default
@@ -0,0 +1,15 @@
+# START_DAEMON:
+#   Set to 1 to start the zuul daemon
+START_DAEMON=0
+
+# STATSD_HOST:
+#   hostname or IP to send statsd packets to.
+#export STATSD_HOST=localhost
+
+# STATSD_PORT:
+#   udp port to send statsd to.
+#export STATSD_PORT=8125
+
+# DAEMON_ARGS:
+#   Arguments passed to the Zuul server
+#DAEMON_ARGS='-c /etc/zuul/zuul-server.conf'
diff --git a/debian/init b/debian/zuul.init
similarity index 89%
rename from debian/init
rename to debian/zuul.init
index 436ac91..9c96a23 100644
--- a/debian/init
+++ b/debian/zuul.init
@@ -13,7 +13,7 @@
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="Zuul"
+DESC="Zuul Server"
 NAME=zuul
 DAEMON=/usr/bin/zuul-server
 PIDFILE=/var/run/$NAME/$NAME.pid
@@ -23,8 +23,8 @@
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
 
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+START_DAEMON=0
+DAEMON_ARGS=''
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
@@ -32,6 +32,17 @@
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
+
+# Read configuration variable file if it is present
+if [ -r /etc/default/$NAME ] ; then
+       . /etc/default/$NAME
+fi
+
+if ! [ "${START_DAEMON}" = "1" ] ; then
+       log_daemon_msg "$DESC: /etc/default/$NAME is not set to START_DAEMON=1: 
exiting"
+       log_end_msg 1
+       exit 0
+fi
 
 #
 # Function that starts the daemon/service
@@ -43,7 +54,7 @@
        #   1 if daemon was already running
        #   2 if daemon could not be started
 
-        mkdir -p /var/run/$NAME
+       mkdir -p /var/run/$NAME
        chown $USER /var/run/$NAME
        start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec 
$DAEMON --test > /dev/null \
                || return 1
@@ -85,7 +96,7 @@
                i=0
                while kill -0 "${PID:-}" 2> /dev/null;  do
                        if [ $i -eq '0' ]; then
-                               echo -n " ... waiting "
+                               echo -n " ... waiting for jobs to complete "
                        else
                                echo -n "."
                        fi
@@ -128,8 +139,8 @@
        esac
        ;;
   status)
-       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-       ;;
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
   reload|force-reload)
        #
        # If do_reload() is not implemented then leave this commented out
diff --git a/debian/zuul.lintian-overrides b/debian/zuul.lintian-overrides
new file mode 100644
index 0000000..95b8a33
--- /dev/null
+++ b/debian/zuul.lintian-overrides
@@ -0,0 +1,22 @@
+# virtualenv uses the python provided by virtualenv
+# there is a trigger to update it though
+zuul binary: wrong-path-for-interpreter *
+
+# Scripts shebang are rewritten by virtualenv and point to
+# /usr/share/python/zuul/bin/python2.7 which is a copy of the system python2.7
+zuul binary: python-script-but-no-python-dep usr/share/python/zuul/bin/*
+
+# We need to keep the python2.7 binary copy to have it adjust its is sys.path
+# and be able to find modules provided by the Zuul virtualenv.
+#
+# From https://www.python.org/dev/peps/pep-0405/#copies-versus-symlinks:
+#
+# Virtualenv must copy the binary in order to provide isolation, as Python
+# dereferences a symlinked executable before searching for sys.prefix .
+zuul binary: arch-dependent-file-in-usr-share 
usr/share/python/zuul/bin/python2.7
+
+# No sphinx doc possible with Precise
+zuul binary: binary-without-manpage usr/bin/zuul
+zuul binary: binary-without-manpage usr/bin/zuul-cloner
+zuul binary: binary-without-manpage usr/bin/zuul-merger
+zuul binary: binary-without-manpage usr/bin/zuul-server
diff --git a/debian/zuul.triggers b/debian/zuul.triggers
new file mode 100644
index 0000000..643f7a2
--- /dev/null
+++ b/debian/zuul.triggers
@@ -0,0 +1,7 @@
+# Register interest in Python interpreter changes (Python 2 for now); and
+# don't make the Python package dependent on the virtualenv package
+# processing (noawait)
+interest-noawait /usr/bin/python2.7
+
+# Also provide a symbolic trigger for all dh-virtualenv packages
+interest dh-virtualenv-interpreter-update

-- 
To view, visit https://gerrit.wikimedia.org/r/195272
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7eb60ed9ffbbb60140e1dcfd516db51732167ed0
Gerrit-PatchSet: 19
Gerrit-Project: integration/zuul
Gerrit-Branch: debian/precise-wikimedia
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to