From 1862c6e57a308a05889c80c048dbc58bdc378dcb Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Jul 2022 07:51:46 +0200 Subject: Add support for reproducible builds. Suggested by Richard Purdie in . * autogen.sh: Import also lib/filename.h. * Makefile.in (IMPORTED_FILES): Add lib/filename.h. * src/options.cc: Include filename.h. (Options::print_options): Print only the base name of the program name. * tests/*.exp: Update. --- ChangeLog | 11 +++++++++++ Makefile.in | 3 ++- autogen.sh | 5 +++-- lib/.gitignore | 3 +++ src/options.cc | 11 +++++++++++ tests/c-parse.exp | 2 +- tests/charsets.exp | 2 +- tests/chill.exp | 2 +- tests/cplusplus.exp | 2 +- tests/gpc.exp | 2 +- tests/incomplete.exp | 2 +- tests/java.exp | 2 +- tests/languages.exp | 2 +- tests/modula2.exp | 2 +- tests/objc.exp | 2 +- tests/permut2.exp | 2 +- tests/permut3.exp | 2 +- tests/permutc2.exp | 2 +- tests/test-4.exp | 2 +- 19 files changed, 44 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 09280a5..8ee80b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2022-07-05 Bruno Haible + + Add support for reproducible builds. + Suggested by Richard Purdie in + . + * autogen.sh: Import also lib/filename.h. + * Makefile.in (IMPORTED_FILES): Add lib/filename.h. + * src/options.cc: Include filename.h. + (Options::print_options): Print only the base name of the program name. + * tests/*.exp: Update. + 2022-05-22 Bruno Haible Add GNU Project notice. diff --git a/Makefile.in b/Makefile.in index a49eaf2..8090db8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -67,7 +67,8 @@ SOURCE_FILES = \ IMPORTED_FILES = \ COPYING INSTALL \ build-aux/install-sh build-aux/mkinstalldirs \ - build-aux/compile build-aux/ar-lib + build-aux/compile build-aux/ar-lib \ + lib/filename.h # List of distributed files generated by autotools or Makefile.devel. GENERATED_FILES = configure # List of distributed files generated by "make". diff --git a/autogen.sh b/autogen.sh index 3643758..708767d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,7 +10,7 @@ # in a gnulib checkout, or # - an internet connection. -# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# Copyright (C) 2003-2022 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ GNULIB_REPO_URL="https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f=" for file in build-aux/install-sh build-aux/mkinstalldirs \ - build-aux/compile build-aux/ar-lib; do + build-aux/compile build-aux/ar-lib \ + lib/filename.h; do if test -n "$GNULIB_TOOL"; then $GNULIB_TOOL --copy-file $file $file else diff --git a/lib/.gitignore b/lib/.gitignore index a432aaf..bf930a7 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,3 +1,6 @@ +# Files brought in by gnulib-tool: +/filename.h + # Files generated by the autotools: /configure diff --git a/src/options.cc b/src/options.cc index 4f759a0..f5f0050 100644 --- a/src/options.cc +++ b/src/options.cc @@ -26,6 +26,7 @@ #include /* declares strcmp() */ #include /* declares isdigit() */ #include /* defines CHAR_MAX */ +#include "filename.h" #include "getopt.h" #include "version.h" @@ -280,6 +281,16 @@ Options::print_options () const { const char *arg = _argument_vector[i]; + if (i == 0) + { + /* _argument_vector[0] is the program name. Print only its base name. + This is useful for reproducible builds. */ + const char *p = arg + strlen (arg); + while (p > arg && ! ISSLASH (p[-1])) + p--; + arg = p; + } + /* Escape arg if it contains shell metacharacters. */ if (*arg == '-') { diff --git a/tests/c-parse.exp b/tests/c-parse.exp index 7a1f0ad..5c1a70c 100644 --- a/tests/c-parse.exp +++ b/tests/c-parse.exp @@ -1,5 +1,5 @@ /* C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -L C -F ', 0, 0' -j1 -i 1 -g -o -t -G -N is_reserved_word -k'1,3,$' */ +/* Command-line: gperf -L C -F ', 0, 0' -j1 -i 1 -g -o -t -G -N is_reserved_word -k'1,3,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/charsets.exp b/tests/charsets.exp index 01d0aa3..957926c 100644 --- a/tests/charsets.exp +++ b/tests/charsets.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -C -E -G -I -t */ +/* Command-line: gperf -C -E -G -I -t */ /* Computed positions: -k'1-11,22,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/chill.exp b/tests/chill.exp index 88f6fb2..326e01d 100644 --- a/tests/chill.exp +++ b/tests/chill.exp @@ -1,5 +1,5 @@ /* C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -L C -F ', 0, 0, 0' -D -E -S1 -j1 -i 1 -g -o -t -k'*' */ +/* Command-line: gperf -L C -F ', 0, 0, 0' -D -E -S1 -j1 -i 1 -g -o -t -k'*' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/cplusplus.exp b/tests/cplusplus.exp index dc8e9f6..7dcebaa 100644 --- a/tests/cplusplus.exp +++ b/tests/cplusplus.exp @@ -1,5 +1,5 @@ /* C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -L C -F ', 0, 0' -j1 -g -o -t -N is_reserved_word -k'1,4,7,$' */ +/* Command-line: gperf -L C -F ', 0, 0' -j1 -g -o -t -N is_reserved_word -k'1,4,7,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/gpc.exp b/tests/gpc.exp index c31f8f5..ccfd651 100644 --- a/tests/gpc.exp +++ b/tests/gpc.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -g -o -j1 -t -N is_reserved_word */ +/* Command-line: gperf -g -o -j1 -t -N is_reserved_word */ /* Computed positions: -k'1,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/incomplete.exp b/tests/incomplete.exp index e064de9..d72492e 100644 --- a/tests/incomplete.exp +++ b/tests/incomplete.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -t */ +/* Command-line: gperf -t */ /* Computed positions: -k'1,3' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/java.exp b/tests/java.exp index 3ea650f..e56955a 100644 --- a/tests/java.exp +++ b/tests/java.exp @@ -1,5 +1,5 @@ /* C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -L C -F ', 0' -t -j1 -i 1 -g -o -N java_keyword -k'1,3,$' */ +/* Command-line: gperf -L C -F ', 0' -t -j1 -i 1 -g -o -N java_keyword -k'1,3,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/languages.exp b/tests/languages.exp index d5c9971..cf4d9fe 100644 --- a/tests/languages.exp +++ b/tests/languages.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -C -E -G -I -t */ +/* Command-line: gperf -C -E -G -I -t */ /* Computed positions: -k'1-3,5,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/modula2.exp b/tests/modula2.exp index 670e5ff..983991a 100644 --- a/tests/modula2.exp +++ b/tests/modula2.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -n -k1-8 -l */ +/* Command-line: gperf -n -k1-8 -l */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/objc.exp b/tests/objc.exp index 8b9da19..3292035 100644 --- a/tests/objc.exp +++ b/tests/objc.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -j1 -i 1 -g -o -t -N is_reserved_word -k'1,3,$' */ +/* Command-line: gperf -j1 -i 1 -g -o -t -N is_reserved_word -k'1,3,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ diff --git a/tests/permut2.exp b/tests/permut2.exp index 2b2082d..217b34d 100644 --- a/tests/permut2.exp +++ b/tests/permut2.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -m5 */ +/* Command-line: gperf -m5 */ /* Computed positions: -k'1-2' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/permut3.exp b/tests/permut3.exp index eeda74a..0c04c15 100644 --- a/tests/permut3.exp +++ b/tests/permut3.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -m5 */ +/* Command-line: gperf -m5 */ /* Computed positions: -k'1-2' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/permutc2.exp b/tests/permutc2.exp index 13bd435..80fbf51 100644 --- a/tests/permutc2.exp +++ b/tests/permutc2.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -m5 --ignore-case */ +/* Command-line: gperf -m5 --ignore-case */ /* Computed positions: -k'1-2' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ diff --git a/tests/test-4.exp b/tests/test-4.exp index 7a48f2d..a849023 100644 --- a/tests/test-4.exp +++ b/tests/test-4.exp @@ -1,5 +1,5 @@ /* ANSI-C code produced by gperf version 3.2 */ -/* Command-line: ../src/gperf -D -t -k'1,$' */ +/* Command-line: gperf -D -t -k'1,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ -- cgit v1.2.1