manibuilder: Prepare for official multi-arch images
Now that we can use official multi-arch images prepare for tag names
matching the upstream ones. These will be prefixed with their respective
architecture, e.g. `ppc64le/`. To make the existing dockerfiles for
Debian and Ubuntu usable with the official images, remove their
`-debootstrap` suffix.
Change-Id: I11a7d13c7eb976205093f16dc9d3f5a57bc8f1bb
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73433
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/util/manibuilder/Dockerfile.debian-debootstrap b/util/manibuilder/Dockerfile.debian
similarity index 100%
rename from util/manibuilder/Dockerfile.debian-debootstrap
rename to util/manibuilder/Dockerfile.debian
diff --git a/util/manibuilder/Dockerfile.ubuntu-debootstrap b/util/manibuilder/Dockerfile.ubuntu
similarity index 100%
rename from util/manibuilder/Dockerfile.ubuntu-debootstrap
rename to util/manibuilder/Dockerfile.ubuntu
diff --git a/util/manibuilder/Makefile b/util/manibuilder/Makefile
index b98e4f5..0aa503c 100644
--- a/util/manibuilder/Makefile
+++ b/util/manibuilder/Makefile
@@ -9,14 +9,21 @@
spc :=
spc := $(spc) $(spc)
-stem = $(word 1,$(subst :,$(spc),$(subst \:,$(spc),$(1))))
-ident = $(subst :,_,$(subst \:,_,$(1)))
+# Get stem of multiarch tags of the form `stem[-variation]:arch-version`
+ma_stem = $(word 1,$(subst -,$(spc),$(subst :,$(spc),$(subst \:,$(spc),$(1)))))
+# Get stem of official tags of the form `arch/stem:version`
+official_stem = $(word 2,$(subst /,$(spc),$(subst :,$(spc),$(subst \:,$(spc),$(1)))))
+
+ident = $(subst /,_,$(subst :,_,$(subst \:,_,$(1))))
include Makefile.anita
+# $(1): mani tag
+# $(2): from tag
+# $(3): Dockerfile suffix
define build_template
-Dockerfile.$(call ident,$(1)): Dockerfile.$(call stem,$(1)) mani-wrapper.sh
- $(QUIET_SETUP)sed -e 's|^FROM manibase|FROM $(2)/$(1)|' $$< >$$@
+Dockerfile.$(call ident,$(1)): Dockerfile.$(3) mani-wrapper.sh
+ $(QUIET_SETUP)sed -e 's|^FROM manibase|FROM $(2)|' $$< >$$@
.INTERMEDIATE: Dockerfile.$(call ident,$(1))
@@ -25,7 +32,10 @@
endef
$(foreach tag,$(MULTIARCH_TAGS), \
- $(eval $(call build_template,$(tag),multiarch)))
+ $(eval $(call build_template,$(tag),multiarch/$(tag),$(call ma_stem,$(tag)))))
+
+$(foreach tag,$(OFFICIAL_TAGS), \
+ $(eval $(call build_template,$(tag),$(tag),$(call official_stem,$(tag)))))
djgpp\:6.1.0-build: %-build: Dockerfile.djgpp mani-wrapper.sh
$(QUIET_SETUP)docker build . -f $< -t mani/$* --build-arg IDENT=$(call ident,$*)
diff --git a/util/manibuilder/Makefile.targets b/util/manibuilder/Makefile.targets
index 883b512..9b57a64 100644
--- a/util/manibuilder/Makefile.targets
+++ b/util/manibuilder/Makefile.targets
@@ -36,7 +36,7 @@
OTHER_TAGS := djgpp\:6.1.0
-ALL_TAGS := $(ANITA_TAGS) $(MULTIARCH_TAGS) $(OTHER_TAGS)
+ALL_TAGS := $(ANITA_TAGS) $(MULTIARCH_TAGS) $(OFFICIAL_TAGS) $(OTHER_TAGS)
BROKEN_TAGS := anita\:7.1-amd64 anita\:7.1-i386 \
centos\:7.6-armhfp-clean \
@@ -46,7 +46,8 @@
arch_filter = $(sort \
$(foreach arch,$(1), \
- $(filter-out $(subst $(arch),,$(MULTIARCH_TAGS)),$(MULTIARCH_TAGS))))
+ $(filter-out $(subst $(arch),,$(MULTIARCH_TAGS) $(OFFICIAL_TAGS)), \
+ $(MULTIARCH_TAGS) $(OFFICIAL_TAGS))))
machine_map = \
$(if $(filter i386 i686 x86,$(1)),i386 x86, \