[I started a new thread for this, because the topic is quite
unrelated to whether help2man should include NLS or not.]

On 09/11/2013 07:45 AM, Bernhard Voelker wrote:> [re-adding the list]
> [...] besides the NLS issue above, the is yet another
> one:
> 
> The files help2man.{in,diff} are missing in the distribution:
> 
>   make[2]: *** No rule to make target `man/help2man.in', \
>   needed by `man/help2man'.  Stop.
> 
> And this in turn means that we'd need patch(1) in a distribution
> build.  I'd like to avoid this new dependency.
> In the coreutils-specific 'help2man.diff', there are 2 things
> going on:
> a) Remove the line
>    "For complete documentation, run: info coreutils 'PRG invocation'"
>    This can be done with a `sed '/For complete/d'` afterwards.
> b) Changing the pointer to the info page from "info PRG" to
>    "info coreutils 'PRG invocation'".
>    We can use help2man's --info-page=... option for this.
> After that, we can use the original 'help2man' without the need
> for patching it in the distribution tarball.
> I'll come up with a patch soon.

The attached patch moves the new (NLS-enabled) upstream 'help2man'
back to it's original place without the need for patching it, and
above all without the newly introduced requirement to have the
patch(1) utility in distribution builds.

WDYT?

Have a nice day,
Berny

>From 2e880b27c6c4c15b2ef9db5d991be0908f429ae4 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Thu, 12 Sep 2013 00:02:33 +0200
Subject: [PATCH] maint: avoid patching help2man

Commit cde1ea0e separated the coreutils-specific patches from help2man.
Most changes had been made to accommodate to the coreutils style guide,
i.e., to avoid syntax-check failures like sc_long_lines.
Yet 2 changes had to be put into the patch help2man.diff.
But this added the dependency to patch(1) in distribution builds.
Incidentally, the 2 remaining parts of the patch can easily be
done outside of help2man.  Therefore, this commit partly reverts
the recent separation of help2man into 'help2man.in' and
'help2man.diff', and instead uses the original help2man script.

* man/help2man.in: Rename to ...
* man/help2man: ... this file.
* man/help2man.diff: Remove.
* man/local.mk (mandeps): Remove man/help2man.
(man/help2man): Remove recipe.
(.x.1): Add the --info-page option when calling help2man in order
to change the name of the texinfo manual from the default, "info PRG",
to "info coreutils 'PRG invocation'".
Furthermore, use an sed pattern to remove the sentence starting
with "For complete documentation".
* .gitignore (/man/help2man): Remove entry.
* .x-update-copyright: Replace the entries for the files
'man/help2man.diff' and 'man/help2man.in' by 'man/help2man'.
* cfg.mk (sc_long_lines): Instead of 'man/help2man.in', exempt
'man/help2man' from this test.
(sc_po_check): Likewise.
(sc_space_tab): Instead of 'man/help2man.diff', exempt 'man/help2man'
from this test.
(sc_trailing_blank): Likewise.
(sc_prohibit_tab_based_indentation): Instead of 'man/help2man.in' and
'man/help2man.diff', exempt 'man/help2man'.
* man/dummy-man: Recognize the option --info-page=... as no-op.
---
 .gitignore                    |  1 -
 .x-update-copyright           |  3 +--
 cfg.mk                        | 12 ++++++------
 man/dummy-man                 |  1 +
 man/{help2man.in => help2man} |  0
 man/help2man.diff             | 32 --------------------------------
 man/local.mk                  | 16 +++++-----------
 7 files changed, 13 insertions(+), 52 deletions(-)
 rename man/{help2man.in => help2man} (100%)
 delete mode 100644 man/help2man.diff

diff --git a/.gitignore b/.gitignore
index b03f620..558577d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -134,7 +134,6 @@
 /m4/xsize.m4
 /maint.mk
 /man/*.1
-/man/help2man
 /po/*.gmo
 /po/*.po
 /po/.gitignore
diff --git a/.x-update-copyright b/.x-update-copyright
index 47cb0f4..89f8e8a 100644
--- a/.x-update-copyright
+++ b/.x-update-copyright
@@ -1,3 +1,2 @@
 COPYING
-man/help2man\.diff
-man/help2man\.in
+man/help2man
diff --git a/cfg.mk b/cfg.mk
index 61bda4b..ec91158 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -221,13 +221,13 @@ sc_prohibit-gl-attributes:
 
 # Look for lines longer than 80 characters, except omit:
 # - program-generated long lines in diff headers,
-# - the original help2man script copied from upstream,
+# - the help2man script copied from upstream,
 # - tests involving long checksum lines, and
 # - the 'pr' test cases.
 LINE_LEN_MAX = 80
 FILTER_LONG_LINES =						\
   /^[^:]*\.diff:[^:]*:@@ / d;					\
-  \|^[^:]*man/help2man\.in:| d;			\
+  \|^[^:]*man/help2man:| d;			\
   \|^[^:]*tests/misc/sha[0-9]*sum.*\.pl[-:]| d;			\
   \|^[^:]*tests/pr/|{ \|^[^:]*tests/pr/pr-tests:| !d; };
 sc_long_lines:
@@ -568,10 +568,10 @@ update-copyright-env = \
 
 # List syntax-check exemptions.
 exclude_file_name_regexp--sc_space_tab = \
-  ^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$|man/help2man\.diff$$)
+  ^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$|man/help2man$$)
 exclude_file_name_regexp--sc_bindtextdomain = \
   ^(gl/.*|lib/euidaccess-stat|src/make-prime-list)\.c$$
-exclude_file_name_regexp--sc_trailing_blank = ^(tests/pr/|man/help2man.diff)
+exclude_file_name_regexp--sc_trailing_blank = ^(tests/pr/|man/help2man)
 exclude_file_name_regexp--sc_system_h_headers = \
   ^src/((system|copy)\.h|libstdbuf\.c|make-prime-list\.c)$$
 
@@ -581,7 +581,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
 exclude_file_name_regexp--sc_require_config_h = \
   $(exclude_file_name_regexp--sc_require_config_h_first)
 
-exclude_file_name_regexp--sc_po_check = ^(gl/|man/help2man\.in)
+exclude_file_name_regexp--sc_po_check = ^(gl/|man/help2man)
 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
   ^src/(seq|remove)\.c$$
 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^tests/pr/
@@ -601,7 +601,7 @@ exclude_file_name_regexp--sc_useless_cpp_parens = $(_ll)
 exclude_file_name_regexp--sc_long_lines = $(_ll)
 exclude_file_name_regexp--sc_space_before_open_paren = $(_ll)
 
-tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man\.(in|diff))$$
+tbi_1 = ^tests/pr/|(^gl/lib/reg.*\.c\.diff|\.mk|^man/help2man)$$
 tbi_2 = ^scripts/git-hooks/(pre-commit|pre-applypatch|applypatch-msg)$$
 tbi_3 = (GNU)?[Mm]akefile(\.am)?$$|$(_ll)
 exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
diff --git a/man/dummy-man b/man/dummy-man
index 3069376..dca2b67 100755
--- a/man/dummy-man
+++ b/man/dummy-man
@@ -30,6 +30,7 @@ while test $# -gt 0; do
     # in the makefile.
     --include=*);;
     --include) shift;;
+    --info-page=*);;
     -*) fatal_ "invalid or unrecognized help2man option '$1'";;
     --) shift; break;;
      *) break;;
diff --git a/man/help2man.in b/man/help2man
similarity index 100%
rename from man/help2man.in
rename to man/help2man
diff --git a/man/help2man.diff b/man/help2man.diff
deleted file mode 100644
index 017f4dc..0000000
--- a/man/help2man.diff
+++ /dev/null
@@ -1,32 +0,0 @@
---- man/help2man-orig
-+++ man/help2man	2013-08-01 02:37:57.771389937 +0200
-@@ -435,6 +435,7 @@
- my $PAT_FILES         = _('Files');
- my $PAT_EXAMPLES      = _('Examples');
- my $PAT_FREE_SOFTWARE = _('This +is +free +software');
-+my $PAT_INFO          = _('For +complete +documentation');
- 
- # Start a new paragraph (if required) for these.
- s/([^\n])\n($PAT_BUGS|$PAT_AUTHOR) /$1\n\n$2 /og;
-@@ -467,6 +468,12 @@
- 	next;
-     }
- 
-+    # Skip any texinfo reference as that's handled separately
-+    if (s/($PAT_INFO).*\n//o)
-+    {
-+        next;
-+    }
-+
-     # Copyright section
-     if (/^Copyright /)
-     {
-@@ -645,7 +652,7 @@
- .B %s
- programs are properly installed at your site, the command
- .IP
--.B info %s
-+.B info coreutils \(aq%s invocation\(aq
- .PP
- should give you access to the complete manual.
- EOT
diff --git a/man/local.mk b/man/local.mk
index d967d16..266b780 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -50,9 +50,6 @@ distclean-local:
 # Dependencies common to all man pages.  Updated below.
 mandeps =
 
-# Depend on the help2man script.
-mandeps += man/help2man
-
 # Depend on this to get version number changes.
 mandeps += .version
 
@@ -62,13 +59,6 @@ mandeps += $(top_srcdir)/src/system.h
 
 $(ALL_MANS): $(mandeps)
 
-# Create help2man from the upstream version and out patch.
-man/help2man:    man/help2man.in man/help2man.diff
-	$(AM_V_GEN)cp man/help2man.in man/help2man.tmp \
-	  && VERSION_CONTROL=none patch man/help2man.tmp < man/help2man.diff \
-	  && chmod a+x man/help2man.tmp \
-	  && mv man/help2man.tmp man/help2man
-
 # Most prog.1 man pages depend on src/prog.  List the exceptions:
 # Note that dir and vdir are exceptions only if you consider the name
 # of the .c file upon which they depend: ls.c.
@@ -200,7 +190,11 @@ man/yes.1:       src/yes
 		     --source='$(PACKAGE_STRING)'			\
 		     --include=$(srcdir)/man/$$name.x			\
 		     --output=$$t/$$name.1 $$t/$$name			\
-	  && sed 's|$*\.td/||g' $$t/$$name.1 > $@-t			\
+		     --info-page='coreutils \(aq'$$name' invocation\(aq' \
+	  && sed \
+	       -e 's|$*\.td/||g' \
+	       -e '/For complete documentation/d' \
+	       $$t/$$name.1 > $@-t			\
 	  && rm -rf $$t							\
 	  && chmod a-w $@-t						\
 	  && mv $@-t $@
-- 
1.8.3.1

Reply via email to