From bc42e2a8e94713dafb4de4546352749354bc80e0 Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Thu, 24 Jun 2021 17:05:29 +0100 Subject: Merge qemu-debootstrap into debootstrap Cross-architecture debootstrap without qemu-debootstrap requires Debian >= Buster --- vmdb/plugins/debootstrap.mdwn | 4 ++++ vmdb/plugins/debootstrap_plugin.py | 25 +++++++++++++++++++++++-- vmdb/plugins/qemudebootstrap.mdwn | 4 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/vmdb/plugins/debootstrap.mdwn b/vmdb/plugins/debootstrap.mdwn index c1773d3..322cf6b 100644 --- a/vmdb/plugins/debootstrap.mdwn +++ b/vmdb/plugins/debootstrap.mdwn @@ -21,6 +21,10 @@ Step keys: (e.g. Raspbian) as by default debootstrap will use the keys provided by the "debian-archive-keyring" package. +* `arch` — OPTIONAL; the foreign architecture to use. + +* `variant` — OPTIONAL; the variant for debootstrap. + Example (in the .vmdb file): - debootstrap: buster diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index 63579e5..c591351 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -17,7 +17,7 @@ import vmdb - +import subprocess class DebootstrapPlugin(vmdb.Plugin): def enable(self): @@ -30,8 +30,10 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): "debootstrap": str, "target": str, "mirror": str, + "arch": "", "keyring": "", "variant": "-", + "components": ["main"], } def run(self, values, settings, state): @@ -40,7 +42,9 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): target = state.tags.get_builder_mount_point(tag) mirror = values["mirror"] keyring = values["keyring"] or None + arch = values["keyring"] or subprocess.check_output(['dpkg', '--print-architecture']) variant = values["variant"] + components = values["components"] if not (suite and tag and target and mirror): raise Exception("missing arg for debootstrap step") @@ -50,15 +54,32 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): "debootstrap", "--keyring", keyring, + "--arch", + arch, "--variant", variant, + "--components", + ",".join(components), suite, target, mirror, ] ) else: - vmdb.runcmd(["debootstrap", "--variant", variant, suite, target, mirror]) + vmdb.runcmd( + [ + "debootstrap", + "--arch", + arch, + "--variant", + variant, + "--components", + ",".join(components), + suite, + target, + mirror, + ] + ) def run_even_if_skipped(self, values, settings, state): tag = values["target"] diff --git a/vmdb/plugins/qemudebootstrap.mdwn b/vmdb/plugins/qemudebootstrap.mdwn index bb9adc4..6475497 100644 --- a/vmdb/plugins/qemudebootstrap.mdwn +++ b/vmdb/plugins/qemudebootstrap.mdwn @@ -1,6 +1,10 @@ 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 -- cgit v1.2.1 From 38120ea5721b5f86bc66b6063634c7ca2077b904 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 12 Jul 2021 13:39:17 +0300 Subject: fix: get config key "arch" for arch instead of "keyring" Sponsored-by: author --- vmdb/plugins/debootstrap_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index c591351..9f622a1 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -42,7 +42,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): target = state.tags.get_builder_mount_point(tag) mirror = values["mirror"] keyring = values["keyring"] or None - arch = values["keyring"] or subprocess.check_output(['dpkg', '--print-architecture']) + arch = values["arch"] or subprocess.check_output(['dpkg', '--print-architecture']) variant = values["variant"] components = values["components"] -- cgit v1.2.1