summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/bddeb110
-rwxr-xr-xpackages/brpm6
-rw-r--r--packages/debian/changelog.in2
-rw-r--r--packages/debian/cloud-init.postinst16
-rw-r--r--packages/debian/cloud-init.preinst20
-rw-r--r--packages/debian/control.in32
-rw-r--r--packages/debian/copyright2
-rw-r--r--packages/debian/dirs1
-rwxr-xr-xpackages/debian/rules17
-rwxr-xr-xpackages/debian/rules.in23
10 files changed, 157 insertions, 72 deletions
diff --git a/packages/bddeb b/packages/bddeb
index 9d264f92..c141b1ab 100755
--- a/packages/bddeb
+++ b/packages/bddeb
@@ -1,5 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
+import glob
import os
import shutil
import sys
@@ -27,22 +28,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',
+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)
@@ -58,28 +72,45 @@ 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']:
- 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():
@@ -90,12 +121,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"),
@@ -122,6 +157,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')]
@@ -152,11 +199,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/brpm b/packages/brpm
index 9657b1dd..b41b675f 100755
--- a/packages/brpm
+++ b/packages/brpm
@@ -40,22 +40,24 @@ PKG_MP = {
'jinja2': 'python-jinja2',
'configobj': 'python-configobj',
'jsonpatch': 'python-jsonpatch',
- 'oauth': 'python-oauth',
+ 'oauthlib': 'python-oauthlib',
'prettytable': 'python-prettytable',
'pyserial': 'pyserial',
'pyyaml': 'PyYAML',
'requests': 'python-requests',
+ 'six': 'python-six',
},
'suse': {
'argparse': 'python-argparse',
'cheetah': 'python-cheetah',
'configobj': 'python-configobj',
'jsonpatch': 'python-jsonpatch',
- 'oauth': 'python-oauth',
+ 'oauthlib': 'python-oauthlib',
'prettytable': 'python-prettytable',
'pyserial': 'python-pyserial',
'pyyaml': 'python-yaml',
'requests': 'python-requests',
+ 'six': 'python-six',
}
}
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/cloud-init.postinst b/packages/debian/cloud-init.postinst
new file mode 100644
index 00000000..cdd0466d
--- /dev/null
+++ b/packages/debian/cloud-init.postinst
@@ -0,0 +1,16 @@
+#!/bin/sh
+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..3c2af06d
--- /dev/null
+++ b/packages/debian/cloud-init.preinst
@@ -0,0 +1,20 @@
+#!/bin/sh
+# vi: ts=4 expandtab
+
+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
+
+#DEBHELPER#
diff --git a/packages/debian/control.in b/packages/debian/control.in
index 9207e5f4..16713577 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,23 @@ Maintainer: Scott Moser <smoser@ubuntu.com>
Build-Depends: debhelper (>= 9),
dh-python,
dh-systemd,
- python (>= 2.6.6-3~),
- python-nose,
+ iproute2,
+ pep8,
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},
-Recommends: sudo
-XB-Python-Version: \${python:Versions}
+ ${python},
+ ${misc:Depends},
+ ${${python}:Depends}
+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
to retrieve and install ssh keys and to let the user run various scripts.
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 <soren@ubuntu.com> on
Thu, 04 Sep 2008 12:49:15 +0200 as ec2-init. It was later renamed to
-cloud-utils by Scott Moser <scott.moser@canonical.com>
+cloud-init by Scott Moser <scott.moser@canonical.com>
Upstream Author: Scott Moser <smoser@canonical.com>
Soren Hansen <soren@canonical.com>
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/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..cf2dd405
--- /dev/null
+++ b/packages/debian/rules.in
@@ -0,0 +1,23 @@
+## template:basic
+#!/usr/bin/make -f
+INIT_SYSTEM ?= upstart,systemd
+export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM)
+PYVER ?= python${pyver}
+
+%:
+ 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:
+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+ http_proxy= make PYVER=${pyver} check
+else
+ @echo check disabled by DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS)
+endif
+
+override_dh_systemd_start:
+ dh_systemd_start --no-restart-on-upgrade --no-start