From f895cb12141281702b34da18f2384deb64c881e7 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 21 Jan 2015 17:56:53 -0500 Subject: Largely merge lp:~harlowja/cloud-init/py2-3 albeit manually because it seemed to be behind trunk. `tox -e py27` passes full test suite. Now to work on replacing mocker. --- packages/bddeb | 1 + packages/brpm | 2 ++ 2 files changed, 3 insertions(+) (limited to 'packages') diff --git a/packages/bddeb b/packages/bddeb index 9d264f92..83ca68bb 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -38,6 +38,7 @@ PKG_MP = { 'pyserial': 'python-serial', 'pyyaml': 'python-yaml', 'requests': 'python-requests', + 'six': 'python-six', } DEBUILD_ARGS = ["-S", "-d"] diff --git a/packages/brpm b/packages/brpm index 9657b1dd..72bfca08 100755 --- a/packages/brpm +++ b/packages/brpm @@ -45,6 +45,7 @@ PKG_MP = { 'pyserial': 'pyserial', 'pyyaml': 'PyYAML', 'requests': 'python-requests', + 'six': 'python-six', }, 'suse': { 'argparse': 'python-argparse', @@ -56,6 +57,7 @@ PKG_MP = { 'pyserial': 'python-pyserial', 'pyyaml': 'python-yaml', 'requests': 'python-requests', + 'six': 'python-six', } } -- cgit v1.2.3 From 7e1edaa2045f6a964f111c720b2b73972746baa8 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 9 Feb 2015 12:45:05 -0500 Subject: fix copyright message --- packages/debian/copyright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/debian/copyright b/packages/debian/copyright index f55bb7a3..c694f30d 100644 --- a/packages/debian/copyright +++ b/packages/debian/copyright @@ -5,7 +5,7 @@ Source: https://launchpad.net/cloud-init This package was debianized by Soren Hansen on Thu, 04 Sep 2008 12:49:15 +0200 as ec2-init. It was later renamed to -cloud-utils by Scott Moser +cloud-init by Scott Moser Upstream Author: Scott Moser Soren Hansen -- cgit v1.2.3 From a4a6702758cf60ecb8742d78e576733dbbdbb9a0 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 10 Feb 2015 20:32:32 +0000 Subject: make bddeb work with python3 or python2 painful, and not perfect, but at this point the output builds on a vivid system python2 (bddeb --python2) or python3. * remove use of cheetah by bddeb in favor of builtin renderer * add '--python2' flag to bddeb and knowledge of python 2 and python3 package names. * read-dependencies can now read test-requirements also. * differenciate from build-requirements and runtime requirements. --- packages/bddeb | 102 ++++++++++++++++------ packages/debian/changelog.in | 2 +- packages/debian/control.in | 29 +++--- packages/debian/rules | 17 ---- packages/debian/rules.in | 19 ++++ test-requirements.txt | 3 +- tests/unittests/helpers.py | 16 ++++ tests/unittests/test_handler/test_handler_chef.py | 10 ++- tests/unittests/test_templating.py | 16 +--- tools/read-dependencies | 10 ++- 10 files changed, 140 insertions(+), 84 deletions(-) delete mode 100755 packages/debian/rules create mode 100755 packages/debian/rules.in (limited to 'packages') diff --git a/packages/bddeb b/packages/bddeb index 83ca68bb..c4efe264 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 import os import shutil @@ -27,23 +27,35 @@ import argparse # Package names that will showup in requires to what we can actually # use in our debian 'control' file, this is a translation of the 'requires' # file pypi package name to a debian/ubuntu package name. -PKG_MP = { - 'argparse': 'python-argparse', - 'cheetah': 'python-cheetah', - 'configobj': 'python-configobj', - 'jinja2': 'python-jinja2', - 'jsonpatch': 'python-jsonpatch | python-json-patch', - 'oauth': 'python-oauth', - 'prettytable': 'python-prettytable', - 'pyserial': 'python-serial', - 'pyyaml': 'python-yaml', - 'requests': 'python-requests', - 'six': 'python-six', +STD_NAMED_PACKAGES = [ + 'configobj', + 'jinja2', + 'jsonpatch', + 'oauthlib', + 'prettytable', + 'requests', + 'six', + 'httpretty', + 'mock', + 'nose', + 'setuptools', +] +NONSTD_NAMED_PACKAGES = { + 'argparse': ('python-argparse', None), + 'contextlib2': ('python-contextlib2', None), + 'cheetah': ('python-cheetah', None), + 'pyserial': ('python-serial', 'python3-serial'), + 'pyyaml': ('python-yaml', 'python3-yaml'), + 'six': ('python-six', 'python3-six'), + 'pep8': ('pep8', 'python3-pep8'), + 'pyflakes': ('pyflakes', 'pyflakes'), } + DEBUILD_ARGS = ["-S", "-d"] -def write_debian_folder(root, version, revno, append_requires=[]): +def write_debian_folder(root, version, revno, pkgmap, + pyver="3", append_requires=[]): deb_dir = util.abs_join(root, 'debian') os.makedirs(deb_dir) @@ -59,25 +71,42 @@ def write_debian_folder(root, version, revno, append_requires=[]): # Write out the control file template cmd = [util.abs_join(find_root(), 'tools', 'read-dependencies')] (stdout, _stderr) = util.subp(cmd) - pkgs = [p.lower().strip() for p in stdout.splitlines()] + pypi_pkgs = [p.lower().strip() for p in stdout.splitlines()] + + (stdout, _stderr) = util.subp(cmd + ['test-requirements.txt']) + pypi_test_pkgs = [p.lower().strip() for p in stdout.splitlines()] # Map to known packages requires = append_requires - for p in pkgs: - tgt_pkg = PKG_MP.get(p) - if not tgt_pkg: - raise RuntimeError(("Do not know how to translate pypi dependency" - " %r to a known package") % (p)) - else: - requires.append(tgt_pkg) + test_requires = [] + lists = ((pypi_pkgs, requires), (pypi_test_pkgs, test_requires)) + for pypilist, target in lists: + for p in pypilist: + if p not in pkgmap: + raise RuntimeError(("Do not know how to translate pypi " + "dependency %r to a known package") % (p)) + elif pkgmap[p]: + target.append(pkgmap[p]) + + if pyver == "3": + python = "python3" + else: + python = "python" templater.render_to_file(util.abs_join(find_root(), 'packages', 'debian', 'control.in'), util.abs_join(deb_dir, 'control'), - params={'requires': requires}) + params={'requires': ','.join(requires), + 'test_requires': ','.join(test_requires), + 'python': python}) + + templater.render_to_file(util.abs_join(find_root(), + 'packages', 'debian', 'rules.in'), + util.abs_join(deb_dir, 'rules'), + params={'python': python, 'pyver': pyver}) # Just copy the following directly - for base_fn in ['dirs', 'copyright', 'compat', 'rules']: + for base_fn in ['dirs', 'copyright', 'compat']: shutil.copy(util.abs_join(find_root(), 'packages', 'debian', base_fn), util.abs_join(deb_dir, base_fn)) @@ -91,12 +120,16 @@ def main(): " (default: %(default)s)"), default=False, action='store_true') - parser.add_argument("--no-cloud-utils", dest="no_cloud_utils", - help=("don't depend on cloud-utils package" + parser.add_argument("--cloud-utils", dest="cloud_utils", + help=("depend on cloud-utils package" " (default: %(default)s)"), default=False, action='store_true') + parser.add_argument("--python2", dest="python2", + help=("build debs for python2 rather than python3"), + default=False, action='store_true') + parser.add_argument("--init-system", dest="init_system", help=("build deb with INIT_SYSTEM=xxx" " (default: %(default)s"), @@ -123,6 +156,18 @@ def main(): if args.verbose: capture = False + pkgmap = {} + for p in NONSTD_NAMED_PACKAGES: + pkgmap[p] = NONSTD_NAMED_PACKAGES[p][int(not args.python2)] + + for p in STD_NAMED_PACKAGES: + if args.python2: + pkgmap[p] = "python-" + p + pyver = "2" + else: + pkgmap[p] = "python3-" + p + pyver = "3" + with util.tempdir() as tdir: cmd = [util.abs_join(find_root(), 'tools', 'read-version')] @@ -153,11 +198,12 @@ def main(): shutil.move(extracted_name, xdir) print("Creating a debian/ folder in %r" % (xdir)) - if not args.no_cloud_utils: + if args.cloud_utils: append_requires=['cloud-utils | cloud-guest-utils'] else: append_requires=[] - write_debian_folder(xdir, version, revno, append_requires) + write_debian_folder(xdir, version, revno, pkgmap, + pyver=pyver, append_requires=append_requires) # The naming here seems to follow some debian standard # so it will whine if it is changed... diff --git a/packages/debian/changelog.in b/packages/debian/changelog.in index e3e94f54..c9affe47 100644 --- a/packages/debian/changelog.in +++ b/packages/debian/changelog.in @@ -1,4 +1,4 @@ -## This is a cheetah template +## template:basic cloud-init (${version}~bzr${revision}-1) UNRELEASED; urgency=low * build diff --git a/packages/debian/control.in b/packages/debian/control.in index 9207e5f4..bd6e3867 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -1,4 +1,4 @@ -## This is a cheetah template +## template:basic Source: cloud-init Section: admin Priority: optional @@ -6,31 +6,22 @@ Maintainer: Scott Moser Build-Depends: debhelper (>= 9), dh-python, dh-systemd, - python (>= 2.6.6-3~), - python-nose, pyflakes, - python-setuptools, - python-selinux, - python-cheetah, - python-mocker, - python-httpretty, -#for $r in $requires - ${r}, -#end for + ${python}, + ${test_requires}, + ${requires} XS-Python-Version: all -Standards-Version: 3.9.3 +Standards-Version: 3.9.6 Package: cloud-init Architecture: all Depends: procps, - python, -#for $r in $requires - ${r}, -#end for - python-software-properties | software-properties-common, - \${misc:Depends}, + ${python}, + ${requires}, + software-properties-common, + ${misc:Depends}, Recommends: sudo -XB-Python-Version: \${python:Versions} +XB-Python-Version: ${python:Versions} Description: Init scripts for cloud instances Cloud instances need special scripts to run during initialisation to retrieve and install ssh keys and to let the user run various scripts. diff --git a/packages/debian/rules b/packages/debian/rules deleted file mode 100755 index 9e0c5ddb..00000000 --- a/packages/debian/rules +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/make -f - -INIT_SYSTEM ?= upstart,systemd -export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) - -%: - dh $@ --with python2,systemd --buildsystem pybuild - -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: - # 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 diff --git a/packages/debian/rules.in b/packages/debian/rules.in new file mode 100755 index 00000000..bb2e1d5c --- /dev/null +++ b/packages/debian/rules.in @@ -0,0 +1,19 @@ +## template:basic +#!/usr/bin/make -f + +INIT_SYSTEM ?= upstart,systemd +PYVER ?= python${pyver} +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) + +%: + dh $@ --with $(PYVER),systemd --buildsystem pybuild + +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: + # Because setup tools didn't copy data... + [ ! -d .pybuild/pythonX.Y_?.?/build/tests ] || cp -r tests/data .pybuild/pythonX.Y_?.?/build/tests + http_proxy= dh_auto_test -- --test-nose diff --git a/test-requirements.txt b/test-requirements.txt index 230f0404..9b3d07c5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ httpretty>=0.7.1 mock -mocker nose pep8==1.5.7 pyflakes +contextlib2 +setuptools diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index f92e7ac2..6b9394b3 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import os import sys import shutil @@ -275,3 +277,17 @@ def populate_dir(path, files): with open(os.path.join(path, name), "w") as fp: fp.write(content) fp.close() + +try: + skipIf = unittest.skipIf +except AttributeError: + # Python 2.6. Doesn't have to be high fidelity. + def skipIf(condition, reason): + def decorator(func): + def wrapper(*args, **kws): + if condition: + return func(*args, **kws) + else: + print(reason, file=sys.stderr) + return wrapper + return decorator diff --git a/tests/unittests/test_handler/test_handler_chef.py b/tests/unittests/test_handler/test_handler_chef.py index 8ab27911..edad88cb 100644 --- a/tests/unittests/test_handler/test_handler_chef.py +++ b/tests/unittests/test_handler/test_handler_chef.py @@ -18,6 +18,8 @@ import tempfile LOG = logging.getLogger(__name__) +CLIENT_TEMPL = os.path.sep.join(["templates", "chef_client.rb.tmpl"]) + class TestChef(t_help.FilesystemMockingTestCase): def setUp(self): @@ -41,9 +43,13 @@ class TestChef(t_help.FilesystemMockingTestCase): for d in cc_chef.CHEF_DIRS: self.assertFalse(os.path.isdir(d)) + @t_help.skipIf(not os.path.isfile(CLIENT_TEMPL), + CLIENT_TEMPL + " is not available") def test_basic_config(self): - # This should create a file of the format... """ + test basic config looks sane + + # This should create a file of the format... # Created by cloud-init v. 0.7.6 on Sat, 11 Oct 2014 23:57:21 +0000 log_level :info ssl_verify_mode :verify_none @@ -105,6 +111,8 @@ class TestChef(t_help.FilesystemMockingTestCase): 'c': 'd', }, json.loads(c)) + @t_help.skipIf(not os.path.isfile(CLIENT_TEMPL), + CLIENT_TEMPL + " is not available") def test_template_deletes(self): tpl_file = util.load_file('templates/chef_client.rb.tmpl') self.patchUtils(self.tmp) diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py index fbad405f..2b821150 100644 --- a/tests/unittests/test_templating.py +++ b/tests/unittests/test_templating.py @@ -27,20 +27,6 @@ import textwrap from cloudinit import templater -try: - skipIf = unittest.skipIf -except AttributeError: - # Python 2.6. Doesn't have to be high fidelity. - def skipIf(condition, reason): - def decorator(func): - def wrapper(*args, **kws): - if condition: - return func(*args, **kws) - else: - print(reason, file=sys.stderr) - return wrapper - return decorator - class TestTemplates(test_helpers.TestCase): def test_render_basic(self): @@ -58,7 +44,7 @@ class TestTemplates(test_helpers.TestCase): out_data = templater.basic_render(in_data, {'b': 2}) self.assertEqual(expected_data.strip(), out_data) - @skipIf(six.PY3, 'Cheetah is not compatible with Python 3') + @test_helpers.skipIf(six.PY3, 'Cheetah is not compatible with Python 3') def test_detection(self): blob = "## template:cheetah" diff --git a/tools/read-dependencies b/tools/read-dependencies index fee3efcf..6a6f3e12 100755 --- a/tools/read-dependencies +++ b/tools/read-dependencies @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +import re import sys if 'CLOUD_INIT_TOP_D' in os.environ: @@ -14,10 +15,15 @@ for fname in ("setup.py", "requirements.txt"): "exist in cloud-init root directory." % fname) sys.exit(1) -with open(os.path.join(topd, "requirements.txt"), "r") as fp: +if len(sys.argv) > 1: + reqfile = sys.argv[1] +else: + reqfile = "requirements.txt" + +with open(os.path.join(topd, reqfile), "r") as fp: for line in fp: if not line.strip() or line.startswith("#"): continue - sys.stdout.write(line) + sys.stdout.write(re.split("[>=.<]*", line)[0].strip() + "\n") sys.exit(0) -- cgit v1.2.3 From 48297d2a5d5cd41286135e6c17b37e67fc1bc40d Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 3 Mar 2015 15:54:31 -0500 Subject: packages/debian: move software-properties-common to recommends, add eatmydata --- packages/debian/control.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/debian/control.in b/packages/debian/control.in index bd6e3867..6de09f23 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -18,9 +18,8 @@ Architecture: all Depends: procps, ${python}, ${requires}, - software-properties-common, ${misc:Depends}, -Recommends: sudo +Recommends: eatmydata, sudo, software-properties-common XB-Python-Version: ${python:Versions} Description: Init scripts for cloud instances Cloud instances need special scripts to run during initialisation -- cgit v1.2.3 From 7ac709c4674e3db7ed7cc6c89765263e69d98dc0 Mon Sep 17 00:00:00 2001 From: Surojit Pathak Date: Wed, 8 Apr 2015 15:21:51 +0000 Subject: Correcting the pkg-name to 'oauthlib' from 'oauth' 'make rpm' for 'redhat' distro was failing, as the requirement for dependency was not found, otherwise. --- packages/brpm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/brpm b/packages/brpm index 72bfca08..c6d79e75 100755 --- a/packages/brpm +++ b/packages/brpm @@ -40,7 +40,7 @@ PKG_MP = { 'jinja2': 'python-jinja2', 'configobj': 'python-configobj', 'jsonpatch': 'python-jsonpatch', - 'oauth': 'python-oauth', + 'oauthlib': 'python-oauth', 'prettytable': 'python-prettytable', 'pyserial': 'pyserial', 'pyyaml': 'PyYAML', -- cgit v1.2.3 From eb2fe760f2b714f3d7a7a95cb9515d7691da9511 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 19 May 2015 05:16:46 -0700 Subject: packages/brpm: fix for oauth library name brpm was broken when change from oauth to oauthlib. --- packages/brpm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/brpm b/packages/brpm index c6d79e75..b41b675f 100755 --- a/packages/brpm +++ b/packages/brpm @@ -40,7 +40,7 @@ PKG_MP = { 'jinja2': 'python-jinja2', 'configobj': 'python-configobj', 'jsonpatch': 'python-jsonpatch', - 'oauthlib': 'python-oauth', + 'oauthlib': 'python-oauthlib', 'prettytable': 'python-prettytable', 'pyserial': 'pyserial', 'pyyaml': 'PyYAML', @@ -52,7 +52,7 @@ PKG_MP = { 'cheetah': 'python-cheetah', 'configobj': 'python-configobj', 'jsonpatch': 'python-jsonpatch', - 'oauth': 'python-oauth', + 'oauthlib': 'python-oauthlib', 'prettytable': 'python-prettytable', 'pyserial': 'python-pyserial', 'pyyaml': 'python-yaml', -- cgit v1.2.3 From 0f3736ab501ceebaa3c9f5c7543b6218637cb6c7 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 5 Jun 2015 16:26:20 -0400 Subject: packages/debian/control.in: mention recommends of gdisk some of the partitioning code in 'disk_setup' module needs sgdisk. In the future that could move to using sfdisk also but for now we do need sgdisk for this. --- packages/debian/control.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/debian/control.in b/packages/debian/control.in index 6de09f23..401a542f 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -19,7 +19,7 @@ Depends: procps, ${python}, ${requires}, ${misc:Depends}, -Recommends: eatmydata, sudo, software-properties-common +Recommends: eatmydata, sudo, software-properties-common, gdisk XB-Python-Version: ${python:Versions} Description: Init scripts for cloud instances Cloud instances need special scripts to run during initialisation -- cgit v1.2.3 From 3aeec2dd6460fbdd3b8f217ad8aa231acb4bfd45 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Tue, 21 Jul 2015 13:06:11 +0100 Subject: Add udev rules for Azure ephemeral disks. And install them in the Debian packaging. --- packages/debian/dirs | 1 + setup.py | 2 ++ udev/66-azure-ephemeral.rules | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 udev/66-azure-ephemeral.rules (limited to 'packages') diff --git a/packages/debian/dirs b/packages/debian/dirs index f3de468d..9a633c60 100644 --- a/packages/debian/dirs +++ b/packages/debian/dirs @@ -3,3 +3,4 @@ usr/bin etc/init usr/share/doc/cloud etc/cloud +lib/udev/rules.d diff --git a/setup.py b/setup.py index e88d9e88..5f61681b 100755 --- a/setup.py +++ b/setup.py @@ -84,6 +84,7 @@ INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys())) USR = "/usr" ETC = "/etc" USR_LIB_EXEC = "/usr/lib" +LIB = "/lib" if os.uname()[0] == 'FreeBSD': USR = "/usr/local" USR_LIB_EXEC = "/usr/local/lib" @@ -167,6 +168,7 @@ else: [f for f in glob('doc/examples/*') if is_f(f)]), (USR + '/share/doc/cloud-init/examples/seed', [f for f in glob('doc/examples/seed/*') if is_f(f)]), + (LIB + '/udev/rules.d', ['udev/66-azure-ephemeral.rules']), ] # Use a subclass for install that handles # adding on the right init system configuration files diff --git a/udev/66-azure-ephemeral.rules b/udev/66-azure-ephemeral.rules new file mode 100644 index 00000000..b9c5c3ef --- /dev/null +++ b/udev/66-azure-ephemeral.rules @@ -0,0 +1,18 @@ +# Azure specific rules +ACTION!="add|change", GOTO="cloud_init_end" +SUBSYSTEM!="block", GOTO="cloud_init_end" +ATTRS{ID_VENDOR}!="Msft", GOTO="cloud_init_end" +ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="cloud_init_end" + +# Root has a GUID of 0000 as the second value +# The resource/resource has GUID of 0001 as the second value +ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="azure_root", GOTO="ci_azure_names" +ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="azure_resource", GOTO="ci_azure_names" +GOTO="cloud_init_end" + +# Create the symlinks +LABEL="ci_azure_names" +ENV{DEVTYPE}=="disk", SYMLINK+="disk/cloud/$env{fabric_name}" +ENV{DEVTYPE}=="partition", SYMLINK+="disk/cloud/$env{fabric_name}-part%n" + +LABEL="cloud_init_end" -- cgit v1.2.3 From 201cc6d5505d088b2143cc881babc153c9f6d5c4 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 22 Jul 2015 13:37:21 -0400 Subject: packages/debian/control.in: add depends on iproute2 tests (specifically DataSourceOpenNebula) runs 'ip' which comes from iproute2. --- packages/debian/control.in | 1 + 1 file changed, 1 insertion(+) (limited to 'packages') diff --git a/packages/debian/control.in b/packages/debian/control.in index 401a542f..5fe16e43 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -6,6 +6,7 @@ Maintainer: Scott Moser Build-Depends: debhelper (>= 9), dh-python, dh-systemd, + iproute2, pyflakes, ${python}, ${test_requires}, -- cgit v1.2.3 From 112d25e6b2a20e8e39c1f22f6a30e0130616c64f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 3 Mar 2016 12:53:41 -0500 Subject: make package build run tests --- Makefile | 4 ++-- packages/debian/rules.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/Makefile b/Makefile index 8987d51c..a7fa5a3b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ CWD=$(shell pwd) PY_FILES=$(shell find cloudinit bin tests tools -name "*.py" -type f ) PY_FILES+="bin/cloud-init" +noseopts ?= -v YAML_FILES=$(shell find cloudinit bin tests tools -name "*.yaml" -type f ) YAML_FILES+=$(shell find doc/examples -name "cloud-config*.txt" -type f ) @@ -33,8 +34,7 @@ pip-test-requirements: $(PIP_INSTALL) -r "$@.txt" -q test: clean_pyc - @echo "Running tests..." - @nosetests $(noseopts) tests/ + @n=$$(which nosetests3) || n=nosetests; set -- $$n $(noseopts) tests/; echo "Running $$*"; "$$@" check_version: @if [ "$(CHANGELOG_VERSION)" != "$(CODE_VERSION)" ]; then \ diff --git a/packages/debian/rules.in b/packages/debian/rules.in index bb2e1d5c..d6cd23ae 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -16,4 +16,4 @@ override_dh_install: override_dh_auto_test: # Because setup tools didn't copy data... [ ! -d .pybuild/pythonX.Y_?.?/build/tests ] || cp -r tests/data .pybuild/pythonX.Y_?.?/build/tests - http_proxy= dh_auto_test -- --test-nose + http_proxy= make check -- cgit v1.2.3 From 2231c45ac3712c5cb7c1b810c838d3f91f424bf2 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 3 Mar 2016 19:10:18 -0500 Subject: packages/debian: make trunk packaging closer to ubuntu The big difference is using: ${python3:Depends} or ${python:Depends} rather than explicitly listing the dependencies (via template ${requires}). which means we get paths of /usr/lib/python3/dist-packages/.. rather than /usr/lib/python3.5/dist-packages/.. when built on xenial. Additionally it seems we no longer need this strange line. # Because setup tools didn't copy data... --- packages/debian/control.in | 2 +- packages/debian/rules.in | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/debian/control.in b/packages/debian/control.in index 5fe16e43..1c4f522c 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -18,8 +18,8 @@ Package: cloud-init Architecture: all Depends: procps, ${python}, - ${requires}, ${misc:Depends}, + ${${python}:Depends} Recommends: eatmydata, sudo, software-properties-common, gdisk XB-Python-Version: ${python:Versions} Description: Init scripts for cloud instances diff --git a/packages/debian/rules.in b/packages/debian/rules.in index d6cd23ae..66e80946 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -1,9 +1,8 @@ ## template:basic #!/usr/bin/make -f - INIT_SYSTEM ?= upstart,systemd -PYVER ?= python${pyver} export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) +PYVER ?= python${pyver} %: dh $@ --with $(PYVER),systemd --buildsystem pybuild @@ -14,6 +13,7 @@ override_dh_install: cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf override_dh_auto_test: - # Because setup tools didn't copy data... - [ ! -d .pybuild/pythonX.Y_?.?/build/tests ] || cp -r tests/data .pybuild/pythonX.Y_?.?/build/tests http_proxy= make check + +override_dh_systemd_start: + dh_systemd_start --no-restart-on-upgrade --no-start -- cgit v1.2.3 From cc92c32ea6e70de44ad0bd1e7c64f17e7fb23304 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 3 Mar 2016 22:00:14 -0500 Subject: support nocheck in building. --- packages/debian/rules.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/debian/rules.in b/packages/debian/rules.in index 66e80946..16f9b817 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -12,8 +12,13 @@ override_dh_install: install -d debian/cloud-init/etc/rsyslog.d cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: - http_proxy= make check + http_proxy= make check +endif + +override_dh_systemd_enable: + dh_systemd_enable --no-enable override_dh_systemd_start: dh_systemd_start --no-restart-on-upgrade --no-start -- cgit v1.2.3 From d1c7de36c5d5042919ea2dec6bb5bd00688f9534 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 3 Mar 2016 22:03:34 -0500 Subject: packages/bddeb: copy all files in packages/debian/ just copy all the files that are there. makes adding files easier. --- packages/bddeb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/bddeb b/packages/bddeb index c4efe264..c141b1ab 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import glob import os import shutil import sys @@ -105,11 +106,11 @@ def write_debian_folder(root, version, revno, pkgmap, util.abs_join(deb_dir, 'rules'), params={'python': python, 'pyver': pyver}) - # Just copy the following directly - for base_fn in ['dirs', 'copyright', 'compat']: - shutil.copy(util.abs_join(find_root(), - 'packages', 'debian', base_fn), - util.abs_join(deb_dir, base_fn)) + # Just copy any other files directly (including .in) + pdeb_d = util.abs_join(find_root(), 'packages', 'debian') + for f in [os.path.join(pdeb_d, f) for f in os.listdir(pdeb_d)]: + if os.path.isfile(f): + shutil.copy(f, util.abs_join(deb_dir, os.path.basename(f))) def main(): -- cgit v1.2.3 From 964aeaa9c1eac3fafa73ef9abf344613a093cb06 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Mar 2016 00:01:08 -0500 Subject: postinst/preinst: cleanup old multi-user.target enabled files also, actually enable the services. now this will have them enabled in the cloud-init.target. --- packages/debian/cloud-init.postinst | 17 +++++++++++++++++ packages/debian/cloud-init.preinst | 22 ++++++++++++++++++++++ packages/debian/rules.in | 3 --- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 packages/debian/cloud-init.postinst create mode 100644 packages/debian/cloud-init.preinst (limited to 'packages') diff --git a/packages/debian/cloud-init.postinst b/packages/debian/cloud-init.postinst new file mode 100644 index 00000000..f1222b42 --- /dev/null +++ b/packages/debian/cloud-init.postinst @@ -0,0 +1,17 @@ +#!/bin/sh +set -x +cleanup_lp1552999() { + local oldver="$1" last_bad_ver="0.7.7~bzr1178" + dpkg --compare-versions "$oldver" le "$last_bad_ver" || return 0 + local edir="/etc/systemd/system/multi-user.target.wants" + rm -f "$edir/cloud-config.service" "$edir/cloud-final.service" \ + "$edir/cloud-init-local.service" "$edir/cloud-init.service" +} + + +#DEBHELPER# + +if [ "$1" = "configure" ]; then + oldver="$2" + cleanup_lp1552999 "$oldver" +fi diff --git a/packages/debian/cloud-init.preinst b/packages/debian/cloud-init.preinst new file mode 100644 index 00000000..babaab6c --- /dev/null +++ b/packages/debian/cloud-init.preinst @@ -0,0 +1,22 @@ +#!/bin/sh +# vi: ts=4 expandtab + +set -x +cleanup_lp1552999() { + local oldver="$1" last_bad_ver="0.7.7~bzr1178" + dpkg --compare-versions "$oldver" le "$last_bad_ver" || return 0 + local hdir="/var/lib/systemd/deb-systemd-helper-enabled" + hdir="$hdir/multi-user.target.wants" + local edir="/etc/systemd/system/multi-user.target.wants" + rm -f "$hdir/cloud-config.service" "$hdir/cloud-final.service" \ + "$hdir/cloud-init-local.service" "$hdir/cloud-init.service" +} + + +if [ "$1" = "upgrade" ]; then + oldver="$2" + cleanup_lp1552999 "$oldver" +fi +set +x + +#DEBHELPER# diff --git a/packages/debian/rules.in b/packages/debian/rules.in index 16f9b817..a24720f4 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -17,8 +17,5 @@ override_dh_auto_test: http_proxy= make check endif -override_dh_systemd_enable: - dh_systemd_enable --no-enable - override_dh_systemd_start: dh_systemd_start --no-restart-on-upgrade --no-start -- cgit v1.2.3 From a782829a083c7170df62dda94d6b7441963dcb94 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Mar 2016 00:10:36 -0500 Subject: remove debug set -x --- packages/debian/cloud-init.postinst | 1 - packages/debian/cloud-init.preinst | 2 -- 2 files changed, 3 deletions(-) (limited to 'packages') diff --git a/packages/debian/cloud-init.postinst b/packages/debian/cloud-init.postinst index f1222b42..cdd0466d 100644 --- a/packages/debian/cloud-init.postinst +++ b/packages/debian/cloud-init.postinst @@ -1,5 +1,4 @@ #!/bin/sh -set -x cleanup_lp1552999() { local oldver="$1" last_bad_ver="0.7.7~bzr1178" dpkg --compare-versions "$oldver" le "$last_bad_ver" || return 0 diff --git a/packages/debian/cloud-init.preinst b/packages/debian/cloud-init.preinst index babaab6c..3c2af06d 100644 --- a/packages/debian/cloud-init.preinst +++ b/packages/debian/cloud-init.preinst @@ -1,7 +1,6 @@ #!/bin/sh # vi: ts=4 expandtab -set -x cleanup_lp1552999() { local oldver="$1" last_bad_ver="0.7.7~bzr1178" dpkg --compare-versions "$oldver" le "$last_bad_ver" || return 0 @@ -17,6 +16,5 @@ if [ "$1" = "upgrade" ]; then oldver="$2" cleanup_lp1552999 "$oldver" fi -set +x #DEBHELPER# -- cgit v1.2.3 From ea5ffb88f2d3b5f55699955520012596de1d8af5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Mar 2016 00:18:51 -0500 Subject: fix tab in rules --- packages/debian/rules.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/debian/rules.in b/packages/debian/rules.in index a24720f4..988b5bc7 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -14,7 +14,7 @@ override_dh_install: ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: - http_proxy= make check + http_proxy= make check endif override_dh_systemd_start: -- cgit v1.2.3 From 9b0cbf54a90d2434e2a93e34664646ee8638fc97 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 4 Mar 2016 00:34:37 -0500 Subject: fix packages/debian/rules.in --- packages/debian/rules.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/debian/rules.in b/packages/debian/rules.in index 988b5bc7..5420949c 100755 --- a/packages/debian/rules.in +++ b/packages/debian/rules.in @@ -12,9 +12,11 @@ override_dh_install: install -d debian/cloud-init/etc/rsyslog.d cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf -ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) override_dh_auto_test: +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) http_proxy= make check +else + @echo check disabled by DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS) endif override_dh_systemd_start: -- cgit v1.2.3