[med-svn] [phast] 01/01: Enhance help2man usage

Andreas Tille tille at debian.org
Sun Jun 5 15:54:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository phast.

commit 7873514d069b5fbaee71b3520949ad32f3deab67
Author: Andreas Tille <tille at debian.org>
Date:   Sun Jun 5 15:28:25 2016 +0200

    Enhance help2man usage
---
 debian/help2man_wrapper                           | 20 ++++++++++++++++++++
 debian/patches/use_debian_packaged_help2man.patch |  6 +++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/debian/help2man_wrapper b/debian/help2man_wrapper
new file mode 100755
index 0000000..b8fc5a0
--- /dev/null
+++ b/debian/help2man_wrapper
@@ -0,0 +1,20 @@
+#!/bin/sh
+curdir=$(pwd)
+cd `dirname $0`/..
+PHAST_VERSION=$(dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/+dfsg//')
+cd $curdir
+
+desc=`$1 -h | grep -v '^[[:space:]]*$' | sed -e '/DESCRIPTION/{N;s/DESCRIPTION:[[:space:]]*\n[[:space:]]*/DESCRIPTION: /;}' | grep DESCRIPTION: | sed 's/DESCRIPTION: *//'`
+
+tmpout=`mktemp`
+if [ "$desc" = "" ] ; then
+    /usr/bin/help2man --no-info --no-discard-stderr --version-string="${PHAST_VERSION}" --help-option='-h' $1 > $tmpout
+else
+    /usr/bin/help2man --name="$desc" --no-info --no-discard-stderr --version-string="${PHAST_VERSION}" --help-option='-h' $1 > $tmpout
+fi
+cat $tmpout | \
+	sed -e 's?USAGE:        ../bin/?.SH USAGE\n?' \
+	    -e 's?../bin/??' \
+	    -e '/^\.SH DESCRIPTION/{;N;N;N;N;s/\(.SH DESCRIPTION\n\).*DESCRIPTION:[[:space:]]*/\1/;}' \
+	    -e 's/.SS "OPTIONS:"/.SH OPTIONS/'
+rm $tmpout
diff --git a/debian/patches/use_debian_packaged_help2man.patch b/debian/patches/use_debian_packaged_help2man.patch
index 92c0794..9a1fe7e 100644
--- a/debian/patches/use_debian_packaged_help2man.patch
+++ b/debian/patches/use_debian_packaged_help2man.patch
@@ -9,13 +9,13 @@ Description: Debian packaged help2man creates better results
  	mkdir -p ../doc/man/
  	@echo "Generating man pages..."
 -	@for file in `ls ../bin` ; do perl help2man.pl ../bin/$$file ../doc/man/ ; done
-+	@for file in `ls ../bin` ; do help2man --no-info --no-discard-stderr --version-string="$(PHAST_VERSION)" ../bin/$$file > ../doc/man/$${file}.1 ; done
++	@for file in `ls ../bin` ; do ../debian/help2man_wrapper ../bin/$$file > ../doc/man/$${file}.1 ; done
  	@echo "Done."
  endif
  
-@@ -41,4 +41,4 @@ clean:
+@@ -41,4 +42,4 @@ clean:
  	rm -rf ../bin ../lib ../doc
  
  manpages:
 -	@for file in `ls ../bin` ; do perl help2man.pl ../bin/$$file ; done
-+	@for file in `ls ../bin` ; do help2man --no-info --no-discard-stderr --version-string="$(PHAST_VERSION)" ../bin/$$file > ../doc/man/$${file}.1 ; done
++	@for file in `ls ../bin` ; do ../debian/help2man_wrapper ../bin/$$file > ../doc/man/$${file}.1 ; done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/phast.git



More information about the debian-med-commit mailing list