From 457f53e6dc24741e7cc2dafe00a358e9a48cee12 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 11 Jun 2022 11:14:51 +0300 Subject: feat! drop qemu-deboostrap plugin, run_even_if_skipped feature The qemu-deboostrap plugin is entirely replaced with the debootstrap one, on versions of Debian 10 onward. There is no need to keep it. The `run_even_if_skipped` feature was only used by that plugin, so it has been dropped as well. Sponsored-by: author --- README.md | 2 +- amd64-uefi.vmdb | 8 +-- amd64.vmdb | 2 +- arm64-uefi.vmdb | 8 +-- armhf-uefi.vmdb | 8 +-- check-images | 11 ++-- i386-uefi.vmdb | 8 +-- i386.vmdb | 2 +- ppc64el.vmdb | 8 +-- smoke-amd64.vmdb | 2 +- smoke-i386.vmdb | 2 +- smoke-ppc64el.vmdb | 2 +- smoke-uefi-amd64.vmdb | 2 +- smoke-uefi-arm64.vmdb | 2 +- smoke-uefi-armhf.vmdb | 2 +- smoke-uefi-i386.vmdb | 2 +- vmdb/app.py | 9 ++-- vmdb/plugins/qemudebootstrap.mdwn | 38 -------------- vmdb/plugins/qemudebootstrap_plugin.py | 92 ---------------------------------- vmdb/step_list.py | 3 -- 20 files changed, 29 insertions(+), 184 deletions(-) delete mode 100644 vmdb/plugins/qemudebootstrap.mdwn delete mode 100644 vmdb/plugins/qemudebootstrap_plugin.py diff --git a/README.md b/README.md index eb358f5..0d10eca 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The following tools are used by vmdb2 (Debian package names in brackets). * `kpartx` [kpartx, mkpart command] * `parted` [`parted`, mklabel command] * `qemu-img` [`qemu-utils`, mkimg command] -* `qemu-user-static` [`qemu-user-static`, qemu-debootstrap command] +* `qemu-user-static` [`qemu-user-static`] * `zerofree` [`zerofree`, zerofree command] The following Python modules are used by vmdb2 (Debian package names in brackets). diff --git a/amd64-uefi.vmdb b/amd64-uefi.vmdb index 872de16..d9fd132 100644 --- a/amd64-uefi.vmdb +++ b/amd64-uefi.vmdb @@ -30,15 +30,11 @@ steps: - mount: / - # Using the virtual-filesystems plugin here upsets qemu-debootstrap, - # which ends up unable to create /dev/fd within the chroot, causing - # the qemu-debootstrap phase to fail. Until we get to the bottom - # that, don't enable the plugin. - #- virtual-filesystems: / + - virtual-filesystems: / - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: amd64 mirror: http://deb.debian.org/debian target: / diff --git a/amd64.vmdb b/amd64.vmdb index e8efe72..1a5dfcf 100644 --- a/amd64.vmdb +++ b/amd64.vmdb @@ -23,7 +23,7 @@ steps: - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: amd64 mirror: http://deb.debian.org/debian target: / diff --git a/arm64-uefi.vmdb b/arm64-uefi.vmdb index 2a72100..c6783ae 100644 --- a/arm64-uefi.vmdb +++ b/arm64-uefi.vmdb @@ -30,15 +30,11 @@ steps: - mount: / - # Using the virtual-filesystems plugin here upsets qemu-debootstrap, - # which ends up unable to create /dev/fd within the chroot, causing - # the qemu-debootstrap phase to fail. Until we get to the bottom - # that, don't enable the plugin. - #- virtual-filesystems: / + - virtual-filesystems: / - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: arm64 mirror: http://deb.debian.org/debian target: / diff --git a/armhf-uefi.vmdb b/armhf-uefi.vmdb index 85235a0..21ca183 100644 --- a/armhf-uefi.vmdb +++ b/armhf-uefi.vmdb @@ -30,15 +30,11 @@ steps: - mount: / - # Using the virtual-filesystems plugin here upsets qemu-debootstrap, - # which ends up unable to create /dev/fd within the chroot, causing - # the qemu-debootstrap phase to fail. Until we get to the bottom - # that, don't enable the plugin. - #- virtual-filesystems: / + - virtual-filesystems: / - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: armhf mirror: http://deb.debian.org/debian target: / diff --git a/check-images b/check-images index 1871673..51ecd5c 100755 --- a/check-images +++ b/check-images @@ -29,14 +29,11 @@ tryit() { src="$(dirname "$0")" cd "$src" -# This uses debootstrap, not qemu-debootstrap. Hence, it only works on amd64 -if [ -x /usr/bin/dpkg ] && [ "$(dpkg --print-architecture)" = "amd64" ]; then - bash -x ./smoke.sh "$amd64_tarball" +bash -x ./smoke.sh "$amd64_tarball" - for x in "$@" pc uefi ansible smoke-pc smoke-uefi; do - tryit "$tarballdir/$x.img" "$x.vmdb" "$amd64_tarball" - done -fi +for x in "$@" pc uefi ansible smoke-pc smoke-uefi; do + tryit "$tarballdir/$x.img" "$x.vmdb" "$amd64_tarball" +done if [ -e /usr/share/OVMF/OVMF_VARS_4M.fd ]; then bash -x ./smoke-amd64.sh "$amd64_tarball" diff --git a/i386-uefi.vmdb b/i386-uefi.vmdb index e898d6a..deb5d06 100644 --- a/i386-uefi.vmdb +++ b/i386-uefi.vmdb @@ -30,15 +30,11 @@ steps: - mount: / - # Using the virtual-filesystems plugin here upsets qemu-debootstrap, - # which ends up unable to create /dev/fd within the chroot, causing - # the qemu-debootstrap phase to fail. Until we get to the bottom - # that, don't enable the plugin. - #- virtual-filesystems: / + - virtual-filesystems: / - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: i386 mirror: http://deb.debian.org/debian target: / diff --git a/i386.vmdb b/i386.vmdb index 239b58e..ae6529a 100644 --- a/i386.vmdb +++ b/i386.vmdb @@ -23,7 +23,7 @@ steps: - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: i386 mirror: http://deb.debian.org/debian target: / diff --git a/ppc64el.vmdb b/ppc64el.vmdb index 5bc4cba..f04b550 100644 --- a/ppc64el.vmdb +++ b/ppc64el.vmdb @@ -27,15 +27,11 @@ steps: - mount: / - # Using the virtual-filesystems plugin here upsets qemu-debootstrap, - # which ends up unable to create /dev/fd within the chroot, causing - # the qemu-debootstrap phase to fail. Until we get to the bottom - # that, don't enable the plugin. - #- virtual-filesystems: / + - virtual-filesystems: / - unpack-rootfs: / - - qemu-debootstrap: buster + - debootstrap: buster arch: ppc64el mirror: http://deb.debian.org/debian target: / diff --git a/smoke-amd64.vmdb b/smoke-amd64.vmdb index ba337ac..fa20f03 100644 --- a/smoke-amd64.vmdb +++ b/smoke-amd64.vmdb @@ -44,7 +44,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: amd64 mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-i386.vmdb b/smoke-i386.vmdb index 8f769d9..5f261f6 100644 --- a/smoke-i386.vmdb +++ b/smoke-i386.vmdb @@ -44,7 +44,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: i386 mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-ppc64el.vmdb b/smoke-ppc64el.vmdb index 1111de5..d3cb252 100644 --- a/smoke-ppc64el.vmdb +++ b/smoke-ppc64el.vmdb @@ -44,7 +44,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: ppc64el mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-uefi-amd64.vmdb b/smoke-uefi-amd64.vmdb index 3044801..963508a 100644 --- a/smoke-uefi-amd64.vmdb +++ b/smoke-uefi-amd64.vmdb @@ -47,7 +47,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: amd64 mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-uefi-arm64.vmdb b/smoke-uefi-arm64.vmdb index 95e4c4b..f8d8d79 100644 --- a/smoke-uefi-arm64.vmdb +++ b/smoke-uefi-arm64.vmdb @@ -47,7 +47,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: arm64 mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-uefi-armhf.vmdb b/smoke-uefi-armhf.vmdb index 0906dcc..b5fb70a 100644 --- a/smoke-uefi-armhf.vmdb +++ b/smoke-uefi-armhf.vmdb @@ -47,7 +47,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: armhf mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/smoke-uefi-i386.vmdb b/smoke-uefi-i386.vmdb index f04d74a..a0c62a0 100644 --- a/smoke-uefi-i386.vmdb +++ b/smoke-uefi-i386.vmdb @@ -47,7 +47,7 @@ steps: - unpack-rootfs: rootfs - - qemu-debootstrap: buster + - debootstrap: buster arch: i386 mirror: http://deb.debian.org/debian keyring: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/vmdb/app.py b/vmdb/app.py index 65bc568..bb84aa1 100644 --- a/vmdb/app.py +++ b/vmdb/app.py @@ -168,7 +168,9 @@ class ImageBuilder: spec = self.load_spec_file(self._specfile) state = vmdb.State() state.tags = vmdb.Tags() - state.arch = vmdb.runcmd(["dpkg", "--print-architecture"]).decode("UTF-8").strip() + state.arch = ( + vmdb.runcmd(["dpkg", "--print-architecture"]).decode("UTF-8").strip() + ) self.add_template_vars(state.as_dict()) steps = spec.get_steps(self._tvars) @@ -219,7 +221,6 @@ class ImageBuilder: steps_taken = [] settings = {"rootfs-tarball": self._tarball} - even_if_skipped = method_name + "_even_if_skipped" for step in steps: try: logging.info(msg, step) @@ -227,9 +228,9 @@ class ImageBuilder: runner = self.step_runners.find(step) if runner.skip(step, settings, state): logging.info("Skipping as requested by unless") - method_names = [even_if_skipped] + method_names = [] else: - method_names = [method_name, even_if_skipped] + method_names = [method_name] methods = [ getattr(runner, name) diff --git a/vmdb/plugins/qemudebootstrap.mdwn b/vmdb/plugins/qemudebootstrap.mdwn deleted file mode 100644 index 6475497..0000000 --- a/vmdb/plugins/qemudebootstrap.mdwn +++ /dev/null @@ -1,38 +0,0 @@ -Step: qemu-debootstrap ------------------------------------------------------------------------------ - -This command has been merged into `debootstrap`. -If your builds run on Debian 10 or later, -it is recommended to use `debootstrap` instead of `qemu-debootstrap`. - -Install packages using apt, which needs to already have been -installed, for a different architecture than the host where vmdb2 is -being run. For example, for building an image for a Raspberry Pi on an -Intel PC. - -Step keys: - -* `qemu-debootstrap` — REQUIRED; value is the codename of the Debian - release to install: `stretch`, `buster`, etc. - -* `target` — REQUIRED; value is the tag for the root filesystem. - -* `mirror` — OPTIONAL; which Debian mirror to use. - -* `keyring` — OPTIONAL; which gpg keyring to use to verify the - packages. This is useful when using a non-official Debian repository - (e.g. Raspbian) as by default qemu-debootstrap will use the keys - provided by the "debian-archive-keyring" package. - -* `arch` — REQUIRED; the foreign architecture to use. - -* `variant` — OPTIONAL; the variant for debootstrap. - -Example (in the .vmdb file): - - - qemu-debootstrap: buster - target: root - mirror: http://mirror.example.com/debian - keyring: /etc/apt/trusted.gpg - arch: arm64 - variant: buildd diff --git a/vmdb/plugins/qemudebootstrap_plugin.py b/vmdb/plugins/qemudebootstrap_plugin.py deleted file mode 100644 index cd36570..0000000 --- a/vmdb/plugins/qemudebootstrap_plugin.py +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 2017 Lars Wirzenius and Stuart Prescott -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# =*= License: GPL-3+ =*= - - -import vmdb - - -class QemuDebootstrapPlugin(vmdb.Plugin): - def enable(self): - self.app.step_runners.add(QemuDebootstrapStepRunner()) - - -class QemuDebootstrapStepRunner(vmdb.StepRunnerInterface): - def get_key_spec(self): - return { - "qemu-debootstrap": str, - "target": str, - "mirror": str, - "arch": str, - "keyring": "", - "variant": "-", - "components": ["main"], - } - - def run(self, values, settings, state): - suite = values["qemu-debootstrap"] - tag = values["target"] - target = state.tags.get_builder_mount_point(tag) - mirror = values["mirror"] - keyring = values["keyring"] or None - variant = values["variant"] - arch = values["arch"] - components = values["components"] - if not (suite and tag and target and mirror and arch): - raise Exception("missing arg for qemu-debootstrap step") - # Update the state with the target architecture declared here - # in order that later stages can find it and behave - # appropriately. - state.arch = arch - if keyring: - vmdb.runcmd( - [ - "qemu-debootstrap", - "--keyring", - keyring, - "--arch", - arch, - "--variant", - variant, - "--components", - ",".join(components), - suite, - target, - mirror, - ] - ) - else: - vmdb.runcmd( - [ - "qemu-debootstrap", - "--arch", - arch, - "--variant", - variant, - "--components", - ",".join(components), - suite, - target, - mirror, - ] - ) - vmdb.runcmd_chroot(target, ["apt-get", "update"]) - - def run_even_if_skipped(self, values, settings, state): - tag = values["target"] - target = state.tags.get_builder_mount_point(tag) - state.arch = values["arch"] - vmdb.runcmd_chroot(target, ["apt-get", "update"]) diff --git a/vmdb/step_list.py b/vmdb/step_list.py index d5ce1dc..5eef635 100644 --- a/vmdb/step_list.py +++ b/vmdb/step_list.py @@ -50,9 +50,6 @@ class StepRunnerInterface: # pragma: no cover def run(self, step_spec, settings, state): raise NotImplementedError() - def run_even_if_skipped(self, step_spec, settings, state): - pass - def teardown(self, step_spec, settings, state): # Default implementation does nop, so that sub-classes don't # need to have a nop teardown. -- cgit v1.2.1