Bug#783475: texi2html: [PATCH] Allow make the build of documentation reproducible adding the use-date flag.
Package: texi2html Version: 1.82+dfsg1 Severity: normal Tags: patch User: reproducible-bui...@lists.alioth.debian.org Hi! While working on the "reproducible builds" effort [1], we have noticed that texi2html could not allow to built documentation reproducibly. The attached patch adds the flag use-date that allows use the given string for the date, instead the generated timestamps. Once applied, we can build reproducibly the packages that use texi2html for generate documentation in our current experimental framework. [1]: https://wiki.debian.org/ReproducibleBuilds -- System Information: Debian Release: 8.0 APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Description: Add flag use-date Allow make the build of documentation reproducible using the value given in the command line for use instead of date timestamp. Author: Juan Picca Last-Update: 2015-04-26 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/texi2html.init +++ b/texi2html.init @@ -260,6 +260,10 @@ $MONOLITHIC = 1; # the specified url are used as stylesheet links @CSS_REFS = (); +# -use-date +# the specified string is used as date timestamp in generated files +$USE_DATE = undef; + ## # The following options are only relevant if $L2H is set # --- a/texi2html.pl +++ b/texi2html.pl @@ -261,6 +261,7 @@ $EXTERNAL_DIR $IGNORE_PREAMBLE_TEXT @CSS_FILES @CSS_REFS +$USE_DATE $INLINE_CONTENTS $INLINE_INSERTCOPYING ); @@ -1910,6 +1911,8 @@ sub set_date() } $Texi2HTML::THISDOC{'today'} = $Texi2HTML::Config::DATE if (defined($Texi2HTML::Config::DATE)); +$Texi2HTML::THISDOC{'today'} = $Texi2HTML::Config::USE_DATE +if (defined($Texi2HTML::Config::USE_DATE)); $::things_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'}; $::pre_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'}; $::texi_map_ref->{'today'} = $Texi2HTML::THISDOC{'today'}; @@ -2600,6 +2603,13 @@ $T2H_OPTIONS -> {'css-ref'} = verbose => 'generate reference to the CSS URL $s' }; +$T2H_OPTIONS -> {'use-date'} = +{ + type => '=s', + linkage => \$Texi2HTML::Config::USE_DATE, + verbose => 'use given date in generation timestamps $s' +}; + $T2H_OPTIONS -> {'transliterate-file-names'} = { type => '!', --- a/doc/texi2html.texi +++ b/doc/texi2html.texi @@ -853,6 +853,9 @@ This command line switch provides for th to a Cascading Style Sheet (@acronym{CSS}) URL. More than one URL may be specified (array @variable{@@CSS_REFS}). +@item @longopt{use-date=@var{DATE}} +This command line uses the given date in place of generated timestamps. + @item @longopt{html-xref-prefix=@var{path}} This option sets the base directory for external @acronym{HTML} texinfo manuals (variable @variable{$EXTERNAL_DIR}). Defaults to @samp{../}. --- a/doc/texi2html.info +++ b/doc/texi2html.info @@ -700,6 +700,9 @@ Miscalleneous style changes may be achie to a Cascading Style Sheet (CSS) URL. More than one URL may be specified (array `@CSS_REFS'). +`--use-date=DATE' +This command line uses the given date in place of generated timestamps. + `--html-xref-prefix=PATH' This option sets the base directory for external HTML texinfo manuals (variable `$EXTERNAL_DIR'). Defaults to `../'.
Bug#783478: texi2html: [PATCH] Please make the build reproducible
Package: texi2html Version: 1.82+dfsg1 Severity: normal Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps Hi! While working on the "reproducible builds" effort [1], we have noticed that texi2html could not be built reproducibly. The attached patch removes extra timestamps from the build system and ensure a stable file order when creating the source archive. Once applied, texi2html can be built reproducibly in our current experimental framework. [1]: https://wiki.debian.org/ReproducibleBuilds NOTE: THIS PATCH DEPENDS OF https://bugs.debian.org/783475 -- System Information: Debian Release: 8.0 APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Description: Make the build reproducible This patch uses "dpkg-parsechangelog" instead of "mdate-sh" in configure.ac. A previous patch modifies the file configure.ac, changing his last modified time avoiding make the build reproducible. Due not usage the file mdate-sh is removed. Author: Juan Picca Last-Update: 2015-04-26 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ dnl --enable-maintainer-mode argument. AM_MAINTAINER_MODE dnl Misc variable settings -PACKAGE_DATE=`"$srcdir"/mdate-sh "$srcdir"/configure.ac` +PACKAGE_DATE=`dpkg-parsechangelog -S date` AC_SUBST([PACKAGE_DATE]) dnl Checks for programs. --- a/doc/mdate-sh +++ /dev/null @@ -1,201 +0,0 @@ -#!/bin/sh -# Get modification time of a file or directory and pretty-print it. - -scriptversion=2005-06-29.22 - -# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software -# Foundation, Inc. -# written by Ulrich Drepper , June 1995 -# -# 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 -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No file. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) -cat <<\EOF -Usage: mdate-sh [--help] [--version] FILE - -Pretty-print the modification time of FILE. - -Report bugs to . -EOF -exit $? -;; - -v | --v*) -echo "mdate-sh $scriptversion" -exit $? -;; -esac - -# Prevent date giving response in another language. -LANG=C -export LANG -LC_ALL=C -export LC_ALL -LC_TIME=C -export LC_TIME - -# GNU ls changes its time format in response to the TIME_STYLE -# variable. Since we cannot assume `unset' works, revert this -# variable to its documented default. -if test "${TIME_STYLE+set}" = set; then - TIME_STYLE=posix-long-iso - export TIME_STYLE -fi - -save_arg1=$1 - -# Find out how to get the extended ls output of a file or directory. -if ls -L /dev/null 1>/dev/null 2>&1; then - ls_command='ls -L -l -d' -else - ls_command='ls -l -d' -fi - -# A `ls -l' line looks as follows on OS/2. -# drwxrwx---0 Aug 11 2001 foo -# This differs from Unix, which adds ownership information. -# drwxrwx--- 2 root root 4096 Aug 11 2001 foo -# -# To find the date, we split the line on spaces and iterate on words -# until we find a month. This cannot work with files whose owner is a -# user named `Jan', or `Feb', etc. However, it's unlikely that `/' -# will be owned by a user whose name is a month. So we first look at -# the extended ls output of the root directory to decide how many -# words should be skipped to get the date. - -# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set x`ls -l -d /` - -# Find which argument is the month. -month= -command= -until test $month -do - shift - # Add a
Bug#783475: texi2html: [PATCH] Allow make the build of documentation reproducible adding the use-date flag.
Package: texi2html Version: 1.82+dfsg1-3 Followup-For: Bug #783475 Modified patch after comments and advices of Jérémy Bobbio. The option was renamed to --build-date and now expects an unix time integer which is formatted using pretty_time instead of using a given string to show as timestamp. -- System Information: Debian Release: stretch/sid APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Description: Add --build-date command line flag. Allow create reproducible documentation passing a unix time in the command line. Author: Juan Picca Last-Update: 2015-05-16 --- a/T2h_i18n.pm +++ b/T2h_i18n.pm @@ -295,7 +295,14 @@ sub pretty_date($) my $lang = shift; my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); -($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); +if ($Texi2HTML::Config::BUILD_DATE) +{ +($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime($Texi2HTML::Config::BUILD_DATE); +} +else +{ +($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); +} $year += ($year < 70) ? 2000 : 1900; # obachman: Let's do it as the Americans do #return($MONTH_NAMES->{$lang}[$mon] . ", " . $mday . " " . $year); --- a/texi2html.init +++ b/texi2html.init @@ -260,6 +260,10 @@ $MONOLITHIC = 1; # the specified url are used as stylesheet links @CSS_REFS = (); +# -build-date +# Use the given unix time as build date showing UTC timezone when it is used +$BUILD_DATE = undef; + ## # The following options are only relevant if $L2H is set # --- a/texi2html.pl +++ b/texi2html.pl @@ -261,6 +261,7 @@ $EXTERNAL_DIR $IGNORE_PREAMBLE_TEXT @CSS_FILES @CSS_REFS +$BUILD_DATE $INLINE_CONTENTS $INLINE_INSERTCOPYING ); @@ -2600,6 +2601,13 @@ $T2H_OPTIONS -> {'css-ref'} = verbose => 'generate reference to the CSS URL $s' }; +$T2H_OPTIONS -> {'build-date'} = +{ + type => '=i', + linkage => \$Texi2HTML::Config::BUILD_DATE, + verbose => 'use the given unix time as build date showing UTC timezone when it is used' +}; + $T2H_OPTIONS -> {'transliterate-file-names'} = { type => '!', --- a/doc/texi2html.texi +++ b/doc/texi2html.texi @@ -523,6 +523,8 @@ Display a short help and exit. Be verbose. @item @longopt{version} Display version information and exit. +@item @longopt{build-date=@var{unixtime}} +Use the given unix time as build date showing UTC timezone when it is used. @end table @c --- a/doc/texi2html.info +++ b/doc/texi2html.info @@ -435,6 +435,9 @@ Miscellaneous general options: `--version' Display version information and exit. +`--build-date=UNIXTIME' + Use the given unix time as build date showing UTC timezone when it is used. + File: texi2html.info, Node: Splitting output, Next: Output files, Prev: General options, Up: Invoking texi2html
Bug#783478: texi2html: [PATCH] Please make the build reproducible
You are right, Johannes. I changed the flag name without notice it. With the change done by Maria (#783475) now we can remove the --build-date flag (i hope) Also, now the reproducible build fails due the date in copied files, (dist_images_DATA in Makefile.am, etc). Please, give me some days to figure it and fix it. Greetings, JMPC On Sat, Aug 8, 2015 at 3:41 AM, Johannes Schauer wrote: > Hi Juan, > > On Mon, 27 Apr 2015 08:09:03 -0300 Juan Picca wrote: >> The attached patch removes extra timestamps from the build system and >> ensure a stable file order when creating the source archive. Once >> applied, texi2html can be built reproducibly in our current experimental >> framework. > > thanks for your patch! > > I'm considering to NMU this package together with this patch of yours but am > having some questions about your patch before. > > 1. In your patch you remove ./mdate-sh and ./doc/mdate-sh. This removal makes > your patch quite big. Why do those files have to be removed and cannot > stay > to minimize the size of the patch? > > 2. you call texi2html.pl with --use-date but in #783475 you renamed the > command line option to --build-date > > 3. the updated patch in #783475 allows texi2html to use $SOURCE_DATE_EPOCH. > So > maybe instead of patching upstreams ./doc/Makefile.am and > ./doc/Makefile.in, you should instead not patch these files but just > export > $SOURCE_DATE_EPOCH in debian/rules > > 4. in doc/Makefile.in you are moving the line calling mdate-sh around. Why? > > 5. you are patching ./configure.ac in addition to ./configure. But either > ./configure does get regenerated from ./configure.ac (and in this case you > do not need to patch ./configure) or ./configure does not get regenerated > from ./configure.ac (and in this case you do not need to patch > ./configure.ac). I'd prefer if configure was regenerated at build time. > > Thanks again for your contribution! > > cheers, josch -- To UNSUBSCRIBE, email to debian-qa-packages-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/ca+fvr_xvpnsij2wmbjs8n6ofoc3vtbsgvhb8kbbhgkfl8e_...@mail.gmail.com