From: Peter Breitenlohner Date: Sat, 7 Mar 2009 00:06:18 +0000 (+0100) Subject: Extract correct man section from files in man_MANS. X-Git-Tag: v1.10b~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b34573760e626b558a59ea30f8ab58b76b43082a;p=thirdparty%2Fautomake.git Extract correct man section from files in man_MANS. * lib/am/mans.am: Extract correct man section in the presence of multiple dots in the file base name and/or directory components. * tests/man5.test: New test case. * tests/Makefile.am: Update. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 49c2543c1..5aff609ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-03-07 Peter Breitenlohner + Ralf Wildenhues + + Extract correct man section from files in man_MANS. + * lib/am/mans.am: Extract correct man section in the presence of + multiple dots in the file base name and/or directory components. + * tests/man5.test: New test case. + * tests/Makefile.am: Update. + 2009-03-06 Ralf Wildenhues * doc/automake.texi (maintainer-mode): Fix logic in diff --git a/lib/am/mans.am b/lib/am/mans.am index 803a89227..d3891451f 100644 --- a/lib/am/mans.am +++ b/lib/am/mans.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008 Free Software +## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008, 2009 Free Software ## Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -38,10 +38,9 @@ if %?NOTRANS_MANS% { for i in $$list; do echo "$$i"; done; \ ## 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; \ -?HAVE_NOTRANS? done; \ +?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \ +## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'. +?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \ ## Extract basename of manpage, change the extension if needed. } | while read p; do \ ## Find the file. @@ -71,10 +70,9 @@ if %?TRANS_MANS% { for i in $$list; do echo "$$i"; done; \ ## Extract all items from notrans_man_MANS that should go in this section. ## This must be done dynamically to support conditionals. -?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do \ -## Accept files like `foo.1c'. -?HAVE_TRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \ -?HAVE_TRANS? done; \ +?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \ +## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'. +?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \ ## Extract basename of manpage, change the extension if needed. } | while read p; do \ ## Find the file. @@ -116,10 +114,9 @@ if %?NOTRANS_MANS% files=`{ for i in $$list; do echo "$$i"; done; \ ## 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; \ -?HAVE_NOTRANS? done; \ +?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \ +## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'. +?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \ ## Extract basename of manpage, change the extension if needed. } | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \ test -n "$$files" || exit 0; \ @@ -132,10 +129,9 @@ if %?TRANS_MANS% files=`{ for i in $$list; do echo "$$i"; done; \ ## Extract all items from man_MANS that should go in this section. ## This must be done dynamically to support conditionals. -?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do \ -## Accept files like `foo.1c'. -?HAVE_TRANS? case $$i in *.%SECTION%*) echo "$$i";; esac; \ -?HAVE_TRANS? done; \ +?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \ +## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'. +?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \ ## Extract basename of manpage, run it through the program rename ## transform, and change the extension if needed. } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 2d8a9741c..d4687f47d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -398,6 +398,7 @@ man.test \ man2.test \ man3.test \ man4.test \ +man5.test \ mclean.test \ mdate.test \ mdate2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 92434abd0..dc0a339c1 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -553,6 +553,7 @@ man.test \ man2.test \ man3.test \ man4.test \ +man5.test \ mclean.test \ mdate.test \ mdate2.test \ diff --git a/tests/man5.test b/tests/man5.test new file mode 100755 index 000000000..626602aa1 --- /dev/null +++ b/tests/man5.test @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (C) 2009 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 3, 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 . + +# Make sure to extract the correct mansection from files in man_MANS. + +. ./defs || Exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am << 'END' +man_MANS = foo-1.4.5/foo.2 foo-1.4.5/bar.3 baz-1.4.2 +notrans_man_MANS = foo-1.4.5/nfoo.2 foo-1.4.5/nbar.3 nbaz-1.4.2 +END + +mkdir foo-1.4.5 + +: > foo-1.4.5/foo.2 +: > foo-1.4.5/nfoo.2 +: > foo-1.4.5/bar.3 +: > foo-1.4.5/nbar.3 +: > baz-1.4.2 +: > nbaz-1.4.2 + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +# Let's play with $DESTDIR too, it shouldn't hurt. +./configure --mandir=/man +DESTDIR="`pwd`/_inst" $MAKE -e install + +test -f ./_inst/man/man2/foo.2 +test -f ./_inst/man/man2/nfoo.2 +test -f ./_inst/man/man2/baz-1.4.2 +test -f ./_inst/man/man2/nbaz-1.4.2 +test -f ./_inst/man/man3/bar.3 +test -f ./_inst/man/man3/nbar.3 + +test ! -d ./_inst/man/man1 +test ! -d ./_inst/man/man4 +test ! -d ./_inst/man/man5 + +DESTDIR="`pwd`/_inst" $MAKE -e uninstall + +test ! -f ./_inst/man/man2/foo.2 +test ! -f ./_inst/man/man2/nfoo.2 +test ! -f ./_inst/man/man2/baz-1.4.2 +test ! -f ./_inst/man/man2/nbaz-1.4.2 +test ! -f ./_inst/man/man3/bar.3 +test ! -f ./_inst/man/man3/nbar.3 + +: