From a04baf85a8eea4eb02168429aa6bfaaeb2effb42 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 15:47:16 +0100 Subject: Modernise packaging, and allow multiple init system installation (based on smoser pastebins). --- packages/debian/compat | 2 +- packages/debian/control.in | 13 +++++++++---- packages/debian/pycompat | 1 - packages/debian/rules | 20 +++++++------------- 4 files changed, 17 insertions(+), 19 deletions(-) delete mode 100644 packages/debian/pycompat (limited to 'packages/debian') diff --git a/packages/debian/compat b/packages/debian/compat index 7ed6ff82..ec635144 100644 --- a/packages/debian/compat +++ b/packages/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/packages/debian/control.in b/packages/debian/control.in index 7e42b94b..6e383dcc 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -1,10 +1,11 @@ ## This is a cheetah template Source: cloud-init Section: admin -Priority: extra +Priority: optional Maintainer: Scott Moser -Build-Depends: cdbs, - debhelper (>= 5.0.38), +Build-Depends: debhelper (>= 9), + dh-python, + dh-systemd, python (>= 2.6.6-3~), python-nose, pyflakes, @@ -12,7 +13,11 @@ Build-Depends: cdbs, python-setuptools, python-cheetah, python-mocker, - python-setuptools + python-setuptools, + python-httpretty, +#for $r in $requires + ${r}, +#end for XS-Python-Version: all Standards-Version: 3.9.3 diff --git a/packages/debian/pycompat b/packages/debian/pycompat deleted file mode 100644 index 0cfbf088..00000000 --- a/packages/debian/pycompat +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/packages/debian/rules b/packages/debian/rules index 7623ac9d..c1344e60 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,18 +1,12 @@ #!/usr/bin/make -f DEB_PYTHON2_MODULE_PACKAGES = cloud-init -INIT_SYSTEM ?= upstart +INIT_SYSTEM ?= upstart,systemd -binary-install/cloud-init::cloud-init-fixups +%: + dh $@ --with python2,systemd --build-system pybuild -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/python-distutils.mk - -DEB_PYTHON_INSTALL_ARGS_ALL += --init-system=$(INIT_SYSTEM) - -DEB_DH_INSTALL_SOURCEDIR := debian/tmp - -cloud-init-fixups: - install -d $(DEB_DESTDIR)/etc/rsyslog.d - cp tools/21-cloudinit.conf $(DEB_DESTDIR)/etc/rsyslog.d/21-cloudinit.conf - +override_dh_install: + dh_install + install -d debian/cloud-init/etc/rsyslog.d + cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf -- cgit v1.2.3 From 6327e159f475ca4dcd97d1c6feea5f747090c41d Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 16:48:14 +0100 Subject: fix ups --- packages/debian/rules | 2 +- setup.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index c1344e60..d3409c7e 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -4,7 +4,7 @@ DEB_PYTHON2_MODULE_PACKAGES = cloud-init INIT_SYSTEM ?= upstart,systemd %: - dh $@ --with python2,systemd --build-system pybuild + dh $@ --with python2,systemd --buildsystem pybuild override_dh_install: dh_install diff --git a/setup.py b/setup.py index 1a6d0cf4..8b1e6ece 100755 --- a/setup.py +++ b/setup.py @@ -93,13 +93,13 @@ class InitsysInstallData(install): def initialize_options(self): install.initialize_options(self) - self.init_system = None + self.init_system = "" def finalize_options(self): install.finalize_options(self) - if self.init_systems and isinstance(self.init_systems, str): - self.init_systems = self.init_systems.split(",") + if self.init_system and isinstance(self.init_system, str): + self.init_system = self.init_system.split(",") if len(self.init_system) == 0: raise DistutilsArgError(("You must specify one of (%s) when" @@ -110,7 +110,7 @@ class InitsysInstallData(install): raise DistutilsArgError( "Invalid --init-system: %s" % (','.join(bad))) - for sys in self.init_systems: + for sys in self.init_system: print("adding %s: %s" % (sys, str(INITSYS_ROOTS[sys]))) self.distribution.data_files.append( (INITSYS_ROOTS[sys], INITSYS_FILES[sys])) -- cgit v1.2.3 From 3f2c36303ffbf20f58f4f9131fa3a36642420944 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 16:51:05 +0100 Subject: fix up --- packages/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index d3409c7e..2a2386af 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f -DEB_PYTHON2_MODULE_PACKAGES = cloud-init INIT_SYSTEM ?= upstart,systemd +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) %: dh $@ --with python2,systemd --buildsystem pybuild -- cgit v1.2.3 From 26467c0a45106bf12b6d4f82bb4ed1aa3e0dc686 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 16:58:14 +0100 Subject: Use tests --- packages/debian/rules | 1 + 1 file changed, 1 insertion(+) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index 2a2386af..f2516c93 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -2,6 +2,7 @@ INIT_SYSTEM ?= upstart,systemd export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) +export PYBUILD_TEST_ARGS=--test-nose %: dh $@ --with python2,systemd --buildsystem pybuild -- cgit v1.2.3 From 3cb605bf3cad72e692c154d41fb1e24b41033f2c Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:07:12 +0100 Subject: Use nosetests and absolute imports --- packages/debian/rules | 2 +- tests/unittests/test_builtin_handlers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index f2516c93..6bf78377 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -2,7 +2,7 @@ INIT_SYSTEM ?= upstart,systemd export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) -export PYBUILD_TEST_ARGS=--test-nose +export PYBUILD_TEST_NOSE=1 %: dh $@ --with python2,systemd --buildsystem pybuild diff --git a/tests/unittests/test_builtin_handlers.py b/tests/unittests/test_builtin_handlers.py index b387f13b..af7f442e 100644 --- a/tests/unittests/test_builtin_handlers.py +++ b/tests/unittests/test_builtin_handlers.py @@ -2,7 +2,7 @@ import os -from tests.unittests import helpers as test_helpers +from . import helpers as test_helpers from cloudinit import handlers from cloudinit import helpers -- cgit v1.2.3 From 3035b8d90bb8cd3b4a5a75f2014aa4ffdeb42abe Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:32:49 +0100 Subject: use override targets --- packages/debian/rules | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index 6bf78377..6c3bf526 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,8 +1,6 @@ #!/usr/bin/make -f INIT_SYSTEM ?= upstart,systemd -export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) -export PYBUILD_TEST_NOSE=1 %: dh $@ --with python2,systemd --buildsystem pybuild @@ -11,3 +9,9 @@ override_dh_install: dh_install install -d debian/cloud-init/etc/rsyslog.d cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf + +override_dh_auto_test: + http_proxy= dh_auto_test -- --test-nose + +override_dh_auto_install: + dh_auto_install -- --init-system=$(INIT_SYSTEM) -- cgit v1.2.3 From 272b8aae291b4b177fb6340aba9907e89bd0905c Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 23 Jul 2014 17:50:45 +0100 Subject: more --- packages/debian/rules | 4 +--- tests/unittests/test_datasource/test_azure.py | 2 +- tests/unittests/test_datasource/test_maas.py | 2 +- tests/unittests/test_datasource/test_nocloud.py | 2 +- tests/unittests/test_datasource/test_opennebula.py | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index 6c3bf526..3bec7267 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,6 +1,7 @@ #!/usr/bin/make -f INIT_SYSTEM ?= upstart,systemd +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) %: dh $@ --with python2,systemd --buildsystem pybuild @@ -12,6 +13,3 @@ override_dh_install: override_dh_auto_test: http_proxy= dh_auto_test -- --test-nose - -override_dh_auto_install: - dh_auto_install -- --init-system=$(INIT_SYSTEM) diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index c7c977bd..88c82d5e 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.util import load_file from cloudinit.sources import DataSourceAzure -from ...helpers import populate_dir +from ..helpers import populate_dir import base64 import crypt diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index 0b616c64..c157beb8 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -3,7 +3,7 @@ import os from cloudinit.sources import DataSourceMAAS from cloudinit import url_helper -from ...helpers import populate_dir +from ..helpers import populate_dir import mocker diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py index c106e639..14274562 100644 --- a/tests/unittests/test_datasource/test_nocloud.py +++ b/tests/unittests/test_datasource/test_nocloud.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceNoCloud from cloudinit import util -from ...helpers import populate_dir +from ..helpers import populate_dir from mocker import MockerTestCase import os diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index 287aceba..b4fd1f4d 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -2,7 +2,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceOpenNebula as ds from cloudinit import util from mocker import MockerTestCase -from ...helpers import populate_dir +from ..helpers import populate_dir from base64 import b64encode import os -- cgit v1.2.3 From 5f0b1c3ef92acc34f532188627da9eabefed272a Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 24 Jul 2014 11:40:18 +0100 Subject: Yeah, tests pass now. --- packages/debian/rules | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/debian') diff --git a/packages/debian/rules b/packages/debian/rules index 3bec7267..9e0c5ddb 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -12,4 +12,6 @@ override_dh_install: cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf override_dh_auto_test: + # Becuase setup tools didn't copy data... + cp -r tests/data .pybuild/pythonX.Y_2.7/build/tests http_proxy= dh_auto_test -- --test-nose -- cgit v1.2.3 From 97590a239dfb49d4dff216058a83852a635fd3f6 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 24 Jul 2014 08:58:45 -0400 Subject: remove duplicate entry in control.in --- packages/debian/control.in | 1 - 1 file changed, 1 deletion(-) (limited to 'packages/debian') diff --git a/packages/debian/control.in b/packages/debian/control.in index 6e383dcc..18a4600c 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -13,7 +13,6 @@ Build-Depends: debhelper (>= 9), python-setuptools, python-cheetah, python-mocker, - python-setuptools, python-httpretty, #for $r in $requires ${r}, -- cgit v1.2.3