From nobody Sat Oct 17 15:50:20 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j6R8s0N3fz6wLT1 for ; Sat, 17 Oct 2026 15:50:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j6R8r6ZGKz4KK8 for ; Sat, 17 Oct 2026 15:50:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792252220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8b5SLOyCGY0imFR+B5LbdP+y06NcrQw6jhCkWIbDy80=; b=YLBXZJrdhrn19+JmptWngppgA73g46VzLD+4lXjG3Ml8v0Ry71vVP2d9WgnXCNpo0uxu8x HiOixXF0ZRUMFsIZapLdQbKVaVXfk8q0ZXQ7pmjFAr+S0YSyDu3OpzPpiASn5Ja9jCOWhu Fs+XZro5Rbwr+a/HC4sOSzIxr0VPQX9pZLtkMwd2LkR1BV2BcxtVsN3CO8T68vQp2++kmB 5BTbMctTefyWgcwIV4NHvImYEKPKNtriYWPt4Q4lUUUhZ/oPu2cUelnQoU2EHHPMQ9pxgB QvPqxyKmxzxBLJuIWpLckChLJY5UEAMgcJNMxVPhavpw2af1y6SH+gR9RZflkQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792252220; b=jpZlsNUQOOZbVy/lY7uzm9LEVgtLuMMOPfdZN1xNDmmx6WNa0EQI2n0l72JklF8pMBVzyT WbGqyoLKiGyi/4h/bYWCJFoS71roMiNtEydhSjv4czgp8/Nres6ZzaTf49beQ9HGXcB8b3 QkolTVCXU4ikB1FQmgm5SjW4t2MV9mV/HFJI+hzywZwDweuf5qOmS+7VkdE+BRfWU2De1g IGbWgnteLoBKtQ8GNOjCpCB53vlGm41NkkARVuvODYAssSDuSuCacvOA6oymTH+qWyVVQo HT6WLmJHVoXFj1zmUrG21ks0Ttcj9Rl6dTJCSMcKvr/zFYn6lBNunxZbIIuhWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792252220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8b5SLOyCGY0imFR+B5LbdP+y06NcrQw6jhCkWIbDy80=; b=D0B0XjX+qdrlWyD3jDfoK9ZGiONQ947tJIZYcx4uMK/BJUiflBOWGclpPpatU5VN5M+GlE tyUI2WHsyqFiutN3m5tnCDxoUliG51HUMGv4/IudNUXDRhNEtrbH9FBMeYMCHm1umDgapu j24RZwgfJyfbh7vTsa/wRExcjAPjreGYDxmj87m5Taa96rOR0rbTUqKJfW+EPKSxIIcD12 JxmHJCyEu43juwWdWA8bcE+IaNPjWKn5dcrYEZkBiBkZ8QIln8dz4AccrnHPwIjYXQm7Ii UtZYgEQAgG2zLDg1VdISpH1k1jNpAgnIDHu9AdsLGVZL2eTAV3BWrhoDNs4J6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j6R8r6DX9z18KL for ; Sat, 17 Oct 2026 15:50:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c956 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 17 Oct 2026 15:50:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: a8be89928930 - main - build: Support got List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8be899289303c9f83813cfd96d1a62abba09685 Auto-Submitted: auto-generated Date: Sat, 17 Oct 2026 15:50:20 +0000 Message-Id: <6ad3993c.3c956.4824352d@gitrepo.freebsd.org> The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=a8be899289303c9f83813cfd96d1a62abba09685 commit a8be899289303c9f83813cfd96d1a62abba09685 Author: Colin Percival AuthorDate: 2026-10-14 01:12:07 +0000 Commit: Colin Percival CommitDate: 2026-10-17 15:50:15 +0000 build: Support got Add code for using got(1), matching how git(1) is currently used: 1. Determining the git branch, 2. Determining the checked-out hash, 3. Determining the commit count, 4. Determining the timestamp of the most recent commit, 5. Determining if the tree is "dirty", 6. Generating lists of files for the src and src-sys packages, and 7. Excluding .got directories from src.txz and ports.txz. The release engineer hopes to use this functionality in release builds, since got's minimalism makes it a far more manageable build tool than git. Reviewed by: naddy MFC after: 1 week Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D60606 --- Makefile.inc1 | 31 +++++++++++++++++++++++++++++++ release/Makefile | 4 ++-- release/Makefile.inc1 | 28 +++++++++++++++++++++++++++- sys/conf/newvers.sh | 35 +++++++++++++++++++++++++++++++++-- 4 files changed, 93 insertions(+), 5 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 7251deb11bdd..813630a372ac 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -539,6 +539,15 @@ GIT_CMD= ${_P}/git .export GIT_CMD .endif +.if !defined(GOT_CMD) || empty(GOT_CMD) +. for _P in /usr/bin /usr/local/bin +. if exists(${_P}/got) +GOT_CMD= ${_P}/got +. endif +. endfor +.export GOT_CMD +.endif + .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ @@ -606,6 +615,8 @@ PKG_WORKERS_COUNT?= 1 .if !defined(PKG_TIMESTAMP) .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD +.elif !empty(GOT_CMD) && exists(${GOT_CMD}) && exists(${SRCDIR}/.got) +SOURCE_DATE_EPOCH!= ( cd ${SRCDIR} && ${GOT_CMD} cat HEAD | awk '$$1 == "committer" { print $$(NF-1); exit }' ) .else TIMEEPOCHNOW= %s SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} @@ -2216,11 +2227,21 @@ create-packages: .PHONY create-packages-world create-packages-kernel create-pack create-source-src-package: _pkgbootstrap .PHONY rm -f ${SSTAGEDIR}/src.plist +.if ( !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) ) || \ + ( !empty(GOT_CMD) && exists(${GOT_CMD}) && exists(${SRCDIR}/.got) ) .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) @cd ${SRCDIR}; \ ( echo "@override_prefix /usr/src" ; \ ${GIT_CMD} ls-files --recurse-submodules ":!:sys/" ) \ > ${SSTAGEDIR}/src.plist +.else + @cd ${SRCDIR}; \ + ( echo "@override_prefix /usr/src" ; \ + ${GOT_CMD} tree -R | \ + awk '/^sys\// { next } { sub(/ -> .*/, "") } /\/$/ { next } { sub(/[*@$]$/, "") } { print }' | \ + sort ) \ + > ${SSTAGEDIR}/src.plist +.endif flua ${SRCDIR}/release/packages/generate-ucl.lua \ PKGNAME "src" \ PKGGENNAME "src" \ @@ -2242,11 +2263,21 @@ create-source-src-package: _pkgbootstrap .PHONY create-source-src-sys-package: _pkgbootstrap .PHONY rm -f ${SSTAGEDIR}/src-sys.plist +.if ( !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) ) || \ + ( !empty(GOT_CMD) && exists(${GOT_CMD}) && exists(${SRCDIR}/.got) ) .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) @cd ${SRCDIR}; \ ( echo "@override_prefix /usr/src" ; \ ${GIT_CMD} ls-files --recurse-submodules "sys/" ) \ > ${SSTAGEDIR}/src-sys.plist +.else + @cd ${SRCDIR}; \ + ( echo "@override_prefix /usr/src" ; \ + ${GOT_CMD} tree -R | \ + awk '!/^sys\// { next } { sub(/ -> .*/, "") } /\/$/ { next } { sub(/[*@$]$/, "") } { print }' | \ + sort ) \ + > ${SSTAGEDIR}/src-sys.plist +.endif flua ${SRCDIR}/release/packages/generate-ucl.lua \ PKGNAME "src-sys" \ PKGGENNAME "src-sys" \ diff --git a/release/Makefile b/release/Makefile index bcc640075bf0..ed0496639e28 100644 --- a/release/Makefile +++ b/release/Makefile @@ -186,7 +186,7 @@ src.txz: ln -s ${WORLDDIR} ${DISTDIR}/usr/src ( cd ${DISTDIR} && ${TAR_XZ_CMD} -cLvf ${.OBJDIR}/src.txz \ --exclude .svn --exclude .zfs \ - --exclude .git --exclude @ --exclude usr/src/release/dist \ + --exclude .git --exclude .got --exclude @ --exclude usr/src/release/dist \ --exclude usr/src/release/obj usr/src ) ports.txz: @@ -194,7 +194,7 @@ ports.txz: rm -f ${DISTDIR}/usr/ports ln -s ${PORTSDIR} ${DISTDIR}/usr/ports ( cd ${DISTDIR} && ${TAR_XZ_CMD} -cLvf ${.OBJDIR}/ports.txz \ - --exclude .git --exclude .svn \ + --exclude .git --exclude .got --exclude .svn \ --exclude usr/ports/distfiles --exclude usr/ports/packages \ --exclude 'usr/ports/INDEX*' --exclude work usr/ports ) diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index 569b72df5106..df00a24603c8 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -7,7 +7,16 @@ GIT_CMD= ${_P}/git . endif .endfor -.if !empty(GIT_CMD) && exists(${GIT_CMD}) +# Figure out where the got binary is. +.for _P in /usr/bin /usr/local/bin +. if !defined(GOT_CMD) || empty(GOT_CMD) +. if exists(${_P}/got) +GOT_CMD= ${_P}/got +. endif +. endif +.endfor + +.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${.CURDIR}/../.git) # Set the git branch and hash to export where needed. . if !defined(GITBRANCH) || empty(GITBRANCH) GITBRANCH!= ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' @@ -25,6 +34,23 @@ GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/ GITEPOCH!= ${GIT_CMD} -C ${.CURDIR} show -s --format=%ct HEAD 2>/dev/null || true . export GITEPOCH . endif +.elif !empty(GOT_CMD) && exists(${GOT_CMD}) && exists(${.CURDIR}/../.got) +. if !defined(GITBRANCH) || empty(GITBRANCH) +GITBRANCH!= ( cd ${.CURDIR} && ${GOT_CMD} branch ) +. export GITBRANCH +. endif +. if !defined(GITREV) || empty(GITREV) +GITREV!= ( cd ${.CURDIR} && ${GOT_CMD} info | awk '/^work tree base commit:/ { print $$NF; exit }' | cut -c 1-12 ) +. export GITREV +. endif +. if !defined(GITCOUNT) || empty(GITCOUNT) +GITCOUNT!= ( cd ${.CURDIR} && ${GOT_CMD} log -s | wc -l | tr -d ' ' ) +. export GITCOUNT +. endif +. if !defined(GITEPOCH) || empty(GITEPOCH) +GITEPOCH!= ( cd ${.CURDIR} && ${GOT_CMD} cat HEAD | awk '$$1 == "committer" { print $$(NF-1); exit }' ) +. export GITEPOCH +. endif .else GITBRANCH= nullbranch GITREV= nullhash diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 122bb818d2cc..ce9bcded85bc 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -182,6 +182,11 @@ git_tree_modified() ! $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c core.fileMode=off diff --quiet HEAD } +got_tree_modified() +{ + ( cd ${VCSTOP} && $got_cmd status -S '?m' | grep -q . ) +} + LC_ALL=C; export LC_ALL if [ ! -r version ] then @@ -233,6 +238,15 @@ if findvcs .gituprevision; then gituprevision="${VCSTOP}/.gituprevision" fi +if findvcs .got; then + for dir in /usr/bin /usr/local/bin; do + if [ -x "${dir}/got" ] ; then + got_cmd="${dir}/got" + break + fi + done +fi + if findvcs .hg; then for dir in /usr/bin /usr/local/bin; do if [ -x "${dir}/hg" ] ; then @@ -279,6 +293,23 @@ if [ -n "$git_cmd" ] ; then fi fi +if [ -n "$got_cmd" ] ; then + got=$(cd ${VCSTOP} && ${got_cmd} info | awk '/^work tree base commit:/ { print $NF; exit }' | cut -c 1-12 ) + got_cnt=$(cd ${VCSTOP} && ${got_cmd} log -s | wc -l) + if [ -n "$got_cnt" ] ; then + got="n$(echo ${got_cnt})-${got}" + fi + got_b=$(cd ${VCSTOP} && ${got_cmd} branch ) + if [ -n "$got_b" -a "$got_b" != "HEAD" ] ; then + got="${got_b}-${got}" + fi + if got_tree_modified; then + got="${got}-dirty" + modified=yes + fi + got=" ${got}" +fi + if [ -n "$gituprevision" ] ; then gitup=" $(awk -F: '{print $2}' $gituprevision)" fi @@ -297,10 +328,10 @@ fi [ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes if [ ${include_metadata} != "yes" ]; then - VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}" + VERINFO="${VERSION}${svn}${git}${gitup}${got}${hg} ${i}" VERSTR="${VERINFO}\\n" else - VERINFO="${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}" + VERINFO="${VERSION} #${v}${svn}${git}${gitup}${got}${hg}: ${t}" VERSTR="${VERINFO}\\n ${u}@${h}:${d}\\n" fi