From 8d0bfcbc5b07cf0ebbd45c4384bc7c2a1a455617 Mon Sep 17 00:00:00 2001 From: hanlet Date: Wed, 11 May 2022 16:00:16 -0700 Subject: [PATCH 1/7] Modify genVersionHeader.pl to add commit time (in epoch). Tested for git. Not tested: darcs, mercurial, or svn Skipping: bzr --- src/tools/genVersionHeader.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/tools/genVersionHeader.pl b/src/tools/genVersionHeader.pl index 2466aef6b..d2829d3c1 100644 --- a/src/tools/genVersionHeader.pl +++ b/src/tools/genVersionHeader.pl @@ -16,6 +16,8 @@ use lib "$Bin/../../lib/perl"; use EPICS::Getopts; use POSIX qw(strftime); +use Time::ParseDate; +use Date::Parse; use strict; @@ -29,7 +31,11 @@ our $opt_t = '.'; our $opt_N = 'VCSVERSION'; our $opt_V = $now; +our $opt_T = 'VCSREVISION'; +our $opt_C = $now; + my $vcs; +my $cv; getopts('dhivqt:N:V:') && @ARGV == 1 or HELP_MESSAGE(); @@ -53,6 +59,9 @@ if (!$vcs && -d "$opt_t/_darcs") { # Darcs my $hasmod = `darcs whatsnew --repodir="$opt_t" -l`; $opt_V .= '-dirty' unless $?; } + $cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; +# $cm = `darcs show repo --no-files`; +# $cm = `darcs pull --dry-run`; } if (!$vcs && -d "$opt_t/.hg") { # Mercurial print "== Found /.hg directory\n" if $opt_v; @@ -69,6 +78,7 @@ if (!$vcs && -d "$opt_t/.hg") { # Mercurial chomp $hasmod; $opt_V .= '-dirty' if $hasmod ne ''; } + $cv = `hg log -l1 --template '{date(date, "%s")}'` } if (!$vcs && -d "$opt_t/.git") { # Git print "== Found /.git directory\n" if $opt_v; @@ -82,6 +92,7 @@ if (!$vcs && -d "$opt_t/.git") { # Git $opt_V = $result; $vcs = 'Git'; } + $cv = `git log -1 --format=%ct HEAD`; } if (!$vcs && -d "$opt_t/.svn") { # Subversion print "== Found /.svn directory\n" if $opt_v; @@ -97,6 +108,7 @@ if (!$vcs && -d "$opt_t/.svn") { # Subversion chomp $hasmod; $opt_V .= '-dirty' if $hasmod ne ''; } + $cv = `svn info --show-item revision`; # this is untested } if (!$vcs && -d "$opt_t/.bzr") { # Bazaar print "== Found /.bzr directory\n" if $opt_v; @@ -108,6 +120,7 @@ if (!$vcs && -d "$opt_t/.bzr") { # Bazaar $opt_V = $result; $vcs = 'Bazaar'; } + # bzr is skipped here } if (!$vcs) { print "== No VCS directories\n" if $opt_v; @@ -120,6 +133,9 @@ if (!$vcs) { } } +chomp $cv; +$opt_C=$cv; + my $output = << "__END"; /* Generated file, do not edit! */ @@ -128,12 +144,16 @@ my $output = << "__END"; #ifndef $opt_N #define $opt_N \"$opt_V\" #endif +#ifndef $opt_T + #define ${opt_N}_DATE $opt_C +#endif __END print "== Want:\n$output==\n" if $opt_v; my $DST; if (open($DST, '+<', $outfile)) { + my $actual = join('', <$DST>); print "== Current:\n$actual==\n" if $opt_v; @@ -190,4 +210,3 @@ Usage: EOF exit $opt_h ? 0 : 1; } - From e566c52a78edeaa3c35e65f04561cc64dec81ded Mon Sep 17 00:00:00 2001 From: hanlet Date: Fri, 13 May 2022 10:46:17 -0700 Subject: [PATCH 2/7] Simplified to remove "use" cases and settling for string for versions of commit date/time. --- src/tools/genVersionHeader.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tools/genVersionHeader.pl b/src/tools/genVersionHeader.pl index d2829d3c1..081f0c77e 100644 --- a/src/tools/genVersionHeader.pl +++ b/src/tools/genVersionHeader.pl @@ -16,8 +16,6 @@ use lib "$Bin/../../lib/perl"; use EPICS::Getopts; use POSIX qw(strftime); -use Time::ParseDate; -use Date::Parse; use strict; @@ -59,9 +57,8 @@ if (!$vcs && -d "$opt_t/_darcs") { # Darcs my $hasmod = `darcs whatsnew --repodir="$opt_t" -l`; $opt_V .= '-dirty' unless $?; } + # this is untested $cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; -# $cm = `darcs show repo --no-files`; -# $cm = `darcs pull --dry-run`; } if (!$vcs && -d "$opt_t/.hg") { # Mercurial print "== Found /.hg directory\n" if $opt_v; @@ -78,7 +75,7 @@ if (!$vcs && -d "$opt_t/.hg") { # Mercurial chomp $hasmod; $opt_V .= '-dirty' if $hasmod ne ''; } - $cv = `hg log -l1 --template '{date(date, "%s")}'` + $cv = `hg log -l1 --template '{date(date, "%s")}'` # this is untested } if (!$vcs && -d "$opt_t/.git") { # Git print "== Found /.git directory\n" if $opt_v; @@ -120,7 +117,7 @@ if (!$vcs && -d "$opt_t/.bzr") { # Bazaar $opt_V = $result; $vcs = 'Bazaar'; } - # bzr is skipped here + $cv = `bzr version-info -q -timestamp`; # this is untested } if (!$vcs) { print "== No VCS directories\n" if $opt_v; @@ -145,7 +142,7 @@ my $output = << "__END"; #define $opt_N \"$opt_V\" #endif #ifndef $opt_T - #define ${opt_N}_DATE $opt_C + #define ${opt_N}_DATE \"$opt_C\" #endif __END From f1093712680846530bdb71a62773c3537b64b86c Mon Sep 17 00:00:00 2001 From: hanlet Date: Fri, 13 May 2022 11:30:26 -0700 Subject: [PATCH 3/7] Added revision release time to ioc startup message. --- modules/database/src/ioc/misc/epicsRelease.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/database/src/ioc/misc/epicsRelease.c b/modules/database/src/ioc/misc/epicsRelease.c index c1801179f..d222b602d 100644 --- a/modules/database/src/ioc/misc/epicsRelease.c +++ b/modules/database/src/ioc/misc/epicsRelease.c @@ -23,6 +23,7 @@ DBCORE_API int coreRelease(void) printf ( "############################################################################\n" ); printf ( "## %s\n", epicsReleaseVersion ); printf ( "## %s\n", "Rev. " EPICS_VCS_VERSION ); + printf ( "## %s\n", "Rev. " EPICS_VCS_VERSION_DATE ); printf ( "############################################################################\n" ); return 0; } From 8e4ffd46a08d6a93c279014df1aa2185c5541f7b Mon Sep 17 00:00:00 2001 From: hanlet Date: Fri, 13 May 2022 11:38:32 -0700 Subject: [PATCH 4/7] Changed descriptive text to identify new commit date information. --- modules/database/src/ioc/misc/epicsRelease.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/misc/epicsRelease.c b/modules/database/src/ioc/misc/epicsRelease.c index d222b602d..f39d6f7d3 100644 --- a/modules/database/src/ioc/misc/epicsRelease.c +++ b/modules/database/src/ioc/misc/epicsRelease.c @@ -23,7 +23,7 @@ DBCORE_API int coreRelease(void) printf ( "############################################################################\n" ); printf ( "## %s\n", epicsReleaseVersion ); printf ( "## %s\n", "Rev. " EPICS_VCS_VERSION ); - printf ( "## %s\n", "Rev. " EPICS_VCS_VERSION_DATE ); + printf ( "## %s\n", "Date " EPICS_VCS_VERSION_DATE ); printf ( "############################################################################\n" ); return 0; } From f0c86c5cb351c4ff6ce9c21490cec8b3af3c9227 Mon Sep 17 00:00:00 2001 From: hanlet Date: Fri, 13 May 2022 13:25:47 -0700 Subject: [PATCH 5/7] Added repository name Changed git date from epoch to present commit date --- modules/database/src/ioc/misc/epicsRelease.c | 2 +- src/tools/genVersionHeader.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/misc/epicsRelease.c b/modules/database/src/ioc/misc/epicsRelease.c index f39d6f7d3..a1783fb8c 100644 --- a/modules/database/src/ioc/misc/epicsRelease.c +++ b/modules/database/src/ioc/misc/epicsRelease.c @@ -23,7 +23,7 @@ DBCORE_API int coreRelease(void) printf ( "############################################################################\n" ); printf ( "## %s\n", epicsReleaseVersion ); printf ( "## %s\n", "Rev. " EPICS_VCS_VERSION ); - printf ( "## %s\n", "Date " EPICS_VCS_VERSION_DATE ); + printf ( "## %s\n", "Rev. Date " EPICS_VCS_VERSION_DATE ); printf ( "############################################################################\n" ); return 0; } diff --git a/src/tools/genVersionHeader.pl b/src/tools/genVersionHeader.pl index 081f0c77e..ebdab9b6c 100644 --- a/src/tools/genVersionHeader.pl +++ b/src/tools/genVersionHeader.pl @@ -89,7 +89,7 @@ if (!$vcs && -d "$opt_t/.git") { # Git $opt_V = $result; $vcs = 'Git'; } - $cv = `git log -1 --format=%ct HEAD`; + $cv = `git show -s --format=%ci HEAD`; } if (!$vcs && -d "$opt_t/.svn") { # Subversion print "== Found /.svn directory\n" if $opt_v; @@ -131,7 +131,7 @@ if (!$vcs) { } chomp $cv; -$opt_C=$cv; +$opt_C=$vcs . ': ' . $cv; my $output = << "__END"; /* Generated file, do not edit! */ From 2afa4ea390fc70fb20ee98889d54a629035f2841 Mon Sep 17 00:00:00 2001 From: hanlet Date: Fri, 13 May 2022 13:32:35 -0700 Subject: [PATCH 6/7] Cosmetic change. --- src/tools/genVersionHeader.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/genVersionHeader.pl b/src/tools/genVersionHeader.pl index ebdab9b6c..f1758be8f 100644 --- a/src/tools/genVersionHeader.pl +++ b/src/tools/genVersionHeader.pl @@ -57,8 +57,7 @@ if (!$vcs && -d "$opt_t/_darcs") { # Darcs my $hasmod = `darcs whatsnew --repodir="$opt_t" -l`; $opt_V .= '-dirty' unless $?; } - # this is untested - $cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; + $cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; # this is untested } if (!$vcs && -d "$opt_t/.hg") { # Mercurial print "== Found /.hg directory\n" if $opt_v; From 5997018fb0bb05fbe56e40a26bf6b9605b707eb3 Mon Sep 17 00:00:00 2001 From: hanlet Date: Tue, 17 May 2022 12:14:29 -0500 Subject: [PATCH 7/7] Made changes suggested by Michael: - removed unused/misused $opc_X - modified command line repo calls - fixed ifndef block --- src/tools/genVersionHeader.pl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/tools/genVersionHeader.pl b/src/tools/genVersionHeader.pl index f1758be8f..bb291c0a2 100644 --- a/src/tools/genVersionHeader.pl +++ b/src/tools/genVersionHeader.pl @@ -29,8 +29,7 @@ our $opt_t = '.'; our $opt_N = 'VCSVERSION'; our $opt_V = $now; -our $opt_T = 'VCSREVISION'; -our $opt_C = $now; +our $RevDate = $now; my $vcs; my $cv; @@ -57,7 +56,7 @@ if (!$vcs && -d "$opt_t/_darcs") { # Darcs my $hasmod = `darcs whatsnew --repodir="$opt_t" -l`; $opt_V .= '-dirty' unless $?; } - $cv = `darcs optimize --reorder; darcs changes --context | sort | md5sum`; # this is untested + $cv = ""; # ToDo } if (!$vcs && -d "$opt_t/.hg") { # Mercurial print "== Found /.hg directory\n" if $opt_v; @@ -74,7 +73,7 @@ if (!$vcs && -d "$opt_t/.hg") { # Mercurial chomp $hasmod; $opt_V .= '-dirty' if $hasmod ne ''; } - $cv = `hg log -l1 --template '{date(date, "%s")}'` # this is untested + $cv = `hg log -l1 --template '{date|isodate}'` # this is untested } if (!$vcs && -d "$opt_t/.git") { # Git print "== Found /.git directory\n" if $opt_v; @@ -104,7 +103,7 @@ if (!$vcs && -d "$opt_t/.svn") { # Subversion chomp $hasmod; $opt_V .= '-dirty' if $hasmod ne ''; } - $cv = `svn info --show-item revision`; # this is untested + $cv = `svn info --show-item last-changed-date`; # this is untested } if (!$vcs && -d "$opt_t/.bzr") { # Bazaar print "== Found /.bzr directory\n" if $opt_v; @@ -116,7 +115,7 @@ if (!$vcs && -d "$opt_t/.bzr") { # Bazaar $opt_V = $result; $vcs = 'Bazaar'; } - $cv = `bzr version-info -q -timestamp`; # this is untested + $cv = `bzr version-info -q --custom --template='{date}'`; } if (!$vcs) { print "== No VCS directories\n" if $opt_v; @@ -130,7 +129,7 @@ if (!$vcs) { } chomp $cv; -$opt_C=$vcs . ': ' . $cv; +$RevDate=$vcs . ': ' . $cv; my $output = << "__END"; /* Generated file, do not edit! */ @@ -140,8 +139,8 @@ my $output = << "__END"; #ifndef $opt_N #define $opt_N \"$opt_V\" #endif -#ifndef $opt_T - #define ${opt_N}_DATE \"$opt_C\" +#ifndef ${opt_N}_DATE + #define ${opt_N}_DATE \"$RevDate\" #endif __END