On Fri, Aug 09, 2024 at 05:31:32PM +0200, Patrice Dumas wrote:
> Hello,
> 
> The other cases raised by Bruno have been fixed, but this one still
> fails:
> 
> On Tue, Aug 06, 2024 at 06:59:28AM +0200, Bruno Haible wrote:
> > Here's the recipe that currently still fails:
> > 
> > $ ./autogen.sh
> > $ ./configure
> > $ make maintainer-clean
> > $ git diff -- doc/html_default_commands_args.texi doc/pod2texi.texi 
> > man/pod2texi.1 po_document/texinfo_document.pot 
> > tp/Texinfo/XS/gnulib/lib/unicase/special-casing-table.h 
> > tp/Texinfo/XS/gnulib/lib/uninorm/composition-table.h 
> > tp/Texinfo/XS/main/command_ids.h tp/Texinfo/XS/main/element_types.c 
> > tp/Texinfo/XS/main/element_types.h | patch -p1 -R
> > $ mkdir bb
> > $ cd bb
> > $ ../configure
> > $ make distcheck

This passed for me with the attached patch.

> Therefore, when make distcheck in bb calls make dist,
> texi2any_internals.texi is generated in the main doc/tp_api/ directory.
> The --subdir option passed to pod2texi.pl is
> --subdir=../../../doc/tp_api/api_includes, which allows to put the
> generated files in $(srcdir)/api_includes, and looks right.
> 
> However, the --subdir option value is also used in pod2texi.pl for the
> generated @include in texi2any_internals.texi.  Therefore, At this
> point, we have a distributed file with includes like
> 
>   @include ../../../doc/tp_api/api_includes/Texinfo-Convert-Plaintext.texi
> 
> which is different from what would have been generated from an in source
> build, which would be along
> 
>   @include api_includes/Texinfo-Convert-Plaintext.texi
> 
> Having a distributed file with differences is incorrect.  And it leads
> to the error in make distcheck.

With the attached patch, it cd's to srcdir before running pod2texi.
This way pod2texi with --subdir works correctly.

In order for the change of working directory to work correctly, I had
to make a few changes.  texi2any_internals.texi is listed as a Makefile
target without the "$(srcdir)/" prefix.  This still works correctly
due to the VPATH mechanism.  This allows correct use of $@ in the Makefile
rule in the new working directory.

The files in $(texi2any_internals_dependencies) are now listed without the
"$(top_srcdir)/" prefix; rather, they are given a "../../" prefix.  Again,
the VPATH mechanism should allow these files to be found in the srcdir.
The "../../" prefix is still correct for these files after "cd $(srcdir)",
allowing the list of files to be passed to pod2texi correctly.

(I checked that, after running "touch ../../../tp/Texinfo/Common.pm"
in bb/doc/tp_api, that "make" rebuilt texi2any_internals.texi,
even though the dependency is listed as "../../tp/Texinfo/Common.pm".)

Finally, I had to use absolute directory names (abs_top_srcdir and
abs_top_builddir) in MAKEINFO_ENVIRONMENT so that they would still
be still correct after the change of directory; otherwise, ModulePath.pm
wouldn't be found.


> At that point, I am not sure where the problem is.  I could be that
> the testing procedure needs to be modified to complete the git reverse
> patch with a copy of the files removed by maintainer clean but
> distributed.  It could also be that it is not a good idea to remove
> distributed generated files with make maintainer-clean.  It could be
> that the generated includes by pod2texi.pl should be done differently.
> It could be that make dist should only be done from the source directory
> if one want reproducible distributions.

It's possible that the behaviour of pod2texi is wrong here but I don't
have any suggestions as to how it should be changed.

> Here is a recipe to get differences between in source and out of source
> distributions.  There are some changes for generated files, which seem
> innocuous, but may be an issue for reproductibility, as well as the
> difference for texi2any_internals.texi.

Thanks, I'll try it.
diff --git a/doc/tp_api/Makefile.am b/doc/tp_api/Makefile.am
index 677c793232..50d78cd0d9 100644
--- a/doc/tp_api/Makefile.am
+++ b/doc/tp_api/Makefile.am
@@ -16,8 +16,8 @@ AM_MAKEINFOFLAGS = -c INFO_SPECIAL_CHARS_WARNING=0 -c 
TREE_TRANSFORMATIONS=compl
 
 # Use the programs built in our distribution.
 MAKEINFO_ENVIRONMENT = TEXINFO_DEV_SOURCE=1 \
-                       top_srcdir="$(top_srcdir)" \
-                       top_builddir="$(top_builddir)"
+                       top_srcdir="$(abs_top_srcdir)" \
+                       top_builddir="$(abs_top_builddir)"
 MAKEINFO = $(MAKEINFO_ENVIRONMENT) $(PERL) $(top_srcdir)/tp/texi2any.pl
 
 TEXI2DVI_ENVIRONMENT = TEXINDEX=${abs_top_builddir}/texindex/texindex \
@@ -54,33 +54,35 @@ BUILT_SOURCES = texi2any_internals.texi
 # all the modules with some interesting public interfaces.
 # The order matters for the result.
 texi2any_internals_dependencies = \
-  $(top_srcdir)/tp/Texinfo/Commands.pod \
-  $(top_srcdir)/tp/Texinfo/Common.pm \
-  $(top_srcdir)/tp/Texinfo/ParserNonXS.pm \
-  $(top_srcdir)/tp/Texinfo/Document.pm \
-  $(top_srcdir)/tp/Texinfo/ManipulateTree.pm \
-  $(top_srcdir)/tp/Texinfo/Structuring.pm \
-  $(top_srcdir)/tp/Texinfo/Report.pm \
-  $(top_srcdir)/tp/Texinfo/Translations.pm \
-  $(top_srcdir)/tp/Texinfo/Transformations.pm \
-  $(top_srcdir)/tp/Texinfo/Indices.pm \
-  $(top_srcdir)/tp/Texinfo/OutputUnits.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Texinfo.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Utils.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Unicode.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/NodeNameNormalization.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Text.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Converter.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Info.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/HTML.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/DocBook.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/TexinfoMarkup.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/TexinfoXML.pm \
-  $(top_srcdir)/tp/Texinfo/Convert/Plaintext.pm
-
-$(srcdir)/texi2any_internals.texi: $(texi2any_internals_dependencies) 
$(srcdir)/texi2any_internals_indices.texi 
$(srcdir)/texi2any_internals_preamble.texi
-       if $(MAKEINFO_ENVIRONMENT) $(PERL) -I 
$(top_srcdir)/Pod-Simple-Texinfo/lib/ 
$(top_srcdir)/Pod-Simple-Texinfo/pod2texi.pl --base-level=section --preamble - 
--subdir=$(srcdir)/api_includes $(texi2any_internals_dependencies) < 
$(srcdir)/texi2any_internals_preamble.texi >$@.tmp ; then \
-         cat $@.tmp  | sed -e 's/^@bye/@__bye/' | sed -e '/^@__bye/r 
$(srcdir)/texi2any_internals_indices.texi' | sed -e 's/^@__bye//' > $@ ; \
+  ../../tp/Texinfo/Commands.pod \
+  ../../tp/Texinfo/Common.pm \
+  ../../tp/Texinfo/ParserNonXS.pm \
+  ../../tp/Texinfo/Document.pm \
+  ../../tp/Texinfo/ManipulateTree.pm \
+  ../../tp/Texinfo/Structuring.pm \
+  ../../tp/Texinfo/Report.pm \
+  ../../tp/Texinfo/Translations.pm \
+  ../../tp/Texinfo/Transformations.pm \
+  ../../tp/Texinfo/Indices.pm \
+  ../../tp/Texinfo/OutputUnits.pm \
+  ../../tp/Texinfo/Convert/Texinfo.pm \
+  ../../tp/Texinfo/Convert/Utils.pm \
+  ../../tp/Texinfo/Convert/Unicode.pm \
+  ../../tp/Texinfo/Convert/NodeNameNormalization.pm \
+  ../../tp/Texinfo/Convert/Text.pm \
+  ../../tp/Texinfo/Convert/Converter.pm \
+  ../../tp/Texinfo/Convert/Info.pm \
+  ../../tp/Texinfo/Convert/HTML.pm \
+  ../../tp/Texinfo/Convert/DocBook.pm \
+  ../../tp/Texinfo/Convert/TexinfoMarkup.pm \
+  ../../tp/Texinfo/Convert/TexinfoXML.pm \
+  ../../tp/Texinfo/Convert/Plaintext.pm
+
+texi2any_internals.texi: $(texi2any_internals_dependencies) 
$(srcdir)/texi2any_internals_indices.texi 
$(srcdir)/texi2any_internals_preamble.texi
+       cd $(srcdir) ; \
+        top_srcdir=../.. ; \
+       if $(MAKEINFO_ENVIRONMENT) $(PERL) -I 
$${top_srcdir}/Pod-Simple-Texinfo/lib/ 
$${top_srcdir}/Pod-Simple-Texinfo/pod2texi.pl --base-level=section --preamble - 
--subdir=api_includes $(texi2any_internals_dependencies) < 
texi2any_internals_preamble.texi >$@.tmp ; then \
+         cat $@.tmp  | sed -e 's/^@bye/@__bye/' | sed -e '/^@__bye/r 
texi2any_internals_indices.texi' | sed -e 's/^@__bye//' > $@ ; \
        fi ; rm -f $@.tmp
 
 endif

Reply via email to