From 4d2684848722cb2d469ad4fa60999bf81cf7056e Mon Sep 17 00:00:00 2001 From: Paride Legovini Date: Sat, 2 May 2020 02:57:24 +0200 Subject: Adapt the package building scripts to use Python 3 (#231) Since upstream cloud-init has dropped python2 support, adapt remaining package build scripts and tools to python3 only Changes: * Do not template debian/rules as python3 is the only supported version * Drop six from requirements.txt * Makefile: drop everything related to Python 2 * run-container: install the CI deps only on ubuntu|debian * read-version: update the shebang to use Python 3 * brpm: read_dependencies(): drop unused argument * read-dependencies: switch to Py3 and drop the --python-version option * pkg-deps.json: drop the Python version field and update the redhat deps * pkg-deps.json: drop the unittest2 and contextlib2 renames * Update RPM the spec file to use Python 3 when building the RPM * bddeb: drop support for Python 2 --- packages/debian/control.in | 3 +-- packages/debian/rules | 26 ++++++++++++++++++++++++++ packages/debian/rules.in | 28 ---------------------------- 3 files changed, 27 insertions(+), 30 deletions(-) create mode 100755 packages/debian/rules delete mode 100755 packages/debian/rules.in (limited to 'packages/debian') 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 b/packages/debian/rules new file mode 100755 index 00000000..d138deeb --- /dev/null +++ b/packages/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +INIT_SYSTEM ?= systemd +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) +DEB_VERSION := $(shell dpkg-parsechangelog --show-field=Version) + +%: + dh $@ --with python3,systemd --buildsystem pybuild + +override_dh_install: + dh_install + install -d debian/cloud-init/etc/rsyslog.d + install -d debian/cloud-init/usr/share/apport/package-hooks + cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf + install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init/etc/profile.d/Z99-cloud-locale-test.sh + install -D ./tools/Z99-cloudinit-warnings.sh debian/cloud-init/etc/profile.d/Z99-cloudinit-warnings.sh + flist=$$(find $(CURDIR)/debian/ -type f -name version.py) && sed -i 's,@@PACKAGED_VERSION@@,$(DEB_VERSION),' $${flist:-did-not-find-version-py-for-replacement} + +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: + dh_systemd_start --no-restart-on-upgrade --no-start diff --git a/packages/debian/rules.in b/packages/debian/rules.in deleted file mode 100755 index e542c7f1..00000000 --- a/packages/debian/rules.in +++ /dev/null @@ -1,28 +0,0 @@ -## 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 - -override_dh_install: - dh_install - install -d debian/cloud-init/etc/rsyslog.d - install -d debian/cloud-init/usr/share/apport/package-hooks - cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf - install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init/etc/profile.d/Z99-cloud-locale-test.sh - install -D ./tools/Z99-cloudinit-warnings.sh debian/cloud-init/etc/profile.d/Z99-cloudinit-warnings.sh - flist=$$(find $(CURDIR)/debian/ -type f -name version.py) && sed -i 's,@@PACKAGED_VERSION@@,$(DEB_VERSION),' $${flist:-did-not-find-version-py-for-replacement} - -override_dh_auto_test: -ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) - http_proxy= make PYVER=python${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 -- cgit v1.2.3