From owner-svn-src-user@freebsd.org Thu Jan 7 20:36:03 2016 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A841A66586 for ; Thu, 7 Jan 2016 20:36:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37A7D1BE8; Thu, 7 Jan 2016 20:36:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u07Ka2BN035040; Thu, 7 Jan 2016 20:36:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u07Ka1Oa035034; Thu, 7 Jan 2016 20:36:01 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201601072036.u07Ka1Oa035034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 7 Jan 2016 20:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r293355 - in user/cperciva/freebsd-update-build/scripts: 10.1-RELEASE 10.1-RELEASE/amd64 10.2-RELEASE 10.2-RELEASE/amd64 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 20:36:03 -0000 Author: glebius Date: Thu Jan 7 20:36:01 2016 New Revision: 293355 URL: https://svnweb.freebsd.org/changeset/base/293355 Log: Add configuration files for 10.1-RELEASE, 10.2-RELEASE. Added: user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/ user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/amd64/ user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/amd64/build.conf (contents, props changed) user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/build.subr user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/ user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/amd64/ user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/amd64/build.conf (contents, props changed) user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/build.subr Added: user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/amd64/build.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/amd64/build.conf Thu Jan 7 20:36:01 2016 (r293355) @@ -0,0 +1,10 @@ +export RELH=0c3d64ce48c3ef761761d0fea07e1935e296f8c045c249118bc91a7faf053a6b +export FTP=https://people.freebsd.org/~gjb/10.1-RELEASE/ + +# Components of the world, source, and kernels +export WORLDPARTS="base doc games lib32" +export SOURCEPARTS="src" +export KERNELPARTS="kernel" + +# EOL date +export EOL=1483228799 Added: user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/build.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/scripts/10.1-RELEASE/build.subr Thu Jan 7 20:36:01 2016 (r293355) @@ -0,0 +1,199 @@ +# Overrides to FreeBSD Update build subroutines for FreeBSD 9.0. + +# Download and verify a release ISO image. +fetchiso () { + log "Starting fetch" + + # Figure out where the disc1 ISO image is + RELNUM=${REL%-*} +# ISO=${FTP}/${TARGET}/ISO-IMAGES/${RELNUM}/${REL}-${TARGET}-disc1.iso + ISO=${FTP}/FreeBSD-${REL}-${TARGET}-disc1.iso + + # Fetch the ISO image. We consider the ISO image to be + # the One True Release and don't look at the files used + # for FTP installs. The FreeBSD 4.7-RELEASE ISO and FTP + # files were not identical, but this should never happen + # again. + fetch -o ${WORKDIR}/iso.img -rR ${ISO} 2>&1 + + log "Verifying dvd1 hash" + + # Check that the downloaded ISO has the correct hash. + if ! [ "`sha256 -q ${WORKDIR}/iso.img`" = "${RELH}" ]; then + echo "FreeBSD ${REL}-${TARGET}-dvd1.iso has incorrect hash." + rm ${WORKDIR}/iso.img + return 1 + fi +} + +# Extract the released trees and, if appropriate, construct a world (base +# plus source code) in which to perform builds. +extractiso () { + # Create and mount a md(4) attached to the ISO image. + ISOMD=`mdconfig -a -t vnode -f ${WORKDIR}/iso.img -n` + mkdir -p ${WORKDIR}/iso + mount -t cd9660 -o ro,nosuid /dev/md${ISOMD} ${WORKDIR}/iso + + # Extract the various components into different directories + log "Extracting components" + for C in ${WORLDPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/world/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/world/${C} + done + for C in ${KERNELPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/kernel/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/kernel/${C} + done + for C in ${SOURCEPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/src/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/src/${C} + done + + # If the release ISO we're handling belongs to the platform + # we're running right now, create a world image for future use. + if [ ${TARGET} = ${HOSTPLATFORM} ]; then + log "Constructing world+src image" + + # Create directory for world + mkdir ${WORKDIR}/world/ + + # Extract world and source distributions + for C in ${WORLDPARTS}; do + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/world/ + done + for C in ${SOURCEPARTS}; do + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/world/ + done + + # build a single tarball of them. + tar -czf ${WORKDIR}/../world.tgz -C ${WORKDIR}/world . + + # clean up + nuke world + fi + + # Unmount and detach the ISO image md(4). + umount ${WORKDIR}/iso + rmdir ${WORKDIR}/iso + mdconfig -d -u ${ISOMD} +} + +# Perform a build in ${WORKDIR}/$1 with BRANCH_OVERRIDE set to $2 +buildworld () { + # We need a devfs inside the jail. Note that we are using a + # jail here in order to keep the environment as "clean" as + # possible, not for security reasons; we assume that the + # original source code plus patches we add personally will + # not do anything evil. + mount -t devfs devfs ${WORKDIR}/$1/dev + + # We need to be able to set file flags + sysctl security.jail.chflags_allowed=1 >/dev/null + + # Build stuff. + jail ${WORKDIR}/$1 ${BUILDHOSTNAME} 127.1.2.3 \ + /usr/bin/env -i PATH=${PATH} RELP=${RELP} \ + BRANCH_OVERRIDE=$2 \ + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + /bin/sh -e <<-"EOF" 2>&1 >${WORKDIR}/$1-build.log + # Function for logging what we're doing + log () { + echo "`date` $1 for FreeBSD/${TARGET} ${RELP}" 1>&2 + } + + # Build the world + log "Building world" + cd /usr/src && + make buildworld -j17 2>&1 + + # Build and kernel + log "Building kernel" + cd /usr/src && + make buildkernel -j17 2>&1 + + # Build and install release images + log "Building release" + cd /usr/src/release && + make release NODVD=y 2>&1 && + make install NODVD=y DESTDIR=/R 2>&1 + EOF + + # Put all the components into the right places. + log "Moving components into staging area" + jail ${WORKDIR}/$1 ${BUILDHOSTNAME} 127.1.2.3 \ + /usr/bin/env -i PATH=${PATH} \ + WORLDPARTS="${WORLDPARTS}" \ + KERNELPARTS="${KERNELPARTS}" \ + SOURCEPARTS="${SOURCEPARTS}" \ + /bin/sh -e <<-"EOF" 2>&1 >>${WORKDIR}/$1-build.log + # Create area for uncompressed components + mkdir -p /R/trees + + # Move world components into place + for C in ${WORLDPARTS}; do + mkdir -p /R/trees/world/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/world/${C} + done + + # Move kernel components into place + for C in ${KERNELPARTS}; do + mkdir -p /R/trees/kernel/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/kernel/${C} + done + + # Extract src components into place + for C in ${SOURCEPARTS}; do + mkdir -p /R/trees/src/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/src/${C} + done + EOF + + # Get rid of the devfs we no longer need. + umount ${WORKDIR}/$1/dev +} + +# Perform a build in ${WORKDIR}/$1, but with the date set 400 days +# into the future. Turn off NTP before we change the date and +# turn it back on afterwards. +futurebuildworld () { + # Turn off ntpd if necessary + if /etc/rc.d/ntpd status | + grep -q 'is running'; then + ntpd_was_running=1 + log "Turning off NTP" + /etc/rc.d/ntpd stop >/dev/null + else + ntpd_was_running=0 + fi + + date -n `date -j -v+400d "+%y%m%d%H%M.%S"` >/dev/null + buildworld $1 FUTUREBUILD + date -n `date -j -v-400d "+%y%m%d%H%M.%S"` >/dev/null + + # Turn ntpd back on, if appropriate + if [ ${ntpd_was_running} = 1 ]; then + log "Turning NTP back on" + /etc/rc.d/ntpd start >/dev/null + fi +} + +# Add extra docs to ${WORKDIR}/$1 +addextradocs () { + log "Extracting extra docs" + + # 8.0 doesn't have any extra docs +} + +# Fixup: the "kernel" kernel is really the "generic" kernel. +indexpublish () { + sed -E 's,kernel\|kernel,kernel|generic,' +} + Added: user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/amd64/build.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/amd64/build.conf Thu Jan 7 20:36:01 2016 (r293355) @@ -0,0 +1,10 @@ +export RELH=97908f5cd00d86cafeb2c265bfabbd0aa79f87e9b6b31ecdb756bc96a4a62e93 +export FTP=https://people.freebsd.org/~gjb/10.2-RELEASE/ + +# Components of the world, source, and kernels +export WORLDPARTS="base doc games lib32" +export SOURCEPARTS="src" +export KERNELPARTS="kernel" + +# EOL date +export EOL=1483228800 Added: user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/build.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/scripts/10.2-RELEASE/build.subr Thu Jan 7 20:36:01 2016 (r293355) @@ -0,0 +1,199 @@ +# Overrides to FreeBSD Update build subroutines for FreeBSD 9.0. + +# Download and verify a release ISO image. +fetchiso () { + log "Starting fetch" + + # Figure out where the disc1 ISO image is + RELNUM=${REL%-*} +# ISO=${FTP}/${TARGET}/ISO-IMAGES/${RELNUM}/${REL}-${TARGET}-disc1.iso + ISO=${FTP}/FreeBSD-${REL}-${TARGET}-disc1.iso + + # Fetch the ISO image. We consider the ISO image to be + # the One True Release and don't look at the files used + # for FTP installs. The FreeBSD 4.7-RELEASE ISO and FTP + # files were not identical, but this should never happen + # again. + fetch -o ${WORKDIR}/iso.img -rR ${ISO} 2>&1 + + log "Verifying dvd1 hash" + + # Check that the downloaded ISO has the correct hash. + if ! [ "`sha256 -q ${WORKDIR}/iso.img`" = "${RELH}" ]; then + echo "FreeBSD ${REL}-${TARGET}-dvd1.iso has incorrect hash." + rm ${WORKDIR}/iso.img + return 1 + fi +} + +# Extract the released trees and, if appropriate, construct a world (base +# plus source code) in which to perform builds. +extractiso () { + # Create and mount a md(4) attached to the ISO image. + ISOMD=`mdconfig -a -t vnode -f ${WORKDIR}/iso.img -n` + mkdir -p ${WORKDIR}/iso + mount -t cd9660 -o ro,nosuid /dev/md${ISOMD} ${WORKDIR}/iso + + # Extract the various components into different directories + log "Extracting components" + for C in ${WORLDPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/world/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/world/${C} + done + for C in ${KERNELPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/kernel/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/kernel/${C} + done + for C in ${SOURCEPARTS}; do + mkdir -p ${WORKDIR}/release/R/trees/src/${C} + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/release/R/trees/src/${C} + done + + # If the release ISO we're handling belongs to the platform + # we're running right now, create a world image for future use. + if [ ${TARGET} = ${HOSTPLATFORM} ]; then + log "Constructing world+src image" + + # Create directory for world + mkdir ${WORKDIR}/world/ + + # Extract world and source distributions + for C in ${WORLDPARTS}; do + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/world/ + done + for C in ${SOURCEPARTS}; do + cat ${WORKDIR}/iso/usr/freebsd-dist/${C}.txz | + tar -xpzf - -C ${WORKDIR}/world/ + done + + # build a single tarball of them. + tar -czf ${WORKDIR}/../world.tgz -C ${WORKDIR}/world . + + # clean up + nuke world + fi + + # Unmount and detach the ISO image md(4). + umount ${WORKDIR}/iso + rmdir ${WORKDIR}/iso + mdconfig -d -u ${ISOMD} +} + +# Perform a build in ${WORKDIR}/$1 with BRANCH_OVERRIDE set to $2 +buildworld () { + # We need a devfs inside the jail. Note that we are using a + # jail here in order to keep the environment as "clean" as + # possible, not for security reasons; we assume that the + # original source code plus patches we add personally will + # not do anything evil. + mount -t devfs devfs ${WORKDIR}/$1/dev + + # We need to be able to set file flags + sysctl security.jail.chflags_allowed=1 >/dev/null + + # Build stuff. + jail ${WORKDIR}/$1 ${BUILDHOSTNAME} 127.1.2.3 \ + /usr/bin/env -i PATH=${PATH} RELP=${RELP} \ + BRANCH_OVERRIDE=$2 \ + TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + /bin/sh -e <<-"EOF" 2>&1 >${WORKDIR}/$1-build.log + # Function for logging what we're doing + log () { + echo "`date` $1 for FreeBSD/${TARGET} ${RELP}" 1>&2 + } + + # Build the world + log "Building world" + cd /usr/src && + make buildworld -j17 2>&1 + + # Build and kernel + log "Building kernel" + cd /usr/src && + make buildkernel -j17 2>&1 + + # Build and install release images + log "Building release" + cd /usr/src/release && + make release NODVD=y 2>&1 && + make install NODVD=y DESTDIR=/R 2>&1 + EOF + + # Put all the components into the right places. + log "Moving components into staging area" + jail ${WORKDIR}/$1 ${BUILDHOSTNAME} 127.1.2.3 \ + /usr/bin/env -i PATH=${PATH} \ + WORLDPARTS="${WORLDPARTS}" \ + KERNELPARTS="${KERNELPARTS}" \ + SOURCEPARTS="${SOURCEPARTS}" \ + /bin/sh -e <<-"EOF" 2>&1 >>${WORKDIR}/$1-build.log + # Create area for uncompressed components + mkdir -p /R/trees + + # Move world components into place + for C in ${WORLDPARTS}; do + mkdir -p /R/trees/world/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/world/${C} + done + + # Move kernel components into place + for C in ${KERNELPARTS}; do + mkdir -p /R/trees/kernel/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/kernel/${C} + done + + # Extract src components into place + for C in ${SOURCEPARTS}; do + mkdir -p /R/trees/src/${C} + cat /R/ftp/${C}.txz | + tar -xpzf - -C /R/trees/src/${C} + done + EOF + + # Get rid of the devfs we no longer need. + umount ${WORKDIR}/$1/dev +} + +# Perform a build in ${WORKDIR}/$1, but with the date set 400 days +# into the future. Turn off NTP before we change the date and +# turn it back on afterwards. +futurebuildworld () { + # Turn off ntpd if necessary + if /etc/rc.d/ntpd status | + grep -q 'is running'; then + ntpd_was_running=1 + log "Turning off NTP" + /etc/rc.d/ntpd stop >/dev/null + else + ntpd_was_running=0 + fi + + date -n `date -j -v+400d "+%y%m%d%H%M.%S"` >/dev/null + buildworld $1 FUTUREBUILD + date -n `date -j -v-400d "+%y%m%d%H%M.%S"` >/dev/null + + # Turn ntpd back on, if appropriate + if [ ${ntpd_was_running} = 1 ]; then + log "Turning NTP back on" + /etc/rc.d/ntpd start >/dev/null + fi +} + +# Add extra docs to ${WORKDIR}/$1 +addextradocs () { + log "Extracting extra docs" + + # 8.0 doesn't have any extra docs +} + +# Fixup: the "kernel" kernel is really the "generic" kernel. +indexpublish () { + sed -E 's,kernel\|kernel,kernel|generic,' +} +