On Sun, Jan 28, 2024 at 03:36:26PM +0100, Bruno Haible wrote:
> Hi Patrice,
> 
> Patrice Dumas wrote:
>   2. Wait 10 years (or such), until no one uses the older versions
>      any more. Look at https://repology.org/project/texinfo/versions
>      to get a feeling when this time has come.

There are discontinued distros there, so it is a bit misleading, in that
precise case I think that, even though Texinfo 4.13 appears, it is not
really needed as it seems to be either parallel installable or in
discontinued distros.  That being said, it indeed gives a feeling of
what to try to be compatible with.

> Similarly, I think the following piece of code should work to test the
> version of 'makeinfo':
> 
>       case `${MAKEINFO-makeinfo} --version | sed -e 's/^[^0-9]*//' -e 1q` in \
>         [1-6]* | 7.[01]*) false;; \
>         *) true;; \
>       esac

Looks good.

Here is an updated patch.  At least on my side, I think that it is
ready, the only thing that could be added would be a comment with the
actual release number of Texinfo in which --trace-includes appeared. It
may be strange to apply it now, before the Texinfo release, however.  I
can re-propose it after the Texinfo release, you tell me.

-- 
Pat
diff --git a/ChangeLog b/ChangeLog
index 58fd6e5d4c..6a40954843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-01-27  Patrice Dumas  <[email protected]>
+
+	gendocs: get only targetted manual source and includes, when possible
+	* build-aux/gendocs.sh: if makeinfo, based on version, has the
+	--trace-includes option, gather only the targetted manual srcfile and
+	the included files obtained with makeinfo --trace-includes. In that
+	case output include files to tar stdin and use -T-. Bruno Haible for
+	the version comparison and use of tar.
+
 2024-01-27  Paul Eggert  <[email protected]>
 
 	gendocs: allow other chars in source file names
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
index bdf105e02b..be8d8d27a2 100755
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -422,16 +422,41 @@ d=`dirname $srcfile`
   # file names to be put into the .tar.gz for sources.
   # Omit patterns that do not expand to file names.
   pats=
-  for pat in '*.texinfo' '*.texi' '*.txi' '*.eps'; do
-    for file in $pat; do
-      test "$file" = "$pat" && test ! -e "$file" || pats="$pats $pat"
-      break
+
+  if case `$MAKEINFO --version | sed -e 's/^[^0-9]*//' -e 1q` in \
+        [1-6]* | 7.[01]*) false;; \
+        *) true;; \
+      esac \
+   ; then
+
+    for pat in '*.eps'; do
+      for file in $pat; do
+        test "$file" = "$pat" && test ! -e "$file" || pats="$pats $pat"
+        break
+      done
+    done
+
+    # if $MAKEINFO is recent enough, use --trace-includes on the
+    # $srcfile to get the included files of the targetted manual only
+    base=`basename "$srcfile"`
+
+    cmd="$SETLANG $MAKEINFO $commonarg --trace-includes \"$base\""
+    eval "$cmd" | tar -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
+      --verbatim-files-from -T- -- "$base" $pats \
+      ${source_extra+"$source_extra"} &&
+    ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
+  else
+    for pat in '*.texinfo' '*.texi' '*.txi' '*.eps'; do
+     for file in $pat; do
+       test "$file" = "$pat" && test ! -e "$file" || pats="$pats $pat"
+       break
+      done
     done
-  done
 
-  tar -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
-    -- $pats ${source_extra+"$source_extra"} &&
-  ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
+    tar -czhf "$abs_outdir/$PACKAGE.texi.tar.gz" \
+       -- $pats ${source_extra+"$source_extra"} &&
+      ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
+  fi
 ) || exit
 texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
 

Reply via email to