git: d371e6ef0624 - releng/14.0 - release/Makefile.vm: Add support for CW flavours

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 05 Oct 2023 15:54:33 UTC
The branch releng/14.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=d371e6ef06242dcb63219d6163d279c7cff847bc

commit d371e6ef06242dcb63219d6163d279c7cff847bc
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-09-09 00:51:08 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-10-05 15:54:03 +0000

    release/Makefile.vm: Add support for CW flavours
    
    There are two "Vagrant" images right now: "Vagrant Image for VirtualBox"
    and "Vagrant Image for VMWare".  Rather than listing these separately in
    a CLOUDWARE list, place "VAGRANT" into a CLOUDWARE_TYPES list and then
    use a VAGRANT_FLAVOURS variable to identify the two versions.  Add make
    logic to allow defaults (in this case, image format and filesystem) to
    be specified once for VAGRANT and inherited by both flavours.
    
    This will make future work to add flavoured EC2 images simpler.
    
    Approved by:    re (gjb)
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D41790
    
    (cherry picked from commit e6eeac9b71795252b12a6b94e7a06633a9ff6e4e)
    (cherry picked from commit fec4f6a7c377f576c78dabe16bc632ecf20058b4)
---
 release/Makefile.vm | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/release/Makefile.vm b/release/Makefile.vm
index 4041ae14e2f3..e7ff86c28df3 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -17,12 +17,11 @@ VMDK_DESC=	VMWare, VirtualBox disk image
 QCOW2_DESC=	Qemu, KVM disk image
 RAW_DESC=	Unformatted raw disk image
 
-CLOUDWARE?=	BASIC-CI \
+CLOUDWARE_TYPES?= BASIC-CI \
 		EC2 \
 		GCE \
 		OCI \
-		VAGRANT-VIRTUALBOX \
-		VAGRANT-VMWARE
+		VAGRANT
 AZURE_FORMAT=	vhdf
 AZURE_FSLIST=	ufs
 AZURE_DESC=	Microsoft Azure platform image
@@ -41,13 +40,26 @@ OCI_DESC=	Oracle Cloud Infrastructure image
 OPENSTACK_FORMAT=qcow2
 OPENSTACK_FSLIST=	ufs
 OPENSTACK_DESC=	OpenStack platform image
-VAGRANT-VIRTUALBOX_FORMAT=	vmdk
-VAGRANT-VIRTUALBOX_FSLIST=	ufs
+VAGRANT_FORMAT=	vmdk
+VAGRANT_FSLIST=	ufs
+VAGRANT_FLAVOURS=	VIRTUALBOX VMWARE
 VAGRANT-VIRTUALBOX_DESC=	Vagrant Image for VirtualBox
-VAGRANT-VMWARE_FORMAT=	vmdk
-VAGRANT-VMWARE_FSLIST=	ufs
 VAGRANT-VMWARE_DESC=	Vagrant Image for VMWare
 
+.for _CWT in ${CLOUDWARE_TYPES}
+. if defined(${_CWT}_FLAVOURS)
+.  for _CWF in ${${_CWT}_FLAVOURS}
+CLOUDWARE_GEN+=	${_CWT}-${_CWF}
+${_CWT}-${_CWF}_FORMAT?=	${${_CWT}_FORMAT}
+${_CWT}-${_CWF}_FSLIST?=	${${_CWT}_FSLIST}
+${_CWT}-${_CWF}_DESC?=	${${_CWT}_DESC}
+.  endfor
+. else
+CLOUDWARE_GEN+=	${_CWT}
+. endif
+.endfor
+CLOUDWARE?=	${CLOUDWARE_GEN}
+
 .for _V in TYPE BRANCH REVISION
 . if !defined(${_V}) || empty(${_V})
 ${_V}!=	eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}