Date: Wed, 11 Mar 2020 19:59:29 +0000 (UTC) From: Glen Barber <gjb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r358893 - user/gjb/thermite Message-ID: <202003111959.02BJxTZR079134@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gjb Date: Wed Mar 11 19:59:29 2020 New Revision: 358893 URL: https://svnweb.freebsd.org/changeset/base/358893 Log: Resync thermite with the re@ version: - thermite.sh: - Add support for aarch64 EC2 AMIs. - Move creating seed src checkouts for amd64 and i386 to zfs_mount_src(). - Create a zfs dataset for the amd64 and i386 userland which later is snapshotted and cloned, eliminating multiple invocations of the installworld target. - Explicitly return 0 in build_chroots(). - Make use of ZFS a requirement. - Update and sort Copyright. zfs-setup.sh: - Rename to zfs-cleanup.sh. - Default to cleanup-only. ZFS datasets are now created via thermite.sh. This is the first batch of changes in preparation of adding support for snapshot/release builds from both git and svn. Sponsored by: Rubicon Communications, LLC (netgate.com) Added: user/gjb/thermite/zfs-cleanup.sh - copied, changed from r358892, user/gjb/thermite/zfs-setup.sh Deleted: user/gjb/thermite/zfs-setup.sh Modified: user/gjb/thermite/thermite.sh Modified: user/gjb/thermite/thermite.sh ============================================================================== --- user/gjb/thermite/thermite.sh Wed Mar 11 19:57:43 2020 (r358892) +++ user/gjb/thermite/thermite.sh Wed Mar 11 19:59:29 2020 (r358893) @@ -1,7 +1,8 @@ #!/bin/sh #- -# Copyright (c) 2013-2018 The FreeBSD Foundation # Copyright (c) 2012, 2013 Glen Barber +# Copyright (c) 2013-2019 The FreeBSD Foundation +# Copyright (c) 2020 Rubicon Communications, LLC (netgate.com) # All rights reserved. # # Portions of this software were developed by Glen Barber @@ -108,11 +109,9 @@ runall() { } check_use_zfs() { - if [ -z ${use_zfs} ]; then - return 1 - fi if [ ! -c /dev/zfs ]; then - return 1 + echo "ZFS is required." + exit 1 fi return 0 } @@ -159,18 +158,29 @@ zfs_mount_tree() { info "Cloning ${_clone}@clone to ${_target}" zfs clone -p -o mountpoint=${_mount}/usr/${_tree} \ ${_clone}@clone ${_target} - if [ ! -z ${seed_src} ]; then - # Only create chroot seeds for x86. - if [ "${arch}" = "amd64" ] || [ "${arch}" = "i386" ]; then - _seedmount=${chroots}/${rev}/${arch}/${type} - _seedtarget="${zfs_parent}/${rev}-${arch}-${type}-chroot" - zfs clone -p -o mountpoint=${_seedmount} \ - ${_clone}@clone ${_seedtarget} - fi - fi unset _clone _mount _target _tree _seedmount _seedtarget } +zfs_mount_src() { + source_config || return 0 + _tree=src + _clone="${zfs_parent}/${rev}-${_tree}-${type}" + # Only create chroot seeds for x86. + case ${arch} in + amd64|i386) + ;; + *) + return 0 + ;; + esac + _seedmount=${chroots}/${rev}/${arch}/${type} + _seedtarget="${zfs_parent}/${rev}-${arch}-${type}-chroot" + info "Creating ${_seedtarget} from ${_clone}" + zfs clone -p -o mountpoint=${_seedmount} \ + ${_clone}@clone ${_seedtarget} + unset _clone _mount _target _tree _seedmount _seedtarget +} + zfs_create_tree() { source_config || return 0 _tree=${1} @@ -210,10 +220,13 @@ zfs_bootstrap() { runall zfs_create_tree src runall zfs_create_tree ports runall zfs_create_tree doc + zfs_bootstrap_done=1 +} + +zfs_finish_bootstrap() { runall zfs_mount_tree src runall zfs_mount_tree ports runall zfs_mount_tree doc - zfs_bootstrap_done=1 } prebuild_setup() { @@ -345,9 +358,24 @@ upload_ec2_ami() { _build="${rev}-${arch}-${kernel}-${type}" _conf="${scriptdir}/${_build}.conf" source_config || return 0 - case ${arch} in - amd64) + case ${arch}:${kernel} in + amd64:GENERIC) + _EC2TARGET=amd64 + _EC2TARGET_ARCH=amd64 ;; + aarch64:GENERIC) + # XXX: temporary until support for stable/11 is added + case ${rev} in + 13|12) + _EC2TARGET=arm64 + _EC2TARGET_ARCH=aarch64 + ;; + *) + return 0 + ;; + esac + # end XXX + ;; *) return 0 ;; @@ -371,9 +399,12 @@ upload_ec2_ami() { EC2PUBLIC=${EC2PUBLIC} \ EC2PUBLICSNAP=${EC2PUBLICSNAP} \ EC2SNSTOPIC=${EC2SNSTOPIC} \ + TARGET=${_EC2TARGET} \ + TARGET_ARCH=${_EC2TARGET_ARCH} \ ec2ami \ >> ${logdir}/${_build}.ec2.log 2>&1 unset _build _conf AWSREGION AWSBUCKET AWSKEYFILE EC2PUBLIC EC2SNSTOPIC EC2PUBLICSNAP + unset _EC2TARGET _EC2TARGET_ARCH umount ${CHROOTDIR}/dev return 0 } # upload_ec2_ami() @@ -464,23 +495,52 @@ install_chroots() { _chrootarch="amd64" ;; esac + [ ! -z $(eval echo \${zfs_${_chrootarch}_seed_${rev}_${type}}) ] \ + && return 0 + _clone="${zfs_parent}/${rev}-${_chrootarch}-worldseed-${type}" + _mount="/${zfs_mount}/${rev}-${arch}-worldseed-${type}" _build="${rev}-${arch}-${kernel}-${type}" _dest="${__WRKDIR_PREFIX}/${_build}" _srcdir="${chroots}/${rev}/${_chrootarch}/${type}" _objdir="${chroots}/${rev}-obj/${_chrootarch}/${type}" - info "Creating ${_dest}" - mkdir -p "${_dest}" - info "Installing ${_dest}" + info "Creating ${_mount}" + zfs create -o atime=off -o mountpoint=${_mount} ${_clone} + info "Installing ${_mount}" env MAKEOBJDIRPREFIX=${_objdir} \ make -C ${_srcdir} \ __MAKE_CONF=/dev/null SRCCONF=/dev/null \ TARGET=${_chrootarch} TARGET_ARCH=${_chrootarch} \ - DESTDIR=${_dest} \ + DESTDIR=${_mount} \ installworld distribution >> \ ${logdir}/${_build}.log 2>&1 - unset _build _dest _objdir _srcdir + zfs snapshot ${_clone}@clone + eval zfs_${_chrootarch}_seed_${rev}_${type}=1 + unset _build _dest _objdir _srcdir _clone _mount + + return 0 } +zfs_clone_chroots() { + source_config || return 0 + case ${arch} in + i386) + _chrootarch="i386" + ;; + *) + _chrootarch="amd64" + ;; + esac + _clone="${zfs_parent}/${rev}-${_chrootarch}-worldseed-${type}" + _mount="/${zfs_mount}/${rev}-${arch}-worldseed-${type}" + _build="${rev}-${arch}-${kernel}-${type}" + _dest="${__WRKDIR_PREFIX}/${_build}" + info "Cloning ${_chrootarch} world to ${zfs_parent}/${_build}" + zfs clone -p -o mountpoint=${_dest} ${_clone}@clone ${zfs_parent}/${_build} + unset _clone _mount _build _dest + + return 0 +} + # Build amd64/i386 "seed" chroots for all branches being built. build_chroots() { source_config || return 0 @@ -519,6 +579,8 @@ build_chroots() { ${logdir}/${_build}.log 2>&1 eval chroot_${_chrootarch}_build_${rev}_${type}=1 unset _build _dest _objdir _srcdir + + return 0 } main() { @@ -541,12 +603,17 @@ main() { done shift $(($OPTIND - 1)) [ -z ${CONF} ] && usage + use_zfs=1 + check_use_zfs zfs_bootstrap_done= prebuild_setup runall truncate_logs zfs_bootstrap + runall zfs_mount_src runall build_chroots runall install_chroots + runall zfs_clone_chroots + zfs_finish_bootstrap runall ${parallel}build_release wait runall upload_ec2_ami Copied and modified: user/gjb/thermite/zfs-cleanup.sh (from r358892, user/gjb/thermite/zfs-setup.sh) ============================================================================== --- user/gjb/thermite/zfs-setup.sh Wed Mar 11 19:57:43 2020 (r358892, copy source) +++ user/gjb/thermite/zfs-cleanup.sh Wed Mar 11 19:59:29 2020 (r358893) @@ -4,7 +4,7 @@ # usage() { - echo "$(basename ${0}) [-d] -c /path/to/configuration/file" + echo "$(basename ${0}) -d -c /path/to/configuration/file" exit 1 } @@ -92,26 +92,15 @@ zfs_teardown() { done done done - return 0 -} -zfs_setup() { - [ ! -z ${delete_only} ] && return 0 - for r in ${revs}; do - for a in ${archs}; do - for k in ${kernels}; do - for t in ${types}; do - s="${r}-${a}-${k}-${t}" - if [ -e ${scriptdir}/${s}.conf ]; - then - echo "${pfx} Creating ${zfs_parent}/${s}" \ - >/dev/stdout - zfs create -o atime=off ${zfs_parent}/${s} - fi - done - done - done - done + zfs destroy ${zfs_parent}/${r}-amd64-worldseed-snap@clone + zfs destroy ${zfs_parent}/${r}-amd64-worldseed-snap + zfs destroy ${zfs_parent}/${r}-i386-worldseed-snap@clone + zfs destroy ${zfs_parent}/${r}-i386-worldseed-snap + + echo -n "ZFS datasets were destroyed. The will be created" + echo "automatically via thermite.sh." + return 0 } @@ -154,8 +143,8 @@ main() { pfx="===" + delete_only=1 zfs_teardown - zfs_setup } main "$@"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003111959.02BJxTZR079134>