Re: Implementing notrans_man_MANS
On Tue, 11 Mar 2008, Ralf Wildenhues wrote: Having one test is fine, and it looks good, too. I suppose we might want to change the MANS line and the install-manX rules to be flattened, they already look pretty ugly in the Makefile. But that can happen in a followup patch. Hello Ralf, I guess that could mean a rule starting with install-man6: dist_man_MANS man_MANS nodist_man_MANS notrans_dist_man_MANS notrans_man_MANS \ notrans_nodist_man_MANS notrans_nodist_man_MANS If so, that would make grep '^install-man6:' Makefile.in | grep '\$(notrans_nodist_man_MANS)' in the present notrans.test FAIL. Maybe it would then be better that the notrans.test script creates none of the files and have them all created by make rules. (At one time I was not sure if Automake complains if some of these files are missing.) To really test these dependencies one could even do: rm -f foo.1 z-baz.man $MAKE install-man1 rm -f bar.2 z-bar.man $MAKE install-man2 and so on. Regards, Peter
Re: Implementing notrans_man_MANS
On Thu, 6 Mar 2008, Ralf Wildenhues wrote: * Peter Breitenlohner wrote on Thu, Mar 06, 2008 at 01:27:05PM CET: or still something else. If so please indicate what. Oh sorry, I was in a hurry and not thinking. What I meant was that while you can't wrap arbitrary lines ending in backslash-newline in `if %?NOTRANS_MANS%/else/endif', you can do so at a finer grainage than whole rules: it's just that it won't work after lines ending in backslash. To some extent this is independent of the question you ask about the rule target names: whether you interleave trans and notrans in the .am file and whether you give trans and notrans different target names need not be dealt with at the same time. So please for now leave you patch as is, but only change all those NOTR/DOTR prefixes to use if/else/endif (which includes a few lines of duplication in the .am file). Clearer now? If not, then I guess I can also patch that later. Hi Ralf, yes, thanks. However, I can only use if/endif if/endif and not if/else/endif because a section may have trans_ as well as notrans_ man pages. = Attached are revised versions of the three patches. I hope they take care of all your earlier comments. patch-03-notrans_MANS-impl: The new variables names are more or less self explanatory (I hope). I had to use @unsorted_deps = (keys %notrans_vars, keys %trans_vars, keys %notrans_this_sect, keys %trans_this_sect); my @deps = sort @unsorted_deps; instead of my @deps = sort (keys %notrans_vars, keys %trans_vars, keys %notrans_this_sect, keys %trans_this_sect); because this may give a perl warning [sort (...) used as function], resulting in three test (instsh.tes, location.test, warnopts.test) to FAIL. patch-04-notrans_MANS-doc: I have slightly reworded the text preceding the example, and hope this clarifies the intent. patch-05-notrans_MANS-test: notrans.test now contains all combinations. I have incorporated the checks that used to be in man4.test into notrans.test, because otherwise there would have been much repetition. Hope this is OK. If so, remember not to mention man4.test in the ChangLog. If not, I could make that two separate tests. The install-man depedndencies are checked either directly (inspecting Makefile.in) or indirectly (letting make generate the files). = regards Peter Breitenlohner [EMAIL PROTECTED]diff -ur -N -x 'automake.info*' -x version.texi -x stamp-vti automake-1.10.1.orig/automake.in automake-1.10.1/automake.in --- automake-1.10.1.orig/automake.in2008-02-19 18:07:41.0 +0100 +++ automake-1.10.1/automake.in 2008-03-08 00:10:34.0 +0100 @@ -3363,27 +3363,39 @@ # Find all the sections in use. We do this by first looking for # standard sections, and then looking for any additional # sections used in man_MANS. - my (%sections, %vlist); + my (%sections, %notrans_sections, %trans_sections, + %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars); # We handle nodist_ for uniformity. man pages aren't distributed # by default so it isn't actually very important. + foreach my $npfx ('', 'notrans_') +{ foreach my $pfx ('', 'dist_', 'nodist_') { # Add more sections as needed. foreach my $section ('0'..'9', 'n', 'l') { - my $varname = $pfx . 'man' . $section . '_MANS'; + my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; if (var ($varname)) { $sections{$section} = 1; $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; + if ($npfx eq 'notrans_') + { + $notrans_sections{$section} = 1; + $notrans_sect_vars{$varname} = 1; + } + else + { + $trans_sections{$section} = 1; + $trans_sect_vars{$varname} = 1; + } push_dist_common ($varname) if $pfx eq 'dist_'; } } - my $varname = $pfx . 'man_MANS'; + my $varname = $npfx . $pfx . 'man_MANS'; my $var = var ($varname); if ($var) { @@ -3393,28 +3405,87 @@ if (/\.([0-9a-z])([a-z]*)$/) { $sections{$1} = 1; + if ($npfx eq 'notrans_') + { + $notrans_sections{$1} = 1; + } + else + { + $trans_sections{$1} = 1; + } } } $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; + if ($npfx eq 'notrans_') + { +
Re: Implementing notrans_man_MANS
On Wed, 5 Mar 2008, Ralf Wildenhues wrote: Well, here's a review of your patches. If you have time to address the comments, that would be great, otherwise I will eventually do it. Hi Ralf, I will go through your comments and think most of them pose no problem. For the moment just a few remarks/questions: This triple loop is already at 72 iterations. Not good for performance. If this grows further, we may have to access variables in a different manner here. I assume you are worried by the total number of 72 iterations, not by the fact that they come from three nested loops. Given the Automake infrastructure (to the extent I understand it) I see no alternative. +?NOTRY?l2='%NOTRZ%'; \ +?NOTRY?for i in $$l2; do \ ... +?NOTR? $(INSTALL_DATA) $$file $(DESTDIR)$(man%SECTION%dir)/$$inst; \ +?NOTR? done Note to self: should rewrite the above when applying the multi-file install. What is multi-file install? Maybe I don't need to know. Also, the whole thing would probably be a lot more readable if the ?NOTR?/?DOTR? prefixes vanished and were replaced by full rules, wrapped in `if %?NOTRANS_MANS%'. That would be a better name for NOTR, and since it would then only appear a couple of times, it could be longer without pain, too. I have tried to wrap the make rule fragments by something like `if %?XXX%' but failed, maybe I got the syntax wrong. However, from some comments elsewhere I concluded that at present this is not possible. Do you mean something like: install-man: install-man1 install-notrans-man1 install-man1: trans_DEPENDENCIES trans_RULES install-notrans-man1: notrans_DEPENDENCIES notrans_RULES That should not be too difficult. Shall I try it? [EMAIL PROTECTED] must be specified first when used in conjunction with +either @samp{dist_} or @samp{nodist_} (@pxref{Dist}). For instance: Can this limitation be lifted (without making the code much slower)? I wouldn't know how, and there is an analogous limitation elsewhere: nobase_dist_pkgdata_DATA +./configure --program-prefix=gnu- --prefix `pwd`/inst --mandir `pwd`/inst/man Please quote instances of `pwd' for the master testsuite. Like --prefix `pwd`/inst for Windows paths containing spaces? I just copied this from transform.test. A quick grep shows there are still plenty of unquoted pwd's around. BTW: Which one is better: `--prefix PREFIX' or `--prefix=PREFIX'? == In the meantime I have some ideas how to handle manpage translations. Mainly an Autoconf/Automake macro and Makefile.am stuff, plus a little bit of help from Automake. To whom should I send this, when finished to write it up? Regards Peter
Re: Implementing notrans_man_MANS
Hi Peter, * Peter Breitenlohner wrote on Thu, Mar 06, 2008 at 10:43:20AM CET: On Wed, 5 Mar 2008, Ralf Wildenhues wrote: This triple loop is already at 72 iterations. Not good for performance. If this grows further, we may have to access variables in a different manner here. I assume you are worried by the total number of 72 iterations, not by the fact that they come from three nested loops. Given the Automake infrastructure (to the extent I understand it) I see no alternative. Your assumption is correct, and yes, I don't see a simple alternative either. +?NOTRY?l2='%NOTRZ%'; \ +?NOTRY?for i in $$l2; do \ ... +?NOTR? $(INSTALL_DATA) $$file $(DESTDIR)$(man%SECTION%dir)/$$inst; \ +?NOTR? done Note to self: should rewrite the above when applying the multi-file install. What is multi-file install? Maybe I don't need to know. You don't need to know, but I meant this: http://thread.gmane.org/gmane.comp.sysutils.automake.patches/2945/focus=3088 Also, the whole thing would probably be a lot more readable if the ?NOTR?/?DOTR? prefixes vanished and were replaced by full rules, wrapped in `if %?NOTRANS_MANS%'. That would be a better name for NOTR, and since it would then only appear a couple of times, it could be longer without pain, too. I have tried to wrap the make rule fragments by something like `if %?XXX%' but failed, maybe I got the syntax wrong. However, from some comments elsewhere I concluded that at present this is not possible. It is possible but only if you wrap whole rules. You cannot wrap parts. See depend2.am for examples. Do you mean something like: install-man: install-man1 install-notrans-man1 install-man1: trans_DEPENDENCIES trans_RULES install-notrans-man1: notrans_DEPENDENCIES notrans_RULES No. [EMAIL PROTECTED] must be specified first when used in conjunction with +either @samp{dist_} or @samp{nodist_} (@pxref{Dist}). For instance: Can this limitation be lifted (without making the code much slower)? I wouldn't know how, and there is an analogous limitation elsewhere: nobase_dist_pkgdata_DATA Ah ok, I wasn't aware of that. +./configure --program-prefix=gnu- --prefix `pwd`/inst --mandir `pwd`/inst/man Please quote instances of `pwd' for the master testsuite. Like --prefix `pwd`/inst for Windows paths containing spaces? I just copied this from transform.test. A quick grep shows there are still plenty of unquoted pwd's around. Not if you look in git master of Automake. BTW: Which one is better: `--prefix PREFIX' or `--prefix=PREFIX'? Both are accepted. In the meantime I have some ideas how to handle manpage translations. Mainly an Autoconf/Automake macro and Makefile.am stuff, plus a little bit of help from Automake. To whom should I send this, when finished to write it up? Respective bits to auto{conf,[EMAIL PROTECTED], please. Thanks, Ralf
Re: Implementing notrans_man_MANS
* Peter Breitenlohner wrote on Thu, Mar 06, 2008 at 01:27:05PM CET: On Thu, 6 Mar 2008, Ralf Wildenhues wrote: Also, the whole thing would probably be a lot more readable if the ?NOTR?/?DOTR? prefixes vanished and were replaced by full rules, wrapped in `if %?NOTRANS_MANS%'. That would be a better name for NOTR, and since it would then only appear a couple of times, it could be longer without pain, too. Do you mean something like: install-man: install-man1 install-notrans-man1 install-man1: trans_DEPENDENCIES trans_RULES install-notrans-man1: notrans_DEPENDENCIES notrans_RULES No. what then? Maybe this: if only trans install-man1: trans_DEPENDENCIES trans_RULES as before, if only notrans install-man1: notrans_DEPENDENCIES notrans_RULES or if both are present install-man1: trans_DEPENDENCIES notrans_DEPENDENCIES trans_RULES notrans_RULES Pro: much simpler to read Con: duplication of code, harder to maintain or still something else. If so please indicate what. Oh sorry, I was in a hurry and not thinking. What I meant was that while you can't wrap arbitrary lines ending in backslash-newline in `if %?NOTRANS_MANS%/else/endif', you can do so at a finer grainage than whole rules: it's just that it won't work after lines ending in backslash. To some extent this is independent of the question you ask about the rule target names: whether you interleave trans and notrans in the .am file and whether you give trans and notrans different target names need not be dealt with at the same time. So please for now leave you patch as is, but only change all those NOTR/DOTR prefixes to use if/else/endif (which includes a few lines of duplication in the .am file). Clearer now? If not, then I guess I can also patch that later. Thanks, Ralf
Re: Implementing notrans_man_MANS
Hello Peter, * Peter Breitenlohner wrote on Wed, Feb 20, 2008 at 02:20:04PM CET: attached are five patches (the diffs are actually against the result of applying your patch for PR 516 from 2008-01-22): Thanks for your work in this, and sorry for the delay. I saw that your paperwork is now complete, thanks! 2. patch-03-notrans_MANS-impl: The actual implementation of `notrans_'. The patch looks awful but the logic in the resulting patched file should be reasonably clear. Indeed. ;-) At the same time the dependencies for `install-man%SECTION%' have been revised. All make variables not used in Makefile.am are omitted from the install/uninstall rules. All those used in the rules also appear as dependencies. One consequence: make dist_man_MANS='bar.1 baz.5' install-man will only work well if `dist_man_MANS' is used in Makefile.am and Automake has generated the relevant (!notrans_) part of the install-man1 and install-man5 rules. So ... ? Yeah, that kind of thing is to be expected from automake-active variables. Not new in this patch. Please feel free to revise the wording in texinfo, comments, and/or ChangeLog. Well, here's a review of your patches. If you have time to address the comments, that would be great, otherwise I will eventually do it. diff -ur -N -x 'automake.info*' -x version.texi -x stamp-vti automake-1.10.1.orig/automake.in automake-1.10.1/automake.in --- automake-1.10.1.orig/automake.in 2008-02-19 18:07:41.0 +0100 +++ automake-1.10.1/automake.in 2008-02-20 01:52:26.0 +0100 @@ -3363,27 +3363,38 @@ # Find all the sections in use. We do this by first looking for # standard sections, and then looking for any additional # sections used in man_MANS. - my (%sections, %vlist); + my (%sections, %nsections, %tsections, %nvlist, %tvlist, %nsvlist, %tsvlist); Variable naming seems, uhm, a bit hard to read, starting from ugly names and putting more on top. ;-) # We handle nodist_ for uniformity. man pages aren't distributed # by default so it isn't actually very important. + foreach my $npfx ('', 'notrans_') +{ foreach my $pfx ('', 'dist_', 'nodist_') { # Add more sections as needed. foreach my $section ('0'..'9', 'n', 'l') This triple loop is already at 72 iterations. Not good for performance. If this grows further, we may have to access variables in a different manner here. { - my $varname = $pfx . 'man' . $section . '_MANS'; + my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; [...] --- automake-1.10.1.orig/lib/am/mans.am 2008-02-20 09:38:10.0 +0100 +++ automake-1.10.1/lib/am/mans.am2008-02-20 00:50:53.0 +0100 @@ -16,6 +16,20 @@ ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. +## Parameters: +## SECTION string man section +## DEPSstring dependencies +## +## NOTRboolhave notrans_ MANS +## NOTRX string notrans_ man%SECTION%_MANS (if any) +## NOTRY boolhave notrans_ man_MANS +## NOTRZ string notrans_ man_MANS +## +## DOTRboolsame +## DOTRX stringas above +## DOTRY boolwithout +## DOTRZ stringnotrans_ What is the rationale for NOTRY, do the X, Y, Z suffixes have any meaning? I understand NO and DO prefixes. So what about using NOTR_SECT_MANS instead of NOTRX NOTR_NOSECT_MANS instead of NOTRZ consequently NOTR_NSinstead of NOTRY and likewise DOTR*? For NOTR and DOTR see below. man%SECTION%dir = $(mandir)/man%SECTION% ## ## @@ -29,37 +43,65 @@ ?INSTALL-MAN?install-data-am: install-man ?INSTALL-MAN?am__installdirs += $(DESTDIR)$(man%SECTION%dir) .PHONY install-man: install-man%SECTION% -install-man%SECTION%: $(man%SECTION%_MANS) $(man_MANS) +install-man%SECTION%: %DEPS% @$(NORMAL_INSTALL) test -z $(man%SECTION%dir) || $(MKDIR_P) $(DESTDIR)$(man%SECTION%dir) - @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \ +## Handle MANS with notrans_ prefix +?NOTR? @list='%NOTRX%'; \ +## Extract all items from notrans_man_MANS that should go in this section. +## This must be done dynamically to support conditionals. +?NOTRY? l2='%NOTRZ%'; \ +?NOTRY? for i in $$l2; do \ +?NOTRY?case $$i in \ +## Have to accept files like `foo.1c'. +?NOTRY? *.%SECTION%*) list=$$list $$i ;; \ +?NOTRY?esac; \ +?NOTRY? done; \ +?NOTR? for i in $$list; do \ +## Find the file. +?NOTR? if test -f $$i; then file=$$i; \ +?NOTR? else file=$(srcdir)/$$i; fi; \ +## Change the extension if needed. +?NOTR? ext=`echo $$i | sed -e 's/^.*\\.//'`; \ +?NOTR? case $$ext in \ +?NOTR? %SECTION%*) ;; \ +?NOTR? *) ext='%SECTION%' ;; \ +?NOTR? esac; \ +## Extract basename of
Re: Implementing notrans_man_MANS
On Tue, 19 Feb 2008, Ralf Wildenhues wrote: How should I proceed, once all that is finished? Email to you and/or automake bugzilla? automake-patches@gnu.org is best. Are unified diffs against the autoamke-1.10.1 tarball OK? Yes. What about re-indenting existing code? Please as a separate patch if possible, and please following the already-used style. Hallo Ralf, attached are five patches (the diffs are actually against the result of applying your patch for PR 516 from 2008-01-22): 1. patch-02-notrans_MANS-reindent: Reindentation of a section in automake.in, anticipating an additional foreach loop (it was less work to do this first). 2. patch-03-notrans_MANS-impl: The actual implementation of `notrans_'. The patch looks awful but the logic in the resulting patched file should be reasonably clear. At the same time the dependencies for `install-man%SECTION%' have been revised. All make variables not used in Makefile.am are omitted from the install/uninstall rules. All those used in the rules also appear as dependencies. One consequence: make dist_man_MANS='bar.1 baz.5' install-man will only work well if `dist_man_MANS' is used in Makefile.am and Automake has generated the relevant (!notrans_) part of the install-man1 and install-man5 rules. So ... ? 3. patch-04-notrans_MANS-doc: Texinfo documentation for the notrans_ prefix. 4. patch-05-notrans_MANS-test: Two new test cases for missing dependencies and the notrans_ prefix. 5. automake-1.10.1-ChangeLog: Proposed ChangeLog entry. == Please feel free to revise the wording in texinfo, comments, and/or ChangeLog. regards Peter Breitenlohner [EMAIL PROTECTED]Prepare for implementation of notrans_man_MANS: anticipate an additional foreach loop and reindent accordingly. Note: `diff -b' yields nothing. diff -ur -N automake-1.10.1.orig/automake.in automake-1.10.1/automake.in --- automake-1.10.1.orig/automake.in2008-01-21 23:11:41.0 +0100 +++ automake-1.10.1/automake.in 2008-02-19 18:07:41.0 +0100 @@ -3366,42 +3366,42 @@ my (%sections, %vlist); # We handle nodist_ for uniformity. man pages aren't distributed # by default so it isn't actually very important. - foreach my $pfx ('', 'dist_', 'nodist_') -{ - # Add more sections as needed. - foreach my $section ('0'..'9', 'n', 'l') + foreach my $pfx ('', 'dist_', 'nodist_') { - my $varname = $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) + # Add more sections as needed. + foreach my $section ('0'..'9', 'n', 'l') { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; + my $varname = $pfx . 'man' . $section . '_MANS'; + if (var ($varname)) + { + $sections{$section} = 1; + $varname = '$(' . $varname . ')'; + $vlist{$varname} = 1; - push_dist_common ($varname) - if $pfx eq 'dist_'; + push_dist_common ($varname) + if $pfx eq 'dist_'; + } } - } - my $varname = $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) - { - foreach ($var-value_as_list_recursive) + my $varname = $pfx . 'man_MANS'; + my $var = var ($varname); + if ($var) { - # A page like `foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) + foreach ($var-value_as_list_recursive) { - $sections{$1} = 1; + # A page like `foo.1c' goes into man1dir. + if (/\.([0-9a-z])([a-z]*)$/) + { + $sections{$1} = 1; + } } - } - $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; - push_dist_common ($varname) - if $pfx eq 'dist_'; + $varname = '$(' . $varname . ')'; + $vlist{$varname} = 1; + push_dist_common ($varname) + if $pfx eq 'dist_'; + } } -} return unless %sections; diff -ur -N -x 'automake.info*' -x version.texi -x stamp-vti automake-1.10.1.orig/automake.in automake-1.10.1/automake.in --- automake-1.10.1.orig/automake.in2008-02-19 18:07:41.0 +0100 +++ automake-1.10.1/automake.in 2008-02-20 01:52:26.0 +0100 @@ -3363,27 +3363,38 @@ # Find all the sections in use. We do this by first looking for # standard sections, and then looking for any additional # sections used in man_MANS. - my (%sections, %vlist); + my (%sections, %nsections, %tsections, %nvlist, %tvlist, %nsvlist, %tsvlist); # We handle nodist_ for uniformity. man pages aren't distributed # by default so it isn't actually very important. + foreach my $npfx ('', 'notrans_') +{