bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automake/535: Extract correct man section from files in MAN_MANS


From: Peter Breitenlohner
Subject: Re: automake/535: Extract correct man section from files in MAN_MANS
Date: Sat, 7 Mar 2009 16:56:10 +0100 (CET)
User-agent: Alpine 1.10 (LNX 962 2008-03-14)

On Sat, 7 Mar 2009, Ralf Wildenhues wrote:

Attached is a small patch (current git) correcting this problem.

@@ -39,8 +39,8 @@ if %?NOTRANS_MANS%
 ## Extract all items from notrans_man_MANS that should go in this section.
 ## This must be done dynamically to support conditionals.
 ?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do \
-## Accept files like `foo.1c'.
-?HAVE_NOTRANS?   case $$i in *.%SECTION%*) echo "$$i";; esac; \
+## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
+?HAVE_NOTRANS?   case `echo $$i | sed -e 's,.*\.,,'` in %SECTION%*) echo 
"$$i";; esac; \
 ?HAVE_NOTRANS? done; \
 ## Extract basename of manpage, change the extension if needed.
        } | while read p; do \

This has the disadvantage that we're now again forking at least twice
per installed file.  The point of the install rule changes in master
was to make them faster!  :-)

I don't know a good way to fix this without adding any forks at all, but
the patch below fixes the issue for master with adding two forks per set
of man pages installed.  It uses the same regex for matching the section
as is used in automake.in.

Hallo Ralf,

actually, I never thought about that aspect.

I think there is a way to reduce the number of forks, replacing the two
loops by one such that one could extract ext rather early and reuse it later
on.  However, this would be major surgery and require extensive testing.

The idea is roughly this, e.g., for the install-man1 target:

dot_seen=no
for i in $(man1_MANS) . $(man_MANS); do
  if test "x$i" = x.; then
    dot_seen=yes
    continue
  fi
  ext=`echo $i | sed -e 's/^.*\\.//'`
  case $ext in
    1*) ;;
    *) if test $dot_seen = yes; then
         continue
       else
         ext=1
       fi ;;
  esac
  [proceed as now, reusing the ext extracted above]
done

Could also be 'dot_seen=false', 'dot_seen=:', and 'if $dot_seen; then'.

This is for branch-1-10. Perhaps something analogous can be done for the new
scheme in git master (just updated my local copy, still have to study it).

Comments?

+# Let's play with $DESTDIR too, it shouldn't hurt.
+./configure --prefix='' --mandir=/man

Let's just omit --prefix here, rather than passing an empty one.
Also, let's add a 'make uninstall' as well as the notrans man pages,
so all changed code paths are exercised; and rename a bit, so we can
better test that no wrong directories are created.

Shall I try to do that, or will you (knowing better exactly what you have in
mind)?

Regards,
Peter Breitenlohner <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]