annotate build-aux/get-source-mtime.sh @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
1 #! /bin/sh
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
2 #
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 # Copyright (C) 2017-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 #
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 # See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
6 # or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
7 #
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
8 #
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
9 # This file is part of Octave.
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
10 #
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24077
diff changeset
11 # Octave is free software: you can redistribute it and/or modify it
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
12 # under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24077
diff changeset
13 # the Free Software Foundation, either version 3 of the License, or
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
14 # (at your option) any later version.
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
15 #
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
16 # Octave is distributed in the hope that it will be useful, but
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
19 # GNU General Public License for more details.
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
20 #
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
21 # You should have received a copy of the GNU General Public License
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
22 # along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24077
diff changeset
23 # <https://www.gnu.org/licenses/>.
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
24
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
25 # Generate a timestamp that best represents the last modification time
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
26 # of this source tree. The time value is printed on stdout in units of
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
27 # time_t. If a reasonable representation of the source tree last
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28 # modification time can't be determined, then the current system time is
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
29 # printed instead. A valid time_t value is always printed on stdout.
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
30
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
31 set -e
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
32
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
33 PERL=${PERL:-perl}
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
34 SED=${SED:-sed}
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
35
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
36 if [ $# -ne 1 ]; then
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
37 echo "usage: get-source-mtime.sh SRCDIR" 1>&2
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
38 exit 1
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
39 fi
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
40
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
41 srcdir="$1"
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
42
25800
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
43 ## A user's ~/.hgrc may redefine or add default options to any hg subcommand,
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
44 ## potentially altering its behavior and possibly its standard output. Always
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
45 ## run hg subcommands with configuration variables set to ensure that the
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
46 ## user's preferences do not influence the expected behavior.
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
47 hg_safe ()
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
48 {
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
49 cmd=$1; shift
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
50 hg --config alias.${cmd}=${cmd} --config defaults.${cmd}= ${cmd} "$@"
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
51 }
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
52
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
53 if [ x"$SOURCE_DATE_EPOCH" != x ]; then
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
54 # Allow the source modification time to be overridden by SOURCE_DATE_EPOCH
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
55 t=$SOURCE_DATE_EPOCH
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
56 elif [ -d $srcdir/.hg ]; then
25800
7b2312def76b build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents: 25054
diff changeset
57 t=$( cd $srcdir && hg_safe log --rev . --template '{date|hgdate}' )
24077
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
58 t=$( echo $t | $SED -n 's/^\([0-9]\+\) .*/\1/p' )
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
59 elif [ -f $srcdir/HG-ID ]; then
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
60 t=$( $PERL -e '@s = stat($ARGV[0]); print($s[9]) if @s;' $srcdir/HG-ID )
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
61 elif [ -f $srcdir/configure ]; then
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
62 t=$( $PERL -e '@s = stat($ARGV[0]); print($s[9]) if @s;' $srcdir/configure )
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
63 fi
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
64
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
65 if [ x"$t" = x ]; then
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
66 t=$( date +%s )
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
67 fi
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
68
e483dcb5777d build the source distribution archives reproducibly
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
69 echo $t