From 29b282f31d7388dfd9806fd1a0df8c37784482d8 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 16 Jul 2020 20:34:26 +0000 Subject: [PATCH 01/12] Makefile.inc1: - New file. Adds logic to search for the git binary, as well as determining the branch and revision, used in various places. Makefile: - Remove searching for the svn{,lite} binary. Makefile.ec2: - Reduce duplicated code, removing searching for the svn{,lite} binary, in addition to EC2_SVN{BRANCH,REV}. - Rename EC2_SVN* with GIT* for consistency. Makefile.mirrors: - Remove the SRCBRANCH declaration, replaced with the exported GITBRANCH variable. - Update _SNAP_SUFFIX from SVNREVISION to GITREV, and remove the leading 'r' from it, since it will break git hashes. - Remove yet another instance of duplicated code to search for the svn{,version}lite binary. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/Makefile | 11 +---------- release/Makefile.ec2 | 28 ++-------------------------- release/Makefile.inc1 | 25 +++++++++++++++++++++++++ release/Makefile.mirrors | 27 +++++---------------------- 4 files changed, 33 insertions(+), 58 deletions(-) create mode 100644 release/Makefile.inc1 diff --git a/release/Makefile b/release/Makefile index 4c4c3de5926..2e828469ed2 100644 --- a/release/Makefile +++ b/release/Makefile @@ -90,15 +90,6 @@ EXTRA_PACKAGES+= src.txz .endif .if !defined(NODOC) EXTRA_PACKAGES+= reldoc -. if !defined(SVN) || empty(SVN) -. for S in svn svnlite -. for D in /usr/local/bin /usr/bin -. if(exists(${D}/${S})) -SVN?= ${D}/${S} -. endif -. endfor -. endfor -. endif .endif RELEASE_TARGETS= ftp @@ -173,7 +164,6 @@ ports.txz: reldoc: cd ${DOCDIR}/en_US.ISO8859-1/htdocs/releases/${REVISION}R && \ env MAN4DIR=${WORLDDIR}/share/man/man4 \ - SVN=${SVN} \ _BRANCH=${BRANCH} \ ${MAKE} all install clean "FORMATS=html txt" \ INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc \ @@ -336,4 +326,5 @@ release-install: cd ${DESTDIR} && sha512 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA512 cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 +.include "${.CURDIR}/Makefile.inc1" .include "${.CURDIR}/Makefile.vm" diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index d35f166a03d..740edc76cbf 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -5,30 +5,6 @@ # Makefile for creating an EC2 AMI from a disk image. # -# Figure out where SVN is -.if !defined(SVN_CMD) || empty(SVN_CMD) -. for _P in /usr/bin /usr/local/bin -. for _S in svn svnlite -. if exists(${_P}/${_S}) -SVN_CMD= ${_P}/${_S} -. endif -. endfor -. endfor -.endif -.if exists(${SRCTOP}/.svn) -. if empty(EC2_SVNBRANCH) - EC2_SVNBRANCH!= ${SVN_CMD} info --show-item relative-url ${WORLDDIR} 2>/dev/null | sed -e 's/\^\///' -. export EC2_SVNBRANCH -. endif -. if empty(EC2_SVNREV) - EC2_SVNREV!= ${SVN_CMD} info --show-item last-changed-revision ${WORLDDIR} 2>/dev/null || true -. export EC2_SVNREV -. endif -.else -EC2_SVNBRANCH= unknown -EC2_SVNREV= unknown -.endif - .if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE" AMINAMESUFFIX!= date +-%Y-%m-%d .endif @@ -40,7 +16,7 @@ PUBLICSNAP= --publicsnap .endif .if defined(EC2SNSTOPIC) && !empty(EC2SNSTOPIC) EC2SNSREL= ${REVISION}-${BRANCH} -EC2SNSVERS= ${EC2_SVNBRANCH}@${EC2_SVNREV} +EC2SNSVERS= ${GITBRANCH}@${GITREV} .endif .if ${TARGET_ARCH} != "amd64" EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} @@ -89,7 +65,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} ${EC2ARCH} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ - "${TYPE}/${TARGET} ${EC2_SVNBRANCH}@${EC2_SVNREV}" \ + "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \ ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} \ ${EC2SNSTOPIC} ${EC2SNSREL} ${EC2SNSVERS} @touch ${.TARGET} diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 new file mode 100644 index 00000000000..c8426f2cba3 --- /dev/null +++ b/release/Makefile.inc1 @@ -0,0 +1,25 @@ +# +# $FreeBSD$ +# + +# Figure out where the git binary is. +.if !defined(GIT_CMD) || empty(GIT_CMD) +. for _P in /usr/bin /usr/local/bin +. if exists(${_P}/git) +GIT_CMD= ${_P}/git +. endif +. endfor +. export GIT_CMD +.else +. error "Git binary not found. Set GIT_CMD appropriately." +.endif + +# Set the git branch and hash to export where needed. +.if !defined(GITBRANCH) || empty(GITBRANCH) +GITBRANCH!= ${GIT_CMD} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' +.export GITBRANCH +.endif +.if !defined(GITREV) || empty(GITREV) +GITREV!= ${GIT_CMD} rev-parse --verify --short HEAD 2>/dev/null || true +.export GITREV +.endif diff --git a/release/Makefile.mirrors b/release/Makefile.mirrors index 6857ff0eafb..5ce952fce27 100644 --- a/release/Makefile.mirrors +++ b/release/Makefile.mirrors @@ -19,7 +19,6 @@ FTPDIR?= ${RELEASEDIR}/ftp-stage .if exists(${RELEASEDIR}) STAGE_TARGETS?= iso-images-stage .endif -SRCBRANCH!= ${SVN_CMD} info --show-item relative-url ${WORLDDIR} .if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || (defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD)) . if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" @@ -31,26 +30,10 @@ EMBEDDED= 1 .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" || ${BRANCH:MALPHA*} != "" SNAPSHOT= 1 TLD?= ${FTPDIR}/snapshots -. if !defined(SVNREVISION) || empty(SVNREVISION) -. for _D in /usr/bin /usr/local/bin -. for _S in svnversion svnliteversion -. if exists(${_D}/${_S}) -SVNVERSION?= ${_D}/${_S} -. endif -. endfor -. endfor -. if exists(${SVNVERSION}) && !empty(SVNVERSION) -SVNREVISION!= ${SVNVERSION} ${WORLDDIR}/Makefile -. endif -. endif # !defined(SVNREVISION) -. if !defined(BUILDDATE) || empty(BUILDDATE) -. if exists(${.CURDIR}/${.OBJDIR}/dist/base/bin/sh) -BUILDDATE!= cd ${.CURDIR} && date -j -f '%s' $$(stat -f "%c" ${.OBJDIR}/dist/base/bin/sh) +%Y%m%d -. else +.if !defined(BUILDDATE) || empty(BUILDDATE) BUILDDATE!= date +%Y%m%d -. endif -. endif -_SNAP_SUFFIX:= ${BUILDDATE}-r${SVNREVISION} +.endif +_SNAP_SUFFIX:= ${BUILDDATE}-${GITREV} .else # release SNAPSHOT= @@ -187,8 +170,8 @@ iso-images-stage: mkdir -p ${FTP_DIR} cp -p ${RELEASEDIR}/ftp/*.txz ${RELEASEDIR}/ftp/MANIFEST ${FTP_DIR} echo ${BUILDDATE} > ${FTP_DIR}/BUILDDATE - echo ${SRCBRANCH} > ${FTP_DIR}/SRCBRANCH - echo r${SVNREVISION} > ${FTP_DIR}/REVISION + echo ${GITBRANCH} > ${FTP_DIR}/GITBRANCH + echo ${GITREV} > ${FTP_DIR}/REVISION cd ${TLD}/${TARGET} && \ ln -s ${TARGET_ARCH}/${REVISION}-${BRANCH} \ ${REVISION}-${BRANCH} From ff1031c1b7ddbcf84bfb2982d8aea1746fb0d66b Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 16 Jul 2020 20:36:22 +0000 Subject: [PATCH 02/12] Add GIT_CMD, similar to SVN_CMD. Sponsored by: Rubicon Communications, LLC (netgate.com) --- Makefile.inc1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 805a42befb4..6b3e7c849f6 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -478,6 +478,14 @@ SVN_CMD= ${_P}/${_S} . endfor .export SVN_CMD .endif +.if !defined(GIT_CMD) || empty(GIT_CMD) +. for _P in /usr/bin /usr/local/bin +. if exists(${_P}/git) +GIT_CMD= ${_P}/git +. endif +. endfor +.export GIT_CMD +.endif SVNFLAGS?= -r HEAD .if !defined(VCS_REVISION) || empty(VCS_REVISION) .if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) From 40056899f641d741d8c0c71161ffa665f4502af3 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 16 Jul 2020 20:44:04 +0000 Subject: [PATCH 03/12] Move GIT_CMD a few lines down, so it is not in between SVN_* lines. Sponsored by: Rubicon Communications, LLC (netgate.com) --- Makefile.inc1 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 6b3e7c849f6..b604465c272 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -478,14 +478,6 @@ SVN_CMD= ${_P}/${_S} . endfor .export SVN_CMD .endif -.if !defined(GIT_CMD) || empty(GIT_CMD) -. for _P in /usr/bin /usr/local/bin -. if exists(${_P}/git) -GIT_CMD= ${_P}/git -. endif -. endfor -.export GIT_CMD -.endif SVNFLAGS?= -r HEAD .if !defined(VCS_REVISION) || empty(VCS_REVISION) .if !defined(SVNVERSION_CMD) || empty(SVNVERSION_CMD) @@ -505,6 +497,15 @@ VCS_REVISION= $$(echo r${_VCS_REVISION}) .export VCS_REVISION .endif +.if !defined(GIT_CMD) || empty(GIT_CMD) +. for _P in /usr/bin /usr/local/bin +. if exists(${_P}/git) +GIT_CMD= ${_P}/git +. endif +. endfor +.export GIT_CMD +.endif + .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ From 66fe2bef957566358732720d66971e0813439243 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Fri, 31 Jul 2020 19:31:52 +0000 Subject: [PATCH 04/12] release: update to use git instead of svn: release.sh: - Bump the version number. - Default VCSCMD to '/usr/local/bin/git clone'. - Rename SVN* variables to GIT* equivalents. - Remove dead code to inject a trailing '/' between two variables. - Remove SRC_FORCE_CHECKOUT. - Exit if the build host does not have devel/git installed. - Install devel/git in the build chroot(8) for newvers.sh. release.conf.sample: - Update sample configuration variables to the git equivalent. relnotes-search.sh: - Remove script. It is specifically for use with svn. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.conf.sample | 24 +++--- release/release.sh | 81 ++++++++++-------- release/scripts/relnotes-search.sh | 133 ----------------------------- 3 files changed, 54 insertions(+), 184 deletions(-) delete mode 100755 release/scripts/relnotes-search.sh diff --git a/release/release.conf.sample b/release/release.conf.sample index d4843a90cc0..23de28670a8 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -12,23 +12,19 @@ ## Set the directory within which the release will be built. CHROOTDIR="/scratch" -## Set the svn host. -SVNROOT="svn://svn.FreeBSD.org/" +## Set the version control system host. +GITROOT="https://cgit-beta.freebsd.org/" +GITSRC="src.git" +GITPORTS="ports.git" +GITDOC="doc.git" ## Set the src/, ports/, and doc/ branches or tags. -SRCBRANCH="base/head@rHEAD" -DOCBRANCH="doc/head@rHEAD" -PORTBRANCH="ports/head@rHEAD" +SRCBRANCH="main" +DOCBRANCH="main" +PORTBRANCH="main" -## Run svn co --force for src checkout. -#SRC_FORCE_CHECKOUT=yes - -## Sample configuration for using git instead of svn. -#VCSCMD="/usr/local/bin/git clone --branch master" -#SVNROOT="" -#SRCBRANCH="https://github.com/freebsd/freebsd" -#DOCBRANCH="https://github.com/freebsd/freebsd-doc" -#PORTBRANCH="https://github.com/freebsd/freebsd-ports" +## Sample configuration for using git from ports. +#GITCMD="/usr/local/bin/git clone --branch main" ## Set to override the default target architecture. #TARGET="amd64" diff --git a/release/release.sh b/release/release.sh index c7ae9959e7d..160a5e4aaf6 100755 --- a/release/release.sh +++ b/release/release.sh @@ -38,7 +38,7 @@ export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" -VERSION=2 +VERSION=3 # Prototypes that can be redefined per-chroot or per-target. load_chroot_env() { } @@ -51,7 +51,7 @@ usage() { } # env_setup(): Set up the default build environment variables, such as the -# CHROOTDIR, VCSCMD, SVNROOT, etc. This is called before the release.conf +# CHROOTDIR, VCSCMD, GITROOT, etc. This is called before the release.conf # file is sourced, if '-c ' is specified. env_setup() { # The directory within which the release will be built. @@ -60,27 +60,29 @@ env_setup() { # The default version control system command to obtain the sources. for _dir in /usr/bin /usr/local/bin; do - for _svn in svn svnlite; do - [ -x "${_dir}/${_svn}" ] && VCSCMD="${_dir}/${_svn}" - [ ! -z "${VCSCMD}" ] && break 2 - done + [ -x "${_dir}/git" ] && VCSCMD="/${_dir}/git" + [ ! -z "${VCSCMD}" ] && break 2 done - VCSCMD="${VCSCMD} checkout" - # The default svn checkout server, and svn branches for src/, doc/, + if [ -z "${VCSCMD}" ]; then + echo "*** The devel/git port/package is required." + exit 1 + fi + VCSCMD="/usr/local/bin/git clone" + + # The default git checkout server, and branches for src/, doc/, # and ports/. - SVNROOT="svn://svn.FreeBSD.org/" - SRCBRANCH="base/head@rHEAD" - DOCBRANCH="doc/head@rHEAD" - PORTBRANCH="ports/head@rHEAD" + GITROOT="https://cgit-beta.FreeBSD.org/" + SRCBRANCH="main" + DOCBRANCH="main" + PORTBRANCH="main" + GITSRC="src.git" + GITPORTS="ports.git" + GITDOC="doc.git" # Set for embedded device builds. EMBEDDEDBUILD= - # Sometimes one needs to checkout src with --force svn option. - # If custom kernel configs copied to src tree before checkout, e.g. - SRC_FORCE_CHECKOUT= - # The default make.conf and src.conf to use. Set to /dev/null # by default to avoid polluting the chroot(8) environment with # non-default settings. @@ -128,20 +130,11 @@ env_setup() { # in env_setup() if '-c ' is specified. env_check() { chroot_build_release_cmd="chroot_build_release" - # Fix for backwards-compatibility with release.conf that does not have - # the trailing '/'. - case ${SVNROOT} in - *svn*) - SVNROOT="${SVNROOT}/" - ;; - *) - ;; - esac - # Prefix the branches with the SVNROOT for the full checkout URL. - SRCBRANCH="${SVNROOT}${SRCBRANCH}" - DOCBRANCH="${SVNROOT}${DOCBRANCH}" - PORTBRANCH="${SVNROOT}${PORTBRANCH}" + # Prefix the branches with the GITROOT for the full checkout URL. + SRC="${GITROOT}${GITSRC}" + DOC="${GITROOT}${GITDOC}" + PORT="${GITROOT}${GITPORTS}" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= @@ -187,11 +180,6 @@ env_check() { else ARCH_FLAGS= fi - # Force src checkout if configured - FORCE_SRC_KEY= - if [ -n "${SRC_FORCE_CHECKOUT}" ]; then - FORCE_SRC_KEY="--force" - fi if [ -z "${CHROOTDIR}" ]; then echo "Please set CHROOTDIR." @@ -231,13 +219,13 @@ chroot_setup() { mkdir -p ${CHROOTDIR}/usr if [ -z "${SRC_UPDATE_SKIP}" ]; then - ${VCSCMD} ${FORCE_SRC_KEY} ${SRCBRANCH} ${CHROOTDIR}/usr/src + ${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src fi if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then - ${VCSCMD} ${DOCBRANCH} ${CHROOTDIR}/usr/doc + ${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc fi if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then - ${VCSCMD} ${PORTBRANCH} ${CHROOTDIR}/usr/ports + ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports fi if [ -z "${CHROOTBUILD_SKIP}" ]; then @@ -274,6 +262,25 @@ extra_chroot_setup() { cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF} fi + # Install git from ports or packages if the ports tree is + # available and VCSCMD is unset. + if [ -d ${CHROOTDIR}/usr/ports ]; then + # Trick the ports 'run-autotools-fixup' target to do the right + # thing. + _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) + REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) + BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) + UNAME_r=${REVISION}-${BRANCH} + GITUNSETOPTS="CONTRIB CURL CVS GITWEB GUI HTMLDOCS" + GITUNSETOPTS="${GITUNSETOPTS} ICONV NLS P4 PERL" + GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN" + GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2" + eval chroot ${CHROOTDIR} env OPTIONS_UNSET="${GITUNSETOPTS}" \ + make -C \ /usr/ports/devel/git FORCE_PKG_REGISTER=1 \ + WRKDIRPREFIX=/tmp/ports \ + DISTDIR=/tmp/distfiles \ + install clean distclean + fi if [ -d ${CHROOTDIR}/usr/ports ]; then # Trick the ports 'run-autotools-fixup' target to do the right # thing. diff --git a/release/scripts/relnotes-search.sh b/release/scripts/relnotes-search.sh deleted file mode 100755 index 895f3998f8a..00000000000 --- a/release/scripts/relnotes-search.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh -#- -# Copyright (c) 2014 The FreeBSD Foundation -# All rights reserved. -# -# This software were developed by Glen Barber -# under sponsorship from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -set -C - -PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" -export PATH - -usage() { - echo "Usage:" - echo -n "$(basename ${0}) [-rNNNNNN]" - echo " [-l /path/for/output] /path/to/branch" - echo " -r: The oldest commit to include in the search" - echo "" - exit 1 -} - -main() { - while getopts "l:r:" arg ; do - case ${arg} in - l) - # Disallow '-rNNNNNN' argument for oldest - # revision # from becoming the log file - # accidentally. - where="${OPTARG##-r*}" - [ -z "${where}" ] && usage - if [ -e "${where}" ]; then - echo "Log file already exists:" - echo " (${where})" - return 2 - fi - ;; - r) - rev="${OPTARG##-r}" - c=$(echo -n ${rev} | tr -d '0-9' | wc -c) - if [ ${c} -ne 0 ]; then - echo "Revision number must be numeric." - return 2 - fi - # Since the last specified revision is - # specified, mangle the variable to - # make svn syntax happy. - rev="-r${rev}:rHEAD" - ;; - *) - usage - ;; - esac - done - shift $(( ${OPTIND} - 1 )) - - # This assumes a local working copy, which svn search - # allows exactly one repository path (although the root - # can still be the path). - [ "$#" -ne 1 ] && usage - - # If no log file, write to stdout. - [ -z "${where}" ] && where=/dev/stdout - - svn= - # Where is svn? - for s in /usr/bin /usr/local/bin; do - if [ -x ${s}/svn ]; then - svn=${s}/svn - break - fi - if [ -x ${s}/svnlite ]; then - svn=${s}/svnlite - break - fi - done - # Did we find svn? - if [ -z "${svn}" ]; then - echo "svn(1) binary not found." - return 2 - fi - # Is more than one path specified? (This should never - # be triggered, because the argument count is checked - # above, but better safe than sorry.) - if [ $# -gt 1 ]; then - echo "Cannot specify more than one working path." - return 2 - fi - # Does the directory exist? - if [ ! -d "${1}" ]; then - echo "Specified path (${1}) is not a directory." - return 2 - fi - # Is it a subversion repository checkout? - ${svn} info ${1} >/dev/null 2>&1 - if [ "$?" -ne 0 ]; then - echo "Cannot determine svn repository information for ${1}" - return 2 - fi - - # All tests passed. Let's see what can possibly go wrong - # from here. The search string specified should match this - # in PCRE speak: ':[\t ]*' - ${svn} log ${rev} --search 'Relnotes:*[A-Za-z0-9]*' ${1} > ${where} - return $? -} - -main "${@}" -exit $? From 86e5b1377db87223c20aefbc5bf61c56422d6c8f Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Wed, 12 Aug 2020 16:25:25 +0000 Subject: [PATCH 05/12] release: update to use git instead of svn: Makefile.* (cloudware): - Consistify setting the BUILDDATE for snapshots. release.conf.sample/release.sh: - Run 'git clone' in 'quiet' mode. Makefile.inc1: - Set BUILDDATE and export the variable. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/Makefile.azure | 2 +- release/Makefile.ec2 | 2 +- release/Makefile.gce | 3 +-- release/Makefile.inc1 | 6 ++++++ release/release.conf.sample | 2 +- release/release.sh | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/release/Makefile.azure b/release/Makefile.azure index 12fd3484291..de95a944f9c 100644 --- a/release/Makefile.azure +++ b/release/Makefile.azure @@ -17,7 +17,7 @@ AZURE${VAR}!= grep -E ^AZURE${VAR} ${AZURE_UPLOAD_CONF} | awk -F' ' '{print $$2} .endif .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" -SNAPSHOT_DATE!= date +-%Y-%m-%d +SNAPSHOT_DATE!= date +-${BUILDDATE} .endif AZURE_TARGET:= ${OSRELEASE}${SNAPSHOT_DATE}.vhd diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index 740edc76cbf..63552494db9 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -6,7 +6,7 @@ # .if ${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE" -AMINAMESUFFIX!= date +-%Y-%m-%d +AMINAMESUFFIX!= date +-${BUILDDATE} .endif .if defined(EC2PUBLIC) && !empty(EC2PUBLIC) PUBLISH= --public diff --git a/release/Makefile.gce b/release/Makefile.gce index e466f9a323b..106804de61e 100644 --- a/release/Makefile.gce +++ b/release/Makefile.gce @@ -24,8 +24,7 @@ GCE_FAMILY= ${TYPE:tl}-${REVISION:S,.,-,} .endif .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" -_SNAPSHOT_DATE!= date +%Y%m%d -SNAPSHOT_DATE= -v${_SNAPSHOT_DATE} +SNAPSHOT_DATE= -v${BUILDDATE} GCE_FAMILY_SUFX= -snap .endif diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index c8426f2cba3..7d46f79adab 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -23,3 +23,9 @@ GITBRANCH!= ${GIT_CMD} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\// GITREV!= ${GIT_CMD} rev-parse --verify --short HEAD 2>/dev/null || true .export GITREV .endif + +# Set the build date, primarily for snapshot builds. +.if !defined(BUILDDATE) || empty(BUILDDATE) +BUILDDATE!= date +%Y%m%d +.export BUILDDATE +.endif diff --git a/release/release.conf.sample b/release/release.conf.sample index 23de28670a8..260c8c37227 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -24,7 +24,7 @@ DOCBRANCH="main" PORTBRANCH="main" ## Sample configuration for using git from ports. -#GITCMD="/usr/local/bin/git clone --branch main" +#GITCMD="/usr/local/bin/git clone -q --branch main" ## Set to override the default target architecture. #TARGET="amd64" diff --git a/release/release.sh b/release/release.sh index 160a5e4aaf6..d10b6aa2bd1 100755 --- a/release/release.sh +++ b/release/release.sh @@ -68,7 +68,7 @@ env_setup() { echo "*** The devel/git port/package is required." exit 1 fi - VCSCMD="/usr/local/bin/git clone" + VCSCMD="/usr/local/bin/git clone -q" # The default git checkout server, and branches for src/, doc/, # and ports/. From 0a459a714f4977f27679b5727bbdf1d63a181896 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Wed, 12 Aug 2020 16:30:33 +0000 Subject: [PATCH 06/12] release: update to use git instead of svn: Makefile.* (cloudware): - Consistify setting the BUILDDATE for snapshots. (Missed a spot) Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/Makefile.vagrant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/Makefile.vagrant b/release/Makefile.vagrant index 9048279821f..4abcaa891ed 100644 --- a/release/Makefile.vagrant +++ b/release/Makefile.vagrant @@ -29,7 +29,7 @@ ATLAS${VAR}:= ${VAGRANT${VAR}} .endif .if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE" -SNAPSHOT_DATE!= date +-%Y%m%d +SNAPSHOT_DATE!= date +-${BUILDDATE} .endif VAGRANT_VERSION!= date +%Y.%m.%d From 64f0728e670f15202dd2390bc33d0ea5c55fbd97 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Mon, 24 Aug 2020 19:00:57 +0000 Subject: [PATCH 07/12] Remove an escape that does not belong. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index d10b6aa2bd1..d7320b81a6c 100755 --- a/release/release.sh +++ b/release/release.sh @@ -276,7 +276,7 @@ extra_chroot_setup() { GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN" GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2" eval chroot ${CHROOTDIR} env OPTIONS_UNSET="${GITUNSETOPTS}" \ - make -C \ /usr/ports/devel/git FORCE_PKG_REGISTER=1 \ + make -C /usr/ports/devel/git FORCE_PKG_REGISTER=1 \ WRKDIRPREFIX=/tmp/ports \ DISTDIR=/tmp/distfiles \ install clean distclean From 2b65ed0302f8339db05640c6ee2bed16458c6e4b Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Tue, 25 Aug 2020 18:30:12 +0000 Subject: [PATCH 08/12] Fix the current working directory when setting GITREV and GITBRANCH. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/Makefile.inc1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index 7d46f79adab..3f650f86365 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -16,11 +16,11 @@ GIT_CMD= ${_P}/git # Set the git branch and hash to export where needed. .if !defined(GITBRANCH) || empty(GITBRANCH) -GITBRANCH!= ${GIT_CMD} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' +GITBRANCH!= cd ${.CURDIR} && ${GIT_CMD} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' .export GITBRANCH .endif .if !defined(GITREV) || empty(GITREV) -GITREV!= ${GIT_CMD} rev-parse --verify --short HEAD 2>/dev/null || true +GITREV!= cd ${.CURDIR} && ${GIT_CMD} rev-parse --verify --short HEAD 2>/dev/null || true .export GITREV .endif From bee3d446c4cd1c4317918c407551f3c197ff17db Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 27 Aug 2020 13:25:24 +0000 Subject: [PATCH 09/12] Fix passing OPTIONS_UNSET with multiple options to make(1). While here, adjust the copyright. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/release.sh b/release/release.sh index d7320b81a6c..185a7d08c23 100755 --- a/release/release.sh +++ b/release/release.sh @@ -1,6 +1,7 @@ #!/bin/sh #- -# Copyright (c) 2013-2018 The FreeBSD Foundation +# Copyright (c) 2020 Rubicon Communications, LLC (netgate.com) +# Copyright (c) 2013-2019 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. @@ -275,7 +276,7 @@ extra_chroot_setup() { GITUNSETOPTS="${GITUNSETOPTS} ICONV NLS P4 PERL" GITUNSETOPTS="${GITUNSETOPTS} SEND_EMAIL SUBTREE SVN" GITUNSETOPTS="${GITUNSETOPTS} PCRE PCRE2" - eval chroot ${CHROOTDIR} env OPTIONS_UNSET="${GITUNSETOPTS}" \ + eval chroot ${CHROOTDIR} env OPTIONS_UNSET=\"${GITUNSETOPTS}\" \ make -C /usr/ports/devel/git FORCE_PKG_REGISTER=1 \ WRKDIRPREFIX=/tmp/ports \ DISTDIR=/tmp/distfiles \ From 6e7be14e7f1f2e1fbb6322d016b8a0ab062578e6 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 27 Aug 2020 13:33:21 +0000 Subject: [PATCH 10/12] Adjust the logic to locating GIT_CMD. Use 'git -C' instead of cd(1). [1] Suggested by: garga [1] Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/Makefile.inc1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index 3f650f86365..8fd38b966bd 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -3,24 +3,24 @@ # # Figure out where the git binary is. -.if !defined(GIT_CMD) || empty(GIT_CMD) -. for _P in /usr/bin /usr/local/bin +.for _P in /usr/bin /usr/local/bin +. if !defined(GIT_CMD) || empty(GIT_CMD) . if exists(${_P}/git) GIT_CMD= ${_P}/git . endif -. endfor -. export GIT_CMD -.else +. endif +.endfor +.if !defined(GIT_CMD) && empty(GIT_CMD) . error "Git binary not found. Set GIT_CMD appropriately." .endif # Set the git branch and hash to export where needed. .if !defined(GITBRANCH) || empty(GITBRANCH) -GITBRANCH!= cd ${.CURDIR} && ${GIT_CMD} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' +GITBRANCH!= ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' .export GITBRANCH .endif .if !defined(GITREV) || empty(GITREV) -GITREV!= cd ${.CURDIR} && ${GIT_CMD} rev-parse --verify --short HEAD 2>/dev/null || true +GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true .export GITREV .endif From eade35355142bdca47a168c7ef5f7ea766467fe7 Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 27 Aug 2020 14:29:06 +0000 Subject: [PATCH 11/12] Do not unconditionally build git from ports if it already exists. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index 185a7d08c23..47b868dbcf9 100755 --- a/release/release.sh +++ b/release/release.sh @@ -265,7 +265,8 @@ extra_chroot_setup() { # Install git from ports or packages if the ports tree is # available and VCSCMD is unset. - if [ -d ${CHROOTDIR}/usr/ports ]; then + _gitcmd="$(which git)" + if [ -d ${CHROOTDIR}/usr/ports -a ! -z "${_gitcmd}" ]; then # Trick the ports 'run-autotools-fixup' target to do the right # thing. _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) From 884ea3e64c0a97daa17fa6d372dca8be0ac5b11b Mon Sep 17 00:00:00 2001 From: Glen Barber Date: Thu, 27 Aug 2020 14:36:00 +0000 Subject: [PATCH 12/12] Correct the conditional evaluating if git exists. Pointyhat to: gjb (myself) Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index 47b868dbcf9..13ea5526e44 100755 --- a/release/release.sh +++ b/release/release.sh @@ -266,7 +266,7 @@ extra_chroot_setup() { # Install git from ports or packages if the ports tree is # available and VCSCMD is unset. _gitcmd="$(which git)" - if [ -d ${CHROOTDIR}/usr/ports -a ! -z "${_gitcmd}" ]; then + if [ -d ${CHROOTDIR}/usr/ports -a -z "${_gitcmd}" ]; then # Trick the ports 'run-autotools-fixup' target to do the right # thing. _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)