Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src Pull up following revision(s) (requested by martin in tic...
details: https://anonhg.NetBSD.org/src/rev/9fdd294eb940
branches: netbsd-9
changeset: 985915:9fdd294eb940
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Sep 14 02:21:34 2021 +0000
description:
Pull up following revision(s) (requested by martin in ticket #1345):
build.sh: revision 1.348
build.sh: revision 1.349
build.sh: revision 1.350
build.sh: revision 1.351
build.sh: revision 1.352
build.sh: revision 1.356
ignore cvslatest errors in expert mode
Handle git and mercurial for reproducible builds.
for mercurial, use the latest revision instead of limiting the output to 1
(requested by joerg)
handle different flavors of date(1)
kre@ does not like the subshell :-)
Add a new operation "mkrepro-timestamp" to extract the timestamp a
build with -P would use. Example usage:
./build.sh -T /usr/tools -P mkrepro-timestamp
This allows us to extract this information once, make other use of it,
and replicate it on other machines with -V MKREPRO=yes -V MKREPRO_TIMESTAMP=..
diffstat:
build.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 62 insertions(+), 6 deletions(-)
diffs (117 lines):
diff -r dea554ac8ae5 -r 9fdd294eb940 build.sh
--- a/build.sh Fri Sep 10 07:50:49 2021 +0000
+++ b/build.sh Tue Sep 14 02:21:34 2021 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.333 2019/06/07 15:49:20 sborrill Exp $
+# $NetBSD: build.sh,v 1.333.2.1 2021/09/14 02:21:34 msaitoh Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1077,6 +1077,8 @@
list-arch Display a list of valid MACHINE/MACHINE_ARCH values,
and exit. The list may be narrowed by passing glob
patterns or exact values in MACHINE or MACHINE_ARCH.
+ mkrepro-timestamp Show the latest source timestamp used for reproducable
+ builds and exit. Requires -P or -V MKREPRO=yes.
Options:
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
@@ -1351,7 +1353,12 @@
list-arch)
listarch "${MACHINE}" "${MACHINE_ARCH}"
- exit $?
+ exit
+ ;;
+ mkrepro-timestamp)
+ setup_mkrepro quiet
+ echo ${MKREPRO_TIMESTAMP:-0}
+ [ ${MKREPRO_TIMESTAMP:-0} -ne 0 ]; exit
;;
kernel=*|releasekernel=*|kernel.gdb=*)
@@ -1937,7 +1944,7 @@
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from: \$NetBSD: build.sh,v 1.333 2019/06/07 15:49:20 sborrill Exp $
+# Generated from: \$NetBSD: build.sh,v 1.333.2.1 2021/09/14 02:21:34 msaitoh Exp $
# with these arguments: ${_args}
#
@@ -2248,22 +2255,71 @@
statusmsg "Rump build&link tests successful"
}
+repro_date() {
+ # try the bsd date fail back the the linux one
+ date -u -r "$1" 2> /dev/null || date -u -d "@$1"
+}
+
setup_mkrepro()
{
+ local quiet="$1"
+
if [ ${MKREPRO-no} != "yes" ]; then
return
fi
+ if [ ${MKREPRO_TIMESTAMP-0} -ne 0 ]; then
+ return;
+ fi
+
local dirs=${NETBSDSRCDIR-/usr/src}/
if [ ${MKX11-no} = "yes" ]; then
dirs="$dirs ${X11SRCDIR-/usr/xsrc}/"
fi
+
local cvslatest=$(print_tooldir_program cvslatest)
if [ ! -x "${cvslatest}" ]; then
buildtools
fi
- MKREPRO_TIMESTAMP=$("${cvslatest}" ${dirs})
- [ -n "${MKREPRO_TIMESTAMP}" ] || bomb "Failed to compute timestamp"
- statusmsg2 "MKREPRO_TIMESTAMP" "$(TZ=UTC date -r ${MKREPRO_TIMESTAMP})"
+
+ local cvslatestflags=
+ if ${do_expertmode}; then
+ cvslatestflags=-i
+ fi
+
+ MKREPRO_TIMESTAMP=0
+ local d
+ local t
+ local vcs
+ for d in ${dirs}; do
+ if [ -d "${d}CVS" ]; then
+ t=$("${cvslatest}" ${cvslatestflags} "${d}")
+ vcs=cvs
+ elif [ -d "${d}.git" ]; then
+ t=$(cd "${d}" && git log -1 --format=%ct)
+ vcs=git
+ elif [ -d "${d}.hg" ]; then
+ t=$(cd "${d}" &&
+ hg log -r . --template '{date(date, "%s")}\n')
+ vcs=hg
+ else
+ bomb "Cannot determine VCS for '$d'"
+ fi
+
+ if [ -z "$t" ]; then
+ bomb "Failed to get timestamp for vcs=$vcs in '$d'"
+ fi
+
+ #echo "latest $d $vcs $t"
+ if [ "$t" -gt "$MKREPRO_TIMESTAMP" ]; then
+ MKREPRO_TIMESTAMP="$t"
+ fi
+ done
+
+ [ "${MKREPRO_TIMESTAMP}" != "0" ] || bomb "Failed to compute timestamp"
+ if [ -z "${quiet}" ]; then
+ statusmsg2 "MKREPRO_TIMESTAMP" \
+ "$(repro_date "${MKREPRO_TIMESTAMP}")"
+ fi
export MKREPRO MKREPRO_TIMESTAMP
}
Home |
Main Index |
Thread Index |
Old Index