Use predictable date in POD-generated manpages
This is a minor issue that may break co-installability of i386/amd64 Debian packages: If the date in otherwise identical manpages differs across architectures, dpkg will refuse to install the two versions of the package together. See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680885 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680886 This patch makes for reproducible outcomes. Cheers, -Hilko
--- podwrapper.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/podwrapper.sh.in b/podwrapper.sh.in index ec750f1..0a84d13 100755 --- a/podwrapper.sh.in +++ b/podwrapper.sh.in @@ -53,6 +53,9 @@ if [ -z "$abs_top_builddir" ]; then exit 1 fi +DATE=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print $1; exit }' \ + $abs_top_srcdir/ChangeLog` + declare -a inserts declare -a pattern declare -a indent @@ -167,6 +170,7 @@ fi # Now generate the final output format(s). if [ -n "$man_output" ]; then "$POD2MAN" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \ + --date $DATE \ --section "$section" -c "Virtualization Support" --name "$name" \ --release "$PACKAGE_NAME-$PACKAGE_VERSION" \ < $tmpdir/full.pod > "$man_output".tmp -- 1.7.10.4
On Mon, Jul 09, 2012 at 08:16:37PM +0200, Hilko Bengen wrote:
--- podwrapper.sh.in | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/podwrapper.sh.in b/podwrapper.sh.in index ec750f1..0a84d13 100755 --- a/podwrapper.sh.in +++ b/podwrapper.sh.in @@ -53,6 +53,9 @@ if [ -z "$abs_top_builddir" ]; then exit 1 fi
+DATE=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print $1; exit }' \ + $abs_top_srcdir/ChangeLog` + declare -a inserts declare -a pattern declare -a indent @@ -167,6 +170,7 @@ fi # Now generate the final output format(s). if [ -n "$man_output" ]; then "$POD2MAN" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \ + --date $DATE \ --section "$section" -c "Virtualization Support" --name "$name" \ --release "$PACKAGE_NAME-$PACKAGE_VERSION" \ < $tmpdir/full.pod > "$man_output".tmp -- 1.7.10.4
Looks good, except unfortunately 'ChangeLog' isn't included in git so this would fail for people who check out from git and try to compile. I'm not sure what the best solution for that would be. Perhaps: (1) include ChangeLog in git? (2) In the 'make dist' rule, write a 'date' file and use that here? Only 'date' would have to be included in git. (3) Make the 'DATE' calculation detect this and use the current date instead? Something else? I think I'm favouring option (2) at the moment. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Mon, Jul 09, 2012 at 08:57:15PM +0100, Richard W.M. Jones wrote:
(2) In the 'make dist' rule, write a 'date' file and use that here? Only 'date' would have to be included in git.
This could be useful: $ git show -s --format=%ci $(git rev-parse HEAD) 2012-07-08 12:55:44 +0100 $ git show -s --format=%ci $(git rev-parse HEAD) | awk '{print $1}' 2012-07-08 (redirected into the '$top_srcdir/DATE' file) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
* Richard W.M. Jones:
On Mon, Jul 09, 2012 at 08:57:15PM +0100, Richard W.M. Jones wrote:
(2) In the 'make dist' rule, write a 'date' file and use that here? Only 'date' would have to be included in git.
This could be useful:
$ git show -s --format=%ci $(git rev-parse HEAD) 2012-07-08 12:55:44 +0100
What is git rev-parse HEAD needed for? How about something like this? if [ -e $abs_top_srcdir/ChangeLog ]; then DATEPARAM=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print "--date=" $1; exit }' \ $abs_top_srcdir/ChangeLog` else if [ -d $abs_top_srcdir/.git ]; then DATEPARAM=`git show -s --format=%ci | awk '{print "--date=" $1}'` fi (If $DATEPARAM is not set, pod2man would fall back to its current behavior.) -Hilko
On Tue, Jul 10, 2012 at 12:00:58AM +0200, Hilko Bengen wrote:
* Richard W.M. Jones:
On Mon, Jul 09, 2012 at 08:57:15PM +0100, Richard W.M. Jones wrote:
(2) In the 'make dist' rule, write a 'date' file and use that here? Only 'date' would have to be included in git.
This could be useful:
$ git show -s --format=%ci $(git rev-parse HEAD) 2012-07-08 12:55:44 +0100
What is git rev-parse HEAD needed for?
Hmmm, thinko :-)
How about something like this?
if [ -e $abs_top_srcdir/ChangeLog ]; then DATEPARAM=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print "--date=" $1; exit }' \ $abs_top_srcdir/ChangeLog` else if [ -d $abs_top_srcdir/.git ]; then DATEPARAM=`git show -s --format=%ci | awk '{print "--date=" $1}'` fi
(If $DATEPARAM is not set, pod2man would fall back to its current behavior.)
Looks good. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
--- podwrapper.sh.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/podwrapper.sh.in b/podwrapper.sh.in index ec750f1..9198f63 100755 --- a/podwrapper.sh.in +++ b/podwrapper.sh.in @@ -53,6 +53,13 @@ if [ -z "$abs_top_builddir" ]; then exit 1 fi +if [ -e $abs_top_srcdir/ChangeLog ]; then + DATEPARAM=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print "--date=" $1; exit }' \ + $abs_top_srcdir/ChangeLog` +else if [ -d $abs_top_srcdir/.git ]; then + DATEPARAM=`git show -s --format=%ci | awk '{print "--date=" $1}'` +else + declare -a inserts declare -a pattern declare -a indent @@ -167,6 +174,7 @@ fi # Now generate the final output format(s). if [ -n "$man_output" ]; then "$POD2MAN" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \ + $DATEPARAM \ --section "$section" -c "Virtualization Support" --name "$name" \ --release "$PACKAGE_NAME-$PACKAGE_VERSION" \ < $tmpdir/full.pod > "$man_output".tmp -- 1.7.10.4
On Tue, Jul 10, 2012 at 10:15:57AM +0200, Hilko Bengen wrote:
--- podwrapper.sh.in | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/podwrapper.sh.in b/podwrapper.sh.in index ec750f1..9198f63 100755 --- a/podwrapper.sh.in +++ b/podwrapper.sh.in @@ -53,6 +53,13 @@ if [ -z "$abs_top_builddir" ]; then exit 1 fi
+if [ -e $abs_top_srcdir/ChangeLog ]; then + DATEPARAM=`awk '/^[0-9]+-[0-9]+-[0-9]+/ { print "--date=" $1; exit }' \ + $abs_top_srcdir/ChangeLog` +else if [ -d $abs_top_srcdir/.git ]; then + DATEPARAM=`git show -s --format=%ci | awk '{print "--date=" $1}'` +else + declare -a inserts declare -a pattern declare -a indent @@ -167,6 +174,7 @@ fi # Now generate the final output format(s). if [ -n "$man_output" ]; then "$POD2MAN" "$POD2_STDERR_OPTION" "$POD2_UTF8_OPTION" \ + $DATEPARAM \ --section "$section" -c "Virtualization Support" --name "$name" \ --release "$PACKAGE_NAME-$PACKAGE_VERSION" \ < $tmpdir/full.pod > "$man_output".tmp -- 1.7.10.4
ACK, please push this. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
participants (2)
-
Hilko Bengen -
Richard W.M. Jones