Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add a new operation "mkrepro-timestamp" to extract the times...



details:   https://anonhg.NetBSD.org/src/rev/7b064ade3d90
branches:  trunk
changeset: 1023469:7b064ade3d90
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Sep 09 15:00:01 2021 +0000

description:
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 |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (69 lines):

diff -r 4e0693ea758e -r 7b064ade3d90 build.sh
--- a/build.sh  Thu Sep 09 13:22:50 2021 +0000
+++ b/build.sh  Thu Sep 09 15:00:01 2021 +0000
@@ -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 @@
     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 @@
 
                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 @@
        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 @@
 
 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 @@
        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
 }
 



Home | Main Index | Thread Index | Old Index