Add --version to all installed Perl and Shell scripts.
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 1 Nov 2017 06:45:14 +0000 (07:45 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Wed, 1 Nov 2017 06:49:41 +0000 (07:49 +0100)
This option outputs the build info, and for Perl scripts it additionally
outputs the Perl version that is running the current script.

14 files changed:
src/OS/Makefile-Base
src/src/convert4r3.src
src/src/convert4r4.src
src/src/exicyclog.src
src/src/exigrep.src
src/src/exim_checkaccess.src
src/src/eximon.src
src/src/eximstats.src
src/src/exinext.src
src/src/exipick.src
src/src/exiqgrep.src
src/src/exiqsumm.src
src/src/exiwhat.src
src/src/transport-filter.src

index d64ed549f74e69304bdfd7e66651b8af11bd94b0..dcd87c29cce19ba004100499d31f1840c4540ba9 100644 (file)
@@ -36,9 +36,9 @@ FE       = $(FULLECHO)
 # are set up, and finally it goes to the main Exim target.
 
 all:       utils exim
-config:    $(EDITME) checklocalmake Makefile os.c config.h version.h macro.c
+config:    $(EDITME) checklocalmake Makefile os.c config.h version.h version.sh macro.c
 
-checklocalmake: 
+checklocalmake:
        @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
          $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(ARCHTYPE) $(EDITME) || \
          $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE)-$(ARCHTYPE) $(EDITME); \
@@ -260,7 +260,7 @@ buildconfig: buildconfig.c
 # Target for the exicyclog utility script
 exicyclog: config ../src/exicyclog.src
        @rm -f exicyclog
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
@@ -277,6 +277,8 @@ exicyclog: config ../src/exicyclog.src
          -e "s?MV_COMMAND?$(MV_COMMAND)?" \
          -e "s?RM_COMMAND?$(RM_COMMAND)?" \
          -e "s?TOUCH_COMMAND?$(TOUCH_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exicyclog.src > exicyclog-t
        @mv exicyclog-t exicyclog
        @chmod a+x exicyclog
@@ -285,13 +287,15 @@ exicyclog: config ../src/exicyclog.src
 # Target for the exinext utility script
 exinext: config ../src/exinext.src
        @rm -f exinext
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
          -e "s?CONFIGURE_FILE_USE_NODE?$(CONFIGURE_FILE_USE_NODE)?" \
          -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
          -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exinext.src > exinext-t
        @mv exinext-t exinext
        @chmod a+x exinext
@@ -300,7 +304,7 @@ exinext: config ../src/exinext.src
 # Target for the exiwhat utility script
 exiwhat: config ../src/exiwhat.src
        @rm -f exiwhat
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
@@ -313,6 +317,8 @@ exiwhat: config ../src/exiwhat.src
          -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
          -e "s?EXIWHAT_MULTIKILL_CMD?$(EXIWHAT_MULTIKILL_CMD)?" \
          -e "s?EXIWHAT_MULTIKILL_ARG?$(EXIWHAT_MULTIKILL_ARG)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exiwhat.src > exiwhat-t
        @mv exiwhat-t exiwhat
        @chmod a+x exiwhat
@@ -321,7 +327,7 @@ exiwhat: config ../src/exiwhat.src
 # Target for the exim_checkaccess utility script
 exim_checkaccess: config ../src/exim_checkaccess.src
        @rm -f exim_checkaccess
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
@@ -329,6 +335,8 @@ exim_checkaccess: config ../src/exim_checkaccess.src
          -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
          -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
          -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exim_checkaccess.src > exim_checkaccess-t
        @mv exim_checkaccess-t exim_checkaccess
        @chmod a+x exim_checkaccess
@@ -339,7 +347,7 @@ eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
           ../Local/eximon.conf
        @rm -f eximon
        $(SHELL) $(SCRIPTS)/Configure-eximon
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
@@ -349,85 +357,108 @@ eximon: config ../src/eximon.src ../OS/eximon.conf-Default \
          -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
          -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
          -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/eximon.src >> eximon
        @echo ">>> eximon script built"; echo ""
 
 # Targets for utilities; these are all Perl scripts that have to get the
 # location of Perl put in them. A few need other things as well.
 
-exigrep: Makefile ../src/exigrep.src
+exigrep: config ../src/exigrep.src
        @rm -f exigrep
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
          -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
          -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
           -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exigrep.src > exigrep-t
        @mv exigrep-t exigrep
        @chmod a+x exigrep
        @echo ">>> exigrep script built"
 
-eximstats: Makefile ../src/eximstats.src
+eximstats: config ../src/eximstats.src
        @rm -f eximstats
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/eximstats.src > eximstats-t
        @mv eximstats-t eximstats
        @chmod a+x eximstats
        @echo ">>> eximstats script built"
 
-exiqgrep: Makefile ../src/exiqgrep.src
+exiqgrep: config ../src/exiqgrep.src
        @rm -f exiqgrep
-       @sed \
+       @. ./version.sh && sed \
          -e "s?PROCESSED_FLAG?This file has been so processed.?"\
          -e "/^# /p" \
          -e "/^# /d" \
          -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
          -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exiqgrep.src > exiqgrep-t
        @mv exiqgrep-t exiqgrep
        @chmod a+x exiqgrep
        @echo ">>> exiqgrep script built"
 
-exiqsumm: Makefile ../src/exiqsumm.src
+exiqsumm: config ../src/exiqsumm.src
        @rm -f exiqsumm
-       @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+       @. ./version.sh && sed \
+         -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exiqsumm.src > exiqsumm-t
        @mv exiqsumm-t exiqsumm
        @chmod a+x exiqsumm
        @echo ">>> exiqsumm script built"
 
-exipick: Makefile ../src/exipick.src
+exipick: config ../src/exipick.src
        @rm -f exipick
-       @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+       @. ./version.sh && sed \
+         -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
          -e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
          -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/exipick.src > exipick-t
        @mv exipick-t exipick
        @chmod a+x exipick
        @echo ">>> exipick script built"
 
-transport-filter.pl: Makefile ../src/transport-filter.src
+transport-filter.pl: config ../src/transport-filter.src
        @rm -f transport-filter.pl
-       @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+       @. ./version.sh && sed \
+         -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/transport-filter.src > transport-filter.pl-t
        @mv transport-filter.pl-t transport-filter.pl
        @chmod a+x transport-filter.pl
        @echo ">>> transport-filter.pl script built"
 
-convert4r3: Makefile ../src/convert4r3.src
+convert4r3: config ../src/convert4r3.src
        @rm -f convert4r3
-       @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+       @. ./version.sh && sed \
+         -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/convert4r3.src > convert4r3-t
        @mv convert4r3-t convert4r3
        @chmod a+x convert4r3
        @echo ">>> convert4r3 script built"
 
-convert4r4: Makefile ../src/convert4r4.src
+convert4r4: config ../src/convert4r4.src
        @rm -f convert4r4
-       @sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+       @. ./version.sh && sed \
+         -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+         -e "s?EXIM_RELEASE_VERSION?$${EXIM_RELEASE_VERSION}?" \
+         -e "s?EXIM_VARIANT_VERSION?$${EXIM_VARIANT_VERSION}?" \
          ../src/convert4r4.src > convert4r4-t
        @mv convert4r4-t convert4r4
        @chmod a+x convert4r4
@@ -635,7 +666,7 @@ PHDRS = ../config.h \
 
 # Update Exim's version information and build the version object.
 
-version.h::
+version.h version.sh::
        @../scripts/reversion
 
 cnumber.h: version.h
index 632eb70d761e7e7f3b0637c92ad71ce1bf4e5878..d0b94d15ee909b06d5700769fddf94fb945edd5e 100755 (executable)
 use warnings;
 BEGIN { pop @INC if $INC[-1] eq '.' };
 
+use Getopt::Long;
+use File::Basename;
+
+GetOptions(
+    'version' => sub {
+        print basename($0) . ": $0\n",
+            "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+            "perl(runtime): $^V\n";
+            exit 0;
+    },
+);
+
 ##################################################
 #             Analyse one line                   #
 ##################################################
index fff4e478bc3f649222b24e6f3bde71b50ce8cb64..47987fc8f3cc50a2f6fa7c3c21af45c0f86cb9ef 100755 (executable)
@@ -9,6 +9,18 @@
 use warnings;
 BEGIN { pop @INC if $INC[-1] eq '.' };
 
+use Getopt::Long;
+use File::Basename;
+
+GetOptions(
+    'version' => sub {
+        print basename($0) . ": $0\n",
+            "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+            "perl(runtime): $^V\n";
+            exit 0;
+    },
+);
+
 # These are lists of main options which are abolished in Exim 4.
 # The first contains options that are used to construct new options.
 
index 4fb160ac03a54e1ec5c7e7050921abca7ea12d35..20bf9fcd4ead3f9262bc73896fd18cf32aafc3bf 100644 (file)
@@ -72,6 +72,11 @@ while [ $# -gt 0 ] ; do
   -k) keep=$2
       shift
       ;;
+   --version)
+      echo "`basename $0`: $0"
+      echo "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION"
+      exit 0
+      ;;
    *) echo "** exicyclog: unknown option $1"
       exit 1
       ;;
index bdeffae82c3a22d55c99c2a81c38733341421560..118cd91b91d41c00fd21c76e99fb53b6458415b3 100644 (file)
@@ -6,6 +6,7 @@ BEGIN { pop @INC if $INC[-1] eq '.' };
 
 use Pod::Usage;
 use Getopt::Long;
+use File::Basename;
 
 # Copyright (c) 2007-2017 University of Cambridge.
 # See the file NOTICE for conditions of use and distribution.
@@ -229,6 +230,12 @@ GetOptions(
             -noperldoc => system('perldoc -V 2>/dev/null >&2')
         );
       },
+      'version'        => sub {
+            print basename($0) . ": $0\n",
+                "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+                "perl(runtime): $^V\n";
+            exit 0;
+      },
 ) and @ARGV or pod2usage;
 
 $pattern = shift @ARGV;
index a780a298a4209ec0e22cf14d978022c45fd2b1ca..81f6ebf705cdc05a93d3cc72b48b078812a95da7 100755 (executable)
@@ -65,8 +65,16 @@ PERL_COMMAND - $exim_path $args <<'End'
 
 BEGIN { pop @INC if $INC[-1] eq '.' };
 use FileHandle;
+use File::Basename;
 use IPC::Open2;
 
+if ($ARGV[0] eq '--version') {
+    print basename($0) . ": $0\n",
+          "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+          "perl(runtime): $^V\n";
+          exit 0;
+}
+
 if (scalar(@ARGV) < 3)
   {
   print "Usage: exim_checkaccess <IP address> <email address> [exim options]\n";
index d461ccffa7b7d35d9843b0b66453739713e953d8..6293a7cc2e11dbf25eac5199f67adc35ffded392 100644 (file)
 # X11_LD_LIBRARY
 
 # PROCESSED_FLAG
+#
+if test "x$1" = x--version
+then
+    echo "`basename $0`: $0"
+    echo "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION"
+    exit 0
+fi
 
 # See if caller wants to invoke gdb
 
index 80ac9337266c1505ee4ecfce119382bc0f385d7c..99f4c195f6cf094320eb2e10b9b599c676102465 100644 (file)
@@ -552,10 +552,18 @@ use integer;
 BEGIN { pop @INC if $INC[-1] eq '.' };
 use strict;
 use IO::File;
+use File::Basename;
 
 # use Time::Local;  # PH/FANF
 use POSIX;
 
+if ($ARGV[0] eq '--version') {
+    print basename($0) . ": $0\n",
+        "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+        "perl(runtime): $^V\n";
+        exit 0;
+}
+
 use vars qw($HAVE_GD_Graph_pie $HAVE_GD_Graph_linespoints $HAVE_Spreadsheet_WriteExcel);
 eval { require GD::Graph::pie; };
 $HAVE_GD_Graph_pie = $@ ? 0 : 1;
index 9c427350b29ab28bd9fff6470730ad7ed1f2ab03..91380186747240b0c31d0bfa6a5e992970c68216 100644 (file)
@@ -25,6 +25,13 @@ config=
 eximmacdef=
 exim_path=
 
+if test "x$1" = x--version
+then
+    echo "`basename $0`: $0"
+    echo "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION"
+    exit 0
+fi
+
 if expr -- $1 : '\-' >/dev/null ; then
   while expr -- $1 : '\-' >/dev/null ; do
     if [ "$1" = "-C" ]; then
index a1aa79dc064b440acea4a56ebe304910107bec2a..d486b4289893485f7c240c18b2aaf441f874f777 100644 (file)
@@ -17,6 +17,7 @@ my $charset = 'ISO-8859-1';
 use strict;
 BEGIN { pop @INC if $INC[-1] eq '.' };
 use Getopt::Long;
+use File::Basename;
 
 my($p_name)   = $0 =~ m|/?([^/]+)$|;
 my $p_version = "20100323.0";
@@ -83,7 +84,13 @@ GetOptions(
   'show-vars=s' => \$G::show_vars,  # display the contents of these vars
   'just-vars'   => \$G::just_vars,  # only display vars, no other info
   'show-rules'  => \$G::show_rules, # display compiled match rules
-  'show-tests'  => \$G::show_tests  # display tests as applied to each message
+  'show-tests'  => \$G::show_tests, # display tests as applied to each message
+  'version'     => sub {
+        print basename($0) . ": $0\n",
+            "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+            "perl(runtime): $^V\n";
+            exit 0;
+  },
 ) || exit(1);
 
 # if both freeze and thaw specified, only thaw as it is less destructive
index d900e99337a49be8709277bae1eb0d203f34aa22..c26da684bfae3f136c9414930df73e6ec68a615b 100644 (file)
@@ -19,7 +19,9 @@
 
 use strict;
 BEGIN { pop @INC if $INC[-1] eq '.' };
+
 use Getopt::Std;
+use File::Basename;
 
 # Have this variable point to your exim binary.
 my $exim = 'BIN_DIRECTORY/exim';
@@ -44,6 +46,13 @@ if ($^O eq 'darwin') { # aka MacOS X
   $base = 62;
 };
 
+if ($ARGV[0] eq '--version') {
+    print basename($0) . ": $0\n",
+        "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+        "perl(runtime): $^V\n";
+        exit 0;
+}
+
 getopts('hf:r:y:o:s:C:zxlibRca',\%opt);
 if ($ARGV[0]) { &help; exit;}
 if ($opt{h}) { &help; exit;}
index 99a304fefc359b2b4ee0ed9016b800646a33c568..97cacdd6358ae8628ba2749a72cc1767075f135b 100644 (file)
 
 use warnings;
 BEGIN { pop @INC if $INC[-1] eq '.' };
+use File::Basename;
+
+if ($ARGV[0] eq '--version') {
+    print basename($0) . ": $0\n",
+        "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+        "perl(runtime): $^V\n";
+        exit 0;
+}
 
 sub print_volume_rounded {
 my($x) = pop @_;
index 2542b01984789671a446a970a497392c80268ce9..4fdc09f785563009b16f7f4f311fa2df866879d6 100644 (file)
@@ -52,6 +52,13 @@ signal=EXIWHAT_KILL_SIGNAL
 # See if this installation is using the esoteric "USE_NODE" feature of Exim,
 # in which it uses the host's name as a suffix for the configuration file name.
 
+if test "x$1" = x--version
+then
+    echo "`basename $0`: $0"
+    echo "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION"
+    exit 0
+fi
+
 if [ "CONFIGURE_FILE_USE_NODE" = "yes" ]; then
   hostsuffix=.`uname -n`
 fi
index 3f250e6578aa1a40a30a3e6990761bee87976930..256bf7c397b5175abebdec27abe6d6b713eb8e07 100644 (file)
 
 use warnings;
 BEGIN { pop @INC if $INC[-1] eq '.' };
+use File::Basename;
+
+if ($ARGV[0] eq '--version') {
+    print basename($0) . ": $0\n",
+        "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n",
+        "perl(runtime): $^V\n";
+        exit 0;
+}
 
 # If the filter is called with any arguments, insert them into the message
 # as X-Arg headers, just to verify what they are.