svn commit: r279558 - in stable/10/release: . tools
Glen Barber
gjb at FreeBSD.org
Tue Mar 3 02:47:01 UTC 2015
Author: gjb
Date: Tue Mar 3 02:46:59 2015
New Revision: 279558
URL: https://svnweb.freebsd.org/changeset/base/279558
Log:
MFC r279249, r279250, r279257:
r279249:
Add 'cloudware-install' target to handle copying cloud
disk images to a directory within DESTDIR.
Add CLOUDINSTALL variable to automatically generate the
actual list of install targets. While here, rename the
cloud-specific names from 'vm-' to 'cw-' to avoid naming
collisions.
Add AZURE_DISK, GCE_DISK, and OPENSTACK_DISK output file
variables.
Add 'cloudware-install' to the 'install' target.
r279250:
Remove a stale comment.
r279257:
Add a CLOUDPACKAGE variable to contain a list of targets for
post-install packaging cloud provider images.
Add a 'gce-package.sh' script to generate the final output
image ready for upload to the GCE platform. Right now, this
is the only image that has a specific output format (GNU-tar),
and this implementation is expected to be temporary.
This is not directly connected to the other release targets.
Sponsored by: The FreeBSD Foundation
Added:
stable/10/release/tools/gce-package.sh
- copied unchanged from r279257, head/release/tools/gce-package.sh
Modified:
stable/10/release/Makefile
stable/10/release/Makefile.vm
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/release/Makefile
==============================================================================
--- stable/10/release/Makefile Tue Mar 3 02:08:17 2015 (r279557)
+++ stable/10/release/Makefile Tue Mar 3 02:46:59 2015 (r279558)
@@ -319,7 +319,7 @@ real-release:
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
-install: release-install vm-install
+install: release-install vm-install cloudware-install
release-install:
.if defined(DESTDIR) && !empty(DESTDIR)
Modified: stable/10/release/Makefile.vm
==============================================================================
--- stable/10/release/Makefile.vm Tue Mar 3 02:08:17 2015 (r279557)
+++ stable/10/release/Makefile.vm Tue Mar 3 02:46:59 2015 (r279558)
@@ -20,24 +20,30 @@ CLOUDWARE?= AZURE \
OPENSTACK
AZURE_FORMAT= vhdf
AZURE_DESC= Microsoft Azure platform image
+AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT}
GCE_FORMAT= raw
GCE_DESC= Google Compute Engine image
+GCE_DISK= disk.${GCE_FORMAT}
OPENSTACK_FORMAT=qcow2
OPENSTACK_DESC= OpenStack platform image
+OPENSTACK_DISK= ${OSRELEASE}.${OPENSTACK_FORMAT}
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
. for _CW in ${CLOUDWARE}
-CLOUDTARGETS+= vm-${_CW:tl}
-CLEANDIRS+= vm-${_CW:tl}
+CLOUDTARGETS+= cw-${_CW:tl}
+CLEANDIRS+= cw-${_CW:tl}
CLEANFILES+= ${_CW:tl}.img \
${_CW:tl}.${${_CW:tu}_FORMAT} \
- ${_CW:tl}.${${_CW:tu}_FORMAT}.raw
+ ${_CW:tl}.${${_CW:tu}_FORMAT}.raw \
+ cw${_CW:tl}-package
+CLOUDINSTALL+= cw${_CW:tl}-install
+CLOUDPACKAGE+= cw${_CW:tl}-package
${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT}
. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF)
${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf
. endif
-vm-${_CW:tl}:
+cw-${_CW:tl}:
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
${.CURDIR}/scripts/mk-vmimage.sh \
@@ -45,6 +51,26 @@ vm-${_CW:tl}:
-i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF}
touch ${.TARGET}
+
+cw${_CW:tl}-install:
+ mkdir -p ${DESTDIR}/${_CW:tl}
+ cp -p ${${_CW}IMAGE} \
+ ${DESTDIR}/${_CW:tl}/${${_CW}_DISK}
+ cd ${DESTDIR}/${_CW:tl} && sha256 ${${_CW}_DISK}* > \
+ ${DESTDIR}/${_CW:tl}/CHECKSUM.SHA256
+ cd ${DESTDIR}/${_CW:tl} && md5 ${${_CW}_DISK}* > \
+ ${DESTDIR}/${_CW:tl}/CHECKSUM.MD5
+
+cw${_CW:tl}-package:
+ @# Special target to handle packaging cloud images in the formats
+ @# specific to each hosting provider.
+.if exists(${.CURDIR}/tools/${_CW:tl}-package.sh)
+ env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
+ ${.CURDIR}/tools/${_CW:tl}-package.sh \
+ -D ${DESTDIR} -I ${${_CW}_DISK} -S ${WORLDDIR}
+.endif
+ touch ${.TARGET}
+
. endfor
.endif
@@ -97,8 +123,6 @@ vm-install:
${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
. endfor
. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES)
-# This is very time consuming, so defer it after the images are moved to
-# the DESTDIR.
. for FORMAT in ${VMFORMATS}
# Don't keep the originals. There is a copy in ${.OBJDIR} if needed.
${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}
@@ -119,3 +143,8 @@ cloudware-release:
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS}
.endif
+
+cloudware-install:
+.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
+ ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDINSTALL}
+.endif
Copied: stable/10/release/tools/gce-package.sh (from r279257, head/release/tools/gce-package.sh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/10/release/tools/gce-package.sh Tue Mar 3 02:46:59 2015 (r279558, copy of r279257, head/release/tools/gce-package.sh)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# Script to handle packaging cloud images for GCE.
+#
+# XXX:
+# This script only exists to help in automating image creation,
+# and reimplementing this is intended (in other words, this is
+# temporary).
+
+usage() {
+ echo "Usage:"
+ echo "$(basename ${0}) -D <destdir> -I <input_file> -S <src_tree>"
+ exit 1
+}
+
+main() {
+ while getopts "D:I:W:" opt; do
+ case ${opt} in
+ D)
+ DESTDIR="${OPTARG}"
+ ;;
+ I)
+ INFILE="${OPTARG}"
+ ;;
+ S)
+ WORLDDIR="${OPTARG}"
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ done
+ shift $(( ${OPTIND} - 1 ))
+
+ if [ -z "${DESTDIR}" -o -z "${INFILE}" -o -z "${WORLDDIR}" ]; then
+ usage
+ fi
+
+ OUTFILE="$(make -C ${WORLDDIR}/release -V OSRELEASE).tar.gz"
+
+ cd ${DESTDIR} && tar --format=gnutar -zcf ${OUTFILE} ${INFILE}
+}
+
+main "$@"
More information about the svn-src-stable-10
mailing list