vmdebootstrap does not have to use Python2. The code is able
to support Python3, it will need a little bit of testing.

I'm attaching a small set of patches for the packaging and the
generation of the documentation which allow the package to be built for
Python3. With cmdtest installed using it's Python2 support, the fast
yarn tests do at least pass. The slower build tests also work using
Python3, with a small change to look for 10 instead of 8
in /etc/debian_version of a stable test image.

The remaining issues are:

* The original upstream would prefer users to switch to vmdb2 but that
  is not a drop-in replacement.
* vmdebootstrap autopkgtests use cmdtest which is Python2 only but
  those could be dropped from the packaging.
* vmdebootstrap has reverse dependencies (live-wrapper) which are used
  in the creation of Debian Live images alongside the release process.
* vmdebootstrap, live-wrapper and the Debian live process all need
  ongoing maintenance.
* the slower build tests need updating for interim Debian releases
  before the archives for stretch disappear etc.

I'd be happy to put vmdebootstrap into Salsa as part of the Debian
Python team, with these patches, and update the build tests to current
releases, provided that others are willing to help with the other
issues.

-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/

diffstat for vmdebootstrap-1.6 vmdebootstrap-1.6

 changelog                                             |    6 ++
 compat                                                |    2 
 control                                               |   21 ++++-----
 patches/0001-Use-Python3-for-doc-version-call.patch   |   21 +++++++++
 patches/0002-Allow-other-scripts-to-use-Python3.patch |   38 ++++++++++++++++++
 patches/0003-Use-Python3-for-man-page-creation.patch  |   21 +++++++++
 patches/0004-Fix-yarn-tests-for-Python3.patch         |   32 +++++++++++++++
 patches/series                                        |    4 +
 rules                                                 |    6 +-
 9 files changed, 135 insertions(+), 16 deletions(-)

diff -Nru vmdebootstrap-1.6/debian/changelog vmdebootstrap-1.6/debian/changelog
--- vmdebootstrap-1.6/debian/changelog	2016-07-17 15:29:01.000000000 +0100
+++ vmdebootstrap-1.6/debian/changelog	2019-09-01 15:04:06.000000000 +0100
@@ -1,3 +1,9 @@
+vmdebootstrap (1.6-2) unstable; urgency=medium
+
+  * Convert to Python3 support
+
+ -- Neil Williams <codeh...@debian.org>  Sun, 01 Sep 2019 15:04:06 +0100
+
 vmdebootstrap (1.6-1) unstable; urgency=medium
 
   * Deprecating extlinux as default - to switch to grub in a
diff -Nru vmdebootstrap-1.6/debian/compat vmdebootstrap-1.6/debian/compat
--- vmdebootstrap-1.6/debian/compat	2016-07-17 15:29:01.000000000 +0100
+++ vmdebootstrap-1.6/debian/compat	2019-09-01 15:04:06.000000000 +0100
@@ -1 +1 @@
-8
+9
diff -Nru vmdebootstrap-1.6/debian/control vmdebootstrap-1.6/debian/control
--- vmdebootstrap-1.6/debian/control	2016-07-17 15:29:01.000000000 +0100
+++ vmdebootstrap-1.6/debian/control	2019-09-01 15:04:06.000000000 +0100
@@ -1,28 +1,25 @@
 Source: vmdebootstrap
 Section: admin
-Priority: extra
-Maintainer: VMDebootstrap List <vmdebootstrap-de...@lists.alioth.debian.org>
+Priority: optional
+Maintainer: Debian Python Modules Team <python-modules-t...@lists.alioth.debian.org>
 Uploaders: Neil Williams <codeh...@debian.org>,
  Iain R. Learmonth <i...@debian.org>,
  Antonio Terceiro <terce...@debian.org>
 Build-Depends: debhelper (>= 8.0.0), dh-python,
- python-sphinx (>= 1.0.7+dfsg) | python3-sphinx,
- python | python-all | python-dev | python-all-dev,
- python-setuptools (>= 3)
-Testsuite: autopkgtest
-X-Python-Version: 2.7
+ python3-sphinx (>= 1.0.7+dfsg),
+ python3, python3-setuptools (>= 3)
 Standards-Version: 3.9.8
-Homepage: https://vmdebootstrap.alioth.debian.org/
-Vcs-Git: https://anonscm.debian.org/git/vmdebootstrap/vmdebootstrap.git
-Vcs-Browser: https://anonscm.debian.org/cgit/vmdebootstrap/vmdebootstrap.git/
+# Homepage: https://vmdebootstrap.alioth.debian.org/
+# Vcs-Git: https://anonscm.debian.org/git/vmdebootstrap/vmdebootstrap.git
+# Vcs-Browser: https://anonscm.debian.org/cgit/vmdebootstrap/vmdebootstrap.git/
 
 Package: vmdebootstrap
 Architecture: linux-any
 Depends: debootstrap, qemu-utils, kpartx, parted,
- ${sphinxdoc:Depends}, ${python:Depends}, ${misc:Depends}
+ ${sphinxdoc:Depends}, ${python3:Depends}, ${misc:Depends}
 Recommends: dosfstools, grub2-common [!mips !s390x],
  extlinux [amd64 i386],
- squashfs-tools, python-guestfs, qemu-system, qemu-user-static
+ squashfs-tools, python3-guestfs, qemu-system, qemu-user-static
 Suggests: cmdtest, mbr, pandoc, u-boot:armhf
 Description: Bootstrap Debian into a (virtual machine) disk image
  vmdebootstrap is a wrapper around debootstrap to install Debian
diff -Nru vmdebootstrap-1.6/debian/patches/0001-Use-Python3-for-doc-version-call.patch vmdebootstrap-1.6/debian/patches/0001-Use-Python3-for-doc-version-call.patch
--- vmdebootstrap-1.6/debian/patches/0001-Use-Python3-for-doc-version-call.patch	1970-01-01 01:00:00.000000000 +0100
+++ vmdebootstrap-1.6/debian/patches/0001-Use-Python3-for-doc-version-call.patch	2019-09-01 15:04:06.000000000 +0100
@@ -0,0 +1,21 @@
+From: Neil Williams <codeh...@debian.org>
+Date: Sun, 1 Sep 2019 15:12:46 +0100
+Subject: Use Python3 for doc version call
+
+---
+ doc/conf.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/doc/conf.py b/doc/conf.py
+index c1d6dc7..f429b03 100644
+--- a/doc/conf.py
++++ b/doc/conf.py
+@@ -55,7 +55,7 @@ copyright = '2015 Neil Williams'
+ # built documents.
+ #
+ # The short X.Y version.
+-version = subprocess.Popen(['python', 'setup.py', '-V'], cwd=r'..', stdout=subprocess.PIPE).stdout.read().rstrip()
++version = subprocess.Popen(['python3', 'setup.py', '-V'], cwd=r'..', stdout=subprocess.PIPE).stdout.read().decode("utf-8").rstrip()
+ # The full version, including alpha/beta/rc tags.
+ release = version
+ 
diff -Nru vmdebootstrap-1.6/debian/patches/0002-Allow-other-scripts-to-use-Python3.patch vmdebootstrap-1.6/debian/patches/0002-Allow-other-scripts-to-use-Python3.patch
--- vmdebootstrap-1.6/debian/patches/0002-Allow-other-scripts-to-use-Python3.patch	1970-01-01 01:00:00.000000000 +0100
+++ vmdebootstrap-1.6/debian/patches/0002-Allow-other-scripts-to-use-Python3.patch	2019-09-01 15:04:06.000000000 +0100
@@ -0,0 +1,38 @@
+From: Neil Williams <codeh...@debian.org>
+Date: Sun, 1 Sep 2019 15:23:11 +0100
+Subject: Allow other scripts to use Python3
+
+---
+ examples/lava-submit.py | 4 ++--
+ vmextract.py            | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/examples/lava-submit.py b/examples/lava-submit.py
+index 947f986..32c3718 100755
+--- a/examples/lava-submit.py
++++ b/examples/lava-submit.py
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python
++#! /usr/bin/python3
+ # -*- coding: utf-8 -*-
+ #
+ #  lava-submit.py
+@@ -96,7 +96,7 @@ def main():
+     url = "http://%s:%s@%s//RPC2"; % (USERNAME, TOKEN, HOSTNAME)
+     server = xmlrpclib.ServerProxy(url)
+     job_id = server.scheduler.submit_job(yaml.dump(job(image)))
+-    print job_id
++    print(job_id)
+     return 0
+ 
+ if __name__ == '__main__':
+diff --git a/vmextract.py b/vmextract.py
+index 966a8bb..dbdb8dc 100755
+--- a/vmextract.py
++++ b/vmextract.py
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python
++#! /usr/bin/python3
+ # -*- coding: utf-8 -*-
+ #
+ #  Copyright 2015 Neil Williams <codeh...@debian.org>
diff -Nru vmdebootstrap-1.6/debian/patches/0003-Use-Python3-for-man-page-creation.patch vmdebootstrap-1.6/debian/patches/0003-Use-Python3-for-man-page-creation.patch
--- vmdebootstrap-1.6/debian/patches/0003-Use-Python3-for-man-page-creation.patch	1970-01-01 01:00:00.000000000 +0100
+++ vmdebootstrap-1.6/debian/patches/0003-Use-Python3-for-man-page-creation.patch	2019-09-01 15:04:06.000000000 +0100
@@ -0,0 +1,21 @@
+From: Neil Williams <codeh...@debian.org>
+Date: Sun, 1 Sep 2019 15:25:18 +0100
+Subject: Use Python3 for man page creation.
+
+---
+ man/conf.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/man/conf.py b/man/conf.py
+index 302a7d9..2719888 100644
+--- a/man/conf.py
++++ b/man/conf.py
+@@ -49,7 +49,7 @@ copyright = u'2015, Neil Williams'
+ # built documents.
+ #
+ # The short X.Y version.
+-version = subprocess.Popen(['python', 'setup.py', '-V'], cwd=r'..', stdout=subprocess.PIPE).stdout.read()
++version = subprocess.Popen(['python3', 'setup.py', '-V'], cwd=r'..', stdout=subprocess.PIPE).stdout.read().decode("utf-8")
+ # The full version, including alpha/beta/rc tags.
+ release = version
+ 
diff -Nru vmdebootstrap-1.6/debian/patches/0004-Fix-yarn-tests-for-Python3.patch vmdebootstrap-1.6/debian/patches/0004-Fix-yarn-tests-for-Python3.patch
--- vmdebootstrap-1.6/debian/patches/0004-Fix-yarn-tests-for-Python3.patch	1970-01-01 01:00:00.000000000 +0100
+++ vmdebootstrap-1.6/debian/patches/0004-Fix-yarn-tests-for-Python3.patch	2019-09-01 15:04:06.000000000 +0100
@@ -0,0 +1,32 @@
+From: Neil Williams <codeh...@debian.org>
+Date: Sun, 1 Sep 2019 16:00:20 +0100
+Subject: Fix yarn tests for Python3
+
+---
+ bin/vmdebootstrap         | 2 +-
+ yarns/200-fast-tests.yarn | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
+index cc1efe1..8fb7c3a 100755
+--- a/bin/vmdebootstrap
++++ b/bin/vmdebootstrap
+@@ -1,4 +1,4 @@
+-#! /usr/bin/python
++#! /usr/bin/python3
+ # Copyright 2011-2013  Lars Wirzenius
+ # Copyright 2012  Codethink Limited
+ # Copyright 2014-2015 Neil Williams <codeh...@debian.org>
+diff --git a/yarns/200-fast-tests.yarn b/yarns/200-fast-tests.yarn
+index db177cc..b3c72b5 100644
+--- a/yarns/200-fast-tests.yarn
++++ b/yarns/200-fast-tests.yarn
+@@ -195,7 +195,7 @@ verify that vmdebootstrap parses the command line correctly.
+     ... --bootflag
+     THEN vmdebootstrap exited with a non-zero exit code
+     AND vmdebootstrap wrote an error message matching bootflag
+-    AND vmdebootstrap wrote an error message matching requires an argument
++    AND vmdebootstrap wrote an error message matching requires 1 argument
+ 
+     SCENARIO wheezy image does not support ext4
+     ASSUMING fast tests are requested
diff -Nru vmdebootstrap-1.6/debian/patches/series vmdebootstrap-1.6/debian/patches/series
--- vmdebootstrap-1.6/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ vmdebootstrap-1.6/debian/patches/series	2019-09-01 15:04:06.000000000 +0100
@@ -0,0 +1,4 @@
+0001-Use-Python3-for-doc-version-call.patch
+0002-Allow-other-scripts-to-use-Python3.patch
+0003-Use-Python3-for-man-page-creation.patch
+0004-Fix-yarn-tests-for-Python3.patch
diff -Nru vmdebootstrap-1.6/debian/rules vmdebootstrap-1.6/debian/rules
--- vmdebootstrap-1.6/debian/rules	2016-07-17 15:29:01.000000000 +0100
+++ vmdebootstrap-1.6/debian/rules	2019-09-01 15:04:06.000000000 +0100
@@ -19,18 +19,18 @@
 export DH_OPTIONS
 
 %:
-	dh $@ --with sphinxdoc,python2
+	dh $@ --with sphinxdoc,python3 --buildsystem=pybuild
 
 override_dh_auto_build:
 	dh_auto_build
-	python setup.py build
+	python3 setup.py build
 	make -C doc/ html SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
 	make -C man/ man SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
 
 override_dh_auto_install:
 	dh_auto_install
 	dh_lintian
-	python setup.py install --root=$(CURDIR)/debian/vmdebootstrap/ --install-layout=deb
+	python3 setup.py install --root=$(CURDIR)/debian/vmdebootstrap/ --install-layout=deb
 	# move vmdebootstrap to /usr/sbin
 	mkdir debian/vmdebootstrap/usr/sbin/
 	mv debian/vmdebootstrap/usr/bin/vmdebootstrap debian/vmdebootstrap/usr/sbin/

Attachment: pgpyNR6XaHuEY.pgp
Description: OpenPGP digital signature

Reply via email to