Subject: bug#34201: Make @setfilename optional in Texinfo files

From: Gavin Smith <[email-masked]>
Date: Sun, 31 Mar 2019 14:33:38 +0100

Is there anybody who has time to look at this issue? The requirement
for a @setfilename line is an unnecessary hurdle to getting Texinfo
and Automake working together. It has been unnecessary for several
years now.

I have a copyright assignment in place for Automake with the FSF, so
all that would be needed would be for someone to have a look at this
patch and apply it for the next Automake release.

On 1/25/19, Gavin Smith <[email-masked]> wrote:
> @setfilename should not be required to occur inside Texinfo files, as it
> makes it harder to get them working.
>
> Earlier on this:
> https://lists.gnu.org/archive/html/automake/2015-09/msg00000.html
>
> Here is a patch.  I added a test which is passing now, but it wasn't
> passing when I first added the test, so am not sure if it is written
> correctly.  I based it on the existing test
> t/txinfo-setfilename-repeated.sh.
>
> It says GPL version 2 in the licence because that's what was in the
> existing tests, although they should probably all be version 3.
>
> ChangeLog entry:
>
> Do not require @setfilename in Texinfo files.
>
> * bin/automake.in (scan_texinfo_file): Derive name of info file from
> name of input file if no @setfilename line occurs in the file.
> * t/texinfo-no-setfilename.sh: New test.
>
> diff --git a/bin/automake.in b/bin/automake.in
> index b4ae8f4..01e6a58 100644
> --- a/bin/automake.in
> +++ b/bin/automake.in
> @@ -3083,8 +3083,10 @@ sub scan_texinfo_file
>
>    if (! $outfile)
>      {
> -      err_am "'$filename' missing \@setfilename";
> -      return;
> +      # Replace a .texi extension with .info
> +      $outfile = basename($filename);
> +      $outfile =~ s/\.[^.]+$//;
> +      $outfile .= '.info';
>      }
>
>    return ($outfile, $vfile);
> diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
> index 84dd29a..32fca84 100644
> --- a/t/list-of-tests.mk
> +++ b/t/list-of-tests.mk
> @@ -1214,6 +1214,7 @@ t/txinfo-no-clutter.sh \
>  t/txinfo-no-extra-dist.sh \
>  t/txinfo-no-installinfo.sh \
>  t/txinfo-no-repeated-targets.sh \
> +t/txinfo-no-setfilename.sh \
>  t/txinfo-other-suffixes.sh \
>  t/txinfo-override-infodeps.sh \
>  t/txinfo-override-texinfo-tex.sh \
> diff --git a/t/txinfo-no-setfilename.sh b/t/txinfo-no-setfilename.sh
> new file mode 100644
> index 0000000..3ef1730
> --- /dev/null
> +++ b/t/txinfo-no-setfilename.sh
> @@ -0,0 +1,35 @@
> +#! /bin/sh
> +# Copyright (C) 2019 Free Software Foundation, Inc.
> +#
> +# 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, see <https://www.gnu.org/licenses/>.
> +
> +# Check Texinfo files work without a @setfilename line
> +
> +. test-init.sh
> +
> +cat > Makefile.am << 'END'
> +info_TEXINFOS = file.texi
> +END
> +
> +cat > file.texi << 'END'
> +contents
> +END
> +
> +$ACLOCAL
> +$AUTOMAKE --add-missing
> +
> +
> +grep 'file.info:' Makefile.in
> +
> +:
>
>
>
>