develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #128484] Configure: tweak config.sh for easier noise-freechecksum

Thread Next
From:
Jim Cromie
Date:
June 26, 2016 00:29
Subject:
[perl #128484] Configure: tweak config.sh for easier noise-freechecksum
Message ID:
CAJfuBxxqiN154RAWx6GUUfw8eyVDasxgF60SptMenmYvNQ2gBg@mail.gmail.com
From 1c78f2af96b2505b8402c724cdf81df21665e98d Mon Sep 17 00:00:00 2001
From: Jim Cromie <jim.cromie@gmail.com>
Date: Sat, 25 Jun 2016 12:50:25 -0600
Subject: [PATCH] Config_sh.U: tweak header comments to mark noisy lines for
 checksum exclusion

The header info in config.sh currently has a number of fields whose
values are unconstrained and essentially random: ($cf_time, $cf_by,
$cf_email, $myuname).

 # Package name      : perl5
 # Source directory  : .
 # Configuration time: Fri Aug 28 21:09:08 MDT 2015
 # Configured by     : jimc
 # Target system     : linux groucho.jimc.earth 4.2.0-rc7-x2a-00125-gd0b89bd #278 smp sat aug 22 13:35:17 mdt 2015 x86_64 x86_64 x86_64 gnulinux

The presence of these cf_* fields means that `md5sum config.sh` output
is all noise; otherwize identical builds done at different times by
different users will have different checksums.

So this patch tweaks Configure (or rather 2 configure units - only 1
is needed, git add -i the desired chunk) to mark those problematic
lines with a leading '#:', making them easy to exclude from a
grep|cksum calculation.

   cfx_md5=`grep -v '^#:' config.sh | grep -vE '^cf_|^my' | md5sum`
   echo cfx_md5=\'$cf_md5\' >> config.sh

This yields a checksum value that reflects the given config_args, and
all the platform details its being built upon.  The checksum is
sensitive to the platform, despite dropping myarchname, via the
contents of cppsymbols, incpth, plibpth, gccversion, etc.

Further, with the cfx_md5 appended to config.sh as shown above, the
resulting %Config will have it, making it available for installation
tools to use.

      $ ./perl -Ilib -V:cfx_md5:
      cfx_md5='37e040a516936d31d0e049d95ad66b68 -'

So this is a small step towards adding -k<checksum> into the perl
executable's name, and into its @INC paths.

NOTES:

1- tested by tweaking Configure, appending to config.sh, building, and
   verifying `./perl -Ilib -V:cfx_md5:`.  Patched blindly into
   metaconfig units.

2- no >> config.sh actually done here, there might be a better way..

3- cfx_md5 could have a better name (subject to bikeshedding),
   md5 says nothing about what is included in the calculation.

4- multiple cfx_*, each with different subsets of `cat config.sh`,
   could define different "equivalent configs".

   For example:
   cfx_cfargs=`grep config_args config.sh | md5sum`
   echo cfx_cfargs=\'$cfx_cfargs\' >> config.sh

   cfx_cfargs would neatly map the ~16 Test-Smoke configs to a small
   set of unique and eventually recognizable [0-9a-f]{3,5} key-fragments.

   cfx_md5 as given above would define comparable builds;
   Porting/bench.pl performance results from 2 platforms with
   identical keys should have similar results
---
 U/modified/Config_sh.U | 10 +++++-----
 dist/U/Config_sh.U     | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/U/modified/Config_sh.U b/U/modified/Config_sh.U
index 2bbcf1b..c9d884b 100644
--- a/U/modified/Config_sh.U
+++ b/U/modified/Config_sh.U
@@ -112,11 +112,11 @@ $startsh
 # instead choose to run each of the .SH files by yourself, or "Configure -S".
 #
 
-# Package name      : $package
-# Source directory  : $src
-# Configuration time: $cf_time
-# Configured by     : $cf_by
-# Target system     : $myuname
+#: Package name      : $package
+#: Source directory  : $src
+#: Configuration time: $cf_time
+#: Configured by     : $cf_by
+#: Target system     : $myuname
 
 EOT
 ?X: Command line options are saved by the Options.U unit in the
diff --git a/dist/U/Config_sh.U b/dist/U/Config_sh.U
index bb47b7b..a46b9f3 100644
--- a/dist/U/Config_sh.U
+++ b/dist/U/Config_sh.U
@@ -96,11 +96,11 @@ $startsh
 # instead choose to run each of the .SH files by yourself, or "Configure -S".
 #
 
-# Package name      : $package
-# Source directory  : $src
-# Configuration time: $cf_time
-# Configured by     : $cf_by
-# Target system     : $myuname
+#: Package name      : $package
+#: Source directory  : $src
+#: Configuration time: $cf_time
+#: Configured by     : $cf_by
+#: Target system     : $myuname
 
 EOT
 ?X: Command line options are saved by the Options.U unit in the
-- 
2.7.4


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About