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/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,$*)