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

2009-03-07 Thread Peter Breitenlohner

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 p...@mppmu.mpg.de




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

2009-03-07 Thread Ralf Wildenhues
Hello Peter,

* Peter Breitenlohner wrote on Sat, Mar 07, 2009 at 04:56:10PM CET:
 On Sat, 7 Mar 2009, Ralf Wildenhues wrote:

 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.

 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.

Let's not go this way.  The current git master version works well in
this regard, with less than a dozen forks per 40 manpages that go in
the same directory, of those typically only one or two `install'
commands (which are by far the most expensive of them).

 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?

Well, your scheme still forks once per file, when computing $ext.
Don't worry about it, I'm not interested in making branch-1-10 faster,
all that work has gone into git master already and will be in 1.11.

 +# 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)?

Erm, I've already done all that in the patch that I posted; and I have
applied to master.  So there is nothing left to do on this topic, except
to argue (if you want) that this should be fixed in branch-1-10.  :-)

Cheers,
Ralf