Page MenuHomeFreeBSD

D60606.id189855.diff
No OneTemporary

D60606.id189855.diff

diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -539,6 +539,15 @@
.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 @@
.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-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-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
--- a/release/Makefile
+++ b/release/Makefile
@@ -186,7 +186,7 @@
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 @@
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
--- a/release/Makefile.inc1
+++ b/release/Makefile.inc1
@@ -7,7 +7,16 @@
. 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 @@
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 )
+. 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
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -182,6 +182,11 @@
! $git_cmd "--work-tree=${VCSTOP}" -c core.checkStat=minimal -c core.fileMode=off diff --quiet
}
+got_tree_modified()
+{
+ ( cd ${VCSTOP} && $got_cmd status | grep -q . )
+}
+
LC_ALL=C; export LC_ALL
if [ ! -r version ]
then
@@ -233,6 +238,15 @@
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 @@
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 @@
[ ${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

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 20, 9:37 AM (9 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41105211
Default Alt Text
D60606.id189855.diff (6 KB)

Event Timeline