summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2021-09-09 15:00:01 +0000
committermartin <martin@NetBSD.org>2021-09-09 15:00:01 +0000
commit7ca7bfbcf0a42189e3d7b47aed832e5b874034f9 (patch)
treecb3e9118333bc4327cd4b4132f841b8e28b841d1 /build.sh
parent40ffcc0e00ecf4eaed311f255abaa3428c7987d1 (diff)
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 (limited to 'build.sh')
-rwxr-xr-xbuild.sh23
1 files changed, 19 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index fb13abdcca1..bdda43c961e 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.355 2021/08/29 09:02:01 christos Exp $
+# $NetBSD: build.sh,v 1.356 2021/09/09 15:00:01 martin Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1071,6 +1071,8 @@ Usage: ${progname} [-EhnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras]
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]
@@ -1366,7 +1368,12 @@ parseoptions()
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=*)
@@ -1965,7 +1972,7 @@ createmakewrapper()
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.355 2021/08/29 09:02:01 christos Exp $
+# Generated from: \$NetBSD: build.sh,v 1.356 2021/09/09 15:00:01 martin Exp $
# with these arguments: ${_args}
#
@@ -2294,9 +2301,14 @@ repro_date() {
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
@@ -2343,7 +2355,10 @@ setup_mkrepro()
done
[ "${MKREPRO_TIMESTAMP}" != "0" ] || bomb "Failed to compute timestamp"
- statusmsg2 "MKREPRO_TIMESTAMP" "$(repro_date "${MKREPRO_TIMESTAMP}")"
+ if [ -z "${quiet}" ]; then
+ statusmsg2 "MKREPRO_TIMESTAMP" \
+ "$(repro_date "${MKREPRO_TIMESTAMP}")"
+ fi
export MKREPRO MKREPRO_TIMESTAMP
}