git: e6eeac9b7179 - main - release/Makefile.vm: Add support for CW flavours

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 28 Sep 2023 22:18:51 UTC
The branch main has been updated by cperciva:

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

commit e6eeac9b71795252b12a6b94e7a06633a9ff6e4e
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-09-09 00:51:08 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2023-09-28 22:18:46 +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.
    
    releng/14.0 candidate.
    
    Discussed with: gjb
    Reviewed by:    imp
    MFC after:      5 days
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D41790
---
 release/Makefile.vm | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/release/Makefile.vm b/release/Makefile.vm
index befa9625fefb..bb719da68ead 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 zfs
 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}