git: 9b92ce7bd3a3 - stable/14 - Makefile.vm: Fix duplicate rc.conf files

From: Colin Percival <>
Date: Tue, 05 Dec 2023 23:40:17 UTC
The branch stable/14 has been updated by cperciva:


commit 9b92ce7bd3a3cd4f127628a09bd4a9e9fdffe18a
Author:     Colin Percival <>
AuthorDate: 2023-11-27 21:29:05 +0000
Commit:     Colin Percival <>
CommitDate: 2023-12-05 23:40:05 +0000

    Makefile.vm: Fix duplicate rc.conf files
    Two bugs in Makefile.vm resulted in disk images being "built" multiple
    times, resulting in lines added to /etc/rc.conf being duplicated:
    1. The vm-image target reused the same "staging tree" directory for all
    of its builds (multiple disk image types and multiple filesystem types).
    2. The cw-type-flavour-fs target depends on emulator-portinstall, which
    did not have a 'touch ${.TARGET}' and thus re-ran every time -- and
    caused the cw-type-flavour-fs target to be re-run.  This was triggered
    by release builds running `make cloudware-release` (creating the disk
    images) followed by `make ec2amis` (which re-created the disk images
    prior to uploading them).
    MFC After:      1 week
    Sponsored by:
    (cherry picked from commit 97bd53ef4d20b7d15e0b0976e885af9438f5637e)
 release/Makefile.vm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/release/Makefile.vm b/release/Makefile.vm
index 1a58a548b9f4..a7624775d48c 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -81,6 +81,7 @@ emulator-portinstall:
 	env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-user-static
+	touch ${.TARGET}
@@ -137,10 +138,11 @@ vm-image:
 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
 .  for FS in ${VMFSLIST}
-	mkdir -p ${.OBJDIR}/${.TARGET}
+	mkdir -p ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS}
 		${.CURDIR}/scripts/ \
-		-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${FS} \
+		-C ${.CURDIR}/tools/vmimage.subr \
+		-d ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS} -F ${FS} \
 		-i ${.OBJDIR}/${FORMAT}.${FS}.img -s ${VMSIZE} -f ${FORMAT} \
 .  endfor