summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/bddeb37
-rwxr-xr-xpackages/brpm25
-rw-r--r--packages/debian/control.in3
-rwxr-xr-xpackages/debian/rules (renamed from packages/debian/rules.in)6
-rw-r--r--packages/pkg-deps.json58
-rw-r--r--packages/redhat/cloud-init.spec.in10
6 files changed, 52 insertions, 87 deletions
diff --git a/packages/bddeb b/packages/bddeb
index 209765a5..b0f219b6 100755
--- a/packages/bddeb
+++ b/packages/bddeb
@@ -24,6 +24,7 @@ def find_root():
if "avoid-pep8-E402-import-not-top-of-file":
# Use the util functions from cloudinit
sys.path.insert(0, find_root())
+ from cloudinit import subp
from cloudinit import util
from cloudinit import temp_utils
from cloudinit import templater
@@ -53,27 +54,21 @@ def run_helper(helper, args=None, strip=True):
if args is None:
args = []
cmd = [util.abs_join(find_root(), 'tools', helper)] + args
- (stdout, _stderr) = util.subp(cmd)
+ (stdout, _stderr) = subp.subp(cmd)
if strip:
stdout = stdout.strip()
return stdout
-def write_debian_folder(root, templ_data, is_python2, cloud_util_deps):
+def write_debian_folder(root, templ_data, cloud_util_deps):
"""Create a debian package directory with all rendered template files."""
print("Creating a debian/ folder in %r" % (root))
- if is_python2:
- pyver = "2"
- python = "python"
- else:
- pyver = "3"
- python = "python3"
deb_dir = util.abs_join(root, 'debian')
# Just copy debian/ dir and then update files
pdeb_d = util.abs_join(find_root(), 'packages', 'debian')
- util.subp(['cp', '-a', pdeb_d, deb_dir])
+ subp.subp(['cp', '-a', pdeb_d, deb_dir])
# Fill in the change log template
templater.render_to_file(util.abs_join(find_root(),
@@ -83,30 +78,25 @@ def write_debian_folder(root, templ_data, is_python2, cloud_util_deps):
# Write out the control file template
reqs_output = run_helper(
- 'read-dependencies',
- args=['--distro', 'debian', '--python-version', pyver])
+ 'read-dependencies', args=['--distro', 'debian'])
reqs = reqs_output.splitlines()
test_reqs = run_helper(
'read-dependencies',
['--requirements-file', 'test-requirements.txt',
- '--system-pkg-names', '--python-version', pyver]).splitlines()
+ '--system-pkg-names']).splitlines()
requires = ['cloud-utils | cloud-guest-utils'] if cloud_util_deps else []
# We consolidate all deps as Build-Depends as our package build runs all
# tests so we need all runtime dependencies anyway.
# NOTE: python package was moved to the front after debuild -S would fail with
# 'Please add apropriate interpreter' errors (as in debian bug 861132)
- requires.extend([python] + reqs + test_reqs)
+ requires.extend(['python3'] + reqs + test_reqs)
+ if templ_data['debian_release'] == 'xenial':
+ requires.append('python3-pytest-catchlog')
templater.render_to_file(util.abs_join(find_root(),
'packages', 'debian', 'control.in'),
util.abs_join(deb_dir, 'control'),
- params={'build_depends': ','.join(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})
+ params={'build_depends': ','.join(requires)})
def read_version():
@@ -203,13 +193,12 @@ def main():
print("Extracting temporary tarball %r" % (tarball))
cmd = ['tar', '-xvzf', tarball_fp, '-C', tdir]
- util.subp(cmd, capture=capture)
+ subp.subp(cmd, capture=capture)
xdir = util.abs_join(tdir, "cloud-init-%s" % ver_data['version_long'])
templ_data.update(ver_data)
- write_debian_folder(xdir, templ_data, is_python2=args.python2,
- cloud_util_deps=args.cloud_utils)
+ write_debian_folder(xdir, templ_data, cloud_util_deps=args.cloud_utils)
print("Running 'debuild %s' in %r" % (' '.join(args.debuild_args),
xdir))
@@ -217,7 +206,7 @@ def main():
cmd = ['debuild', '--preserve-envvar', 'INIT_SYSTEM']
if args.debuild_args:
cmd.extend(args.debuild_args)
- util.subp(cmd, capture=capture)
+ subp.subp(cmd, capture=capture)
link_fn = os.path.join(os.getcwd(), 'cloud-init_all.deb')
link_dsc = os.path.join(os.getcwd(), 'cloud-init.dsc')
diff --git a/packages/brpm b/packages/brpm
index 4004fd0e..a9fd0b70 100755
--- a/packages/brpm
+++ b/packages/brpm
@@ -24,6 +24,7 @@ def find_root():
if "avoid-pep8-E402-import-not-top-of-file":
# Use the util functions from cloudinit
sys.path.insert(0, find_root())
+ from cloudinit import subp
from cloudinit import templater
from cloudinit import util
@@ -36,24 +37,28 @@ def run_helper(helper, args=None, strip=True):
if args is None:
args = []
cmd = [util.abs_join(find_root(), 'tools', helper)] + args
- (stdout, _stderr) = util.subp(cmd)
+ (stdout, _stderr) = subp.subp(cmd)
if strip:
stdout = stdout.strip()
return stdout
-def read_dependencies(distro, requirements_file='requirements.txt'):
+def read_dependencies(distro):
"""Returns the Python package depedencies from requirements.txt files.
- @returns a tuple of (requirements, test_requirements)
+ @returns a tuple of (build_deps, run_deps, test_deps)
"""
- pkg_deps = run_helper(
- 'read-dependencies', args=['--distro', distro]).splitlines()
+ build_deps = run_helper(
+ 'read-dependencies',args=[
+ '--distro', distro, '--build-requires']).splitlines()
+ run_deps = run_helper(
+ 'read-dependencies', args=[
+ '--distro', distro, '--runtime-requires']).splitlines()
test_deps = run_helper(
'read-dependencies', args=[
'--requirements-file', 'test-requirements.txt',
'--system-pkg-names']).splitlines()
- return (pkg_deps, test_deps)
+ return (build_deps, run_deps, test_deps)
def read_version():
@@ -83,9 +88,9 @@ def generate_spec_contents(args, version_data, tmpl_fn, top_dir, arc_fn):
rpm_upstream_version = version_data['version']
subs['rpm_upstream_version'] = rpm_upstream_version
- deps, test_deps = read_dependencies(distro=args.distro)
- subs['buildrequires'] = deps + test_deps
- subs['requires'] = deps
+ build_deps, run_deps, test_deps = read_dependencies(distro=args.distro)
+ subs['buildrequires'] = build_deps + test_deps
+ subs['requires'] = run_deps
if args.boot == 'sysvinit':
subs['sysvinit'] = True
@@ -174,7 +179,7 @@ def main():
else:
cmd = ['rpmbuild', '-ba', spec_fn]
- util.subp(cmd, capture=capture)
+ subp.subp(cmd, capture=capture)
# Copy the items built to our local dir
globs = []
diff --git a/packages/debian/control.in b/packages/debian/control.in
index e9ed64f3..72895b47 100644
--- a/packages/debian/control.in
+++ b/packages/debian/control.in
@@ -10,11 +10,10 @@ Standards-Version: 3.9.6
Package: cloud-init
Architecture: all
Depends: ${misc:Depends},
- ${${python}:Depends},
+ ${python3:Depends},
iproute2,
isc-dhcp-client
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/rules.in b/packages/debian/rules
index e542c7f1..d138deeb 100755
--- a/packages/debian/rules.in
+++ b/packages/debian/rules
@@ -1,12 +1,10 @@
-## template:basic
#!/usr/bin/make -f
INIT_SYSTEM ?= systemd
export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM)
-PYVER ?= python${pyver}
DEB_VERSION := $(shell dpkg-parsechangelog --show-field=Version)
%:
- dh $@ --with $(PYVER),systemd --buildsystem pybuild
+ dh $@ --with python3,systemd --buildsystem pybuild
override_dh_install:
dh_install
@@ -19,7 +17,7 @@ override_dh_install:
override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
- http_proxy= make PYVER=python${pyver} check
+ http_proxy= make check
else
@echo check disabled by DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS)
endif
diff --git a/packages/pkg-deps.json b/packages/pkg-deps.json
index cf065219..80028396 100644
--- a/packages/pkg-deps.json
+++ b/packages/pkg-deps.json
@@ -6,52 +6,31 @@
"dh-systemd"
],
"renames" : {
- "pyyaml" : {
- "2" : "python-yaml",
- "3" : "python3-yaml"
- },
- "contextlib2" : {
- "2" : "python-contextlib2"
- },
- "pyserial" : {
- "2" : "python-serial",
- "3" : "python3-serial"
- }
+ "pyyaml" : "python3-yaml",
+ "pyserial" : "python3-serial"
},
"requires" : [
"procps"
]
},
+ "centos" : {
+ "build-requires" : [
+ "python3-devel"
+ ],
+ "requires" : [
+ "e2fsprogs",
+ "iproute",
+ "net-tools",
+ "procps",
+ "rsyslog",
+ "shadow-utils",
+ "sudo"
+ ]
+ },
"redhat" : {
"build-requires" : [
- "python-devel",
- "python-setuptools"
+ "python3-devel"
],
- "renames" : {
- "jinja2" : {
- "3" : "python36-jinja2"
- },
- "jsonschema" : {
- "3" : "python36-jsonschema"
- },
- "pyflakes" : {
- "2" : "pyflakes",
- "3" : "python36-pyflakes"
- },
- "pyyaml" : {
- "2" : "PyYAML",
- "3" : "python36-PyYAML"
- },
- "pyserial" : {
- "2" : "pyserial"
- },
- "requests" : {
- "3" : "python36-requests"
- },
- "six" : {
- "3" : "python36-six"
- }
- },
"requires" : [
"e2fsprogs",
"iproute",
@@ -64,9 +43,6 @@
},
"suse" : {
"renames" : {
- "pyyaml" : {
- "2" : "python-yaml"
- }
},
"build-requires" : [
"fdupes",
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index 057a5784..4cff2c97 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -1,6 +1,4 @@
## template: jinja
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7)
%if %{use_systemd}
@@ -94,11 +92,11 @@ ssh keys and to let the user run various scripts.
{% endfor %}
%build
-%{__python} setup.py build
+%{__python3} setup.py build
%install
-%{__python} setup.py install -O1 \
+%{__python3} setup.py install -O1 \
--skip-build --root $RPM_BUILD_ROOT \
--init-system=%{init_system}
@@ -109,7 +107,7 @@ cp -p tools/21-cloudinit.conf \
$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
# Remove the tests
-rm -rf $RPM_BUILD_ROOT%{python_sitelib}/tests
+rm -rf $RPM_BUILD_ROOT%{python3_sitelib}/tests
# Required dirs...
mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/cloud
@@ -213,4 +211,4 @@ fi
%dir %{_sharedstatedir}/cloud
# Python code is here...
-%{python_sitelib}/*
+%{python3_sitelib}/*