[pkg-haskell-tools] 01/06: Use pandoc instead of help2man

Joachim Breitner nomeata at moszumanska.debian.org
Thu Aug 13 11:47:32 UTC 2015


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

nomeata pushed a commit to branch master
in repository pkg-haskell-tools.

commit c46eb8b77f5d2c7d0a14b466da54b5d6dd2b9f15
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 13 13:23:00 2015 +0200

    Use pandoc instead of help2man
---
 .gitignore       |  2 ++
 debian/changelog |  6 ++++++
 debian/control   |  2 +-
 debian/rules     |  2 +-
 dht              | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 lib/DHT.pm       |  8 ++++++++
 scripts/tag      | 11 ++++++++++-
 src/make-all.hs  |  9 ++++++++-
 8 files changed, 85 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a3661ee
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+debian/dht.1
+dist/
diff --git a/debian/changelog b/debian/changelog
index 38ea000..5ce6498 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pkg-haskell-tools (0.2) UNRELEASED; urgency=medium
+
+  * Use pandoc instead of help2man 
+
+ -- Joachim Breitner <nomeata at debian.org>  Thu, 13 Aug 2015 13:20:44 +0200
+
 pkg-haskell-tools (0.1) unstable; urgency=low
 
   * Initial release
diff --git a/debian/control b/debian/control
index 43e3d89..e10ab6f 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Uploaders: Joachim Breitner <nomeata at debian.org>
 Priority: extra
 Section: haskell
 Build-Depends: debhelper (>= 9),
- help2man,
+ pandoc,
  haskell-devscripts (>= 0.9),
  cdbs,
  ghc,
diff --git a/debian/rules b/debian/rules
index 852d4b8..ce263dc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,7 @@ include /usr/share/cdbs/1/class/hlibrary.mk
 build/pkg-haskell-tools:: build-ghc-stamp debian/dht.1
 
 debian/dht.1: dht
-	help2man -N -n "Debian Haskell Group packaging tools" ./dht > $@
+	./dht --manpage | pandoc -f markdown -s -t man > $@
 
 clean::
 	rm -f debian/dht.1
diff --git a/dht b/dht
index c437932..ca63c32 100755
--- a/dht
+++ b/dht
@@ -44,7 +44,7 @@ __END__
 	for my $script (@DHT_SCRIPT_DIR) {
 		# print first line of help
 		open (HELP, '-|', "$DHT_SCRIPT_DIR/$script", "--help") or die $!;
-		print "  " . scalar(<HELP>);
+		print "  " . (scalar(<HELP>) || "$script --help failed");
 		close HELP;
 	}
 
@@ -53,6 +53,54 @@ __END__
 	exit(0);
 }
 
+if (not @ARGV or $ARGV[0] eq "--manpage" ) {
+	my $prog = basename($0);
+	print <<__END__;
+% DHT(1)
+% Debian Haskell Group
+
+# NAME
+
+dht -- Debian Haskell Packaging Tools
+
+# SYNOPSIS
+
+$0 subcommand [args..]
+
+# DESCRIPTION
+
+This is the Debian Haskell Team multi purpose tool, combining various more or
+less useful tools.
+
+Supported subcommands:
+
+__END__
+
+	for my $script (@DHT_SCRIPT_DIR) {
+		# print first line of help
+		open (HELP, '-|', "$DHT_SCRIPT_DIR/$script", "--help") or die $!;
+		print " *  " . (scalar(<HELP>) || "$script --help failed");
+		close HELP;
+	}
+
+	print <<__END__;
+
+# Subcommands
+
+__END__
+
+	for my $script (@DHT_SCRIPT_DIR) {
+		print <<__END__;
+
+## dht $script
+
+__END__
+		system ("$DHT_SCRIPT_DIR/$script", "--manpage");
+	}
+
+	exit (1);
+}
+
 if (not @ARGV or $ARGV[0] eq "--version" ) {
 	print "$0 version UNKNOWN";
 	exit(0);
diff --git a/lib/DHT.pm b/lib/DHT.pm
index f0f71b6..e54cc70 100644
--- a/lib/DHT.pm
+++ b/lib/DHT.pm
@@ -10,4 +10,12 @@ sub usage ($) {
 	}
 }
 
+sub manpage ($) {
+	my $usage = shift;
+	if ($ARGV[0] and ($ARGV[0] eq "--manpage")) {
+		print $usage;
+		exit(1);
+	}
+}
+
 return 1;
diff --git a/scripts/tag b/scripts/tag
index 85c9756..3fa2637 100755
--- a/scripts/tag
+++ b/scripts/tag
@@ -10,7 +10,16 @@ use warnings;
 use DHT;
 
 usage <<__END__;
-tag- Tag a built pakage
+tag - Tag a built pakage
+
+Usage: dht tag [directory..]
+
+For all given directories, which should be Debian source packages,
+figure out the current version from debian/changeslog and create a tag, tagging
+the youngest git commit that changed this particular source package.
+__END__
+
+manpage <<__END__;
 
 Usage: dht tag [directory..]
 
diff --git a/src/make-all.hs b/src/make-all.hs
index 256d6c2..76dc52e 100644
--- a/src/make-all.hs
+++ b/src/make-all.hs
@@ -11,6 +11,7 @@ import Text.Read
 import qualified System.Directory
 import System.Directory.Extra (listFiles)
 import System.Exit
+import System.Environment
 
 import Options.Applicative hiding (many)
 import qualified Options.Applicative as O
@@ -221,7 +222,13 @@ newtype GetExcludedSources = GetExcludedSources () deriving (Show,Typeable,Eq,Ha
 
 newtype GetBuiltBy = GetBuiltBy String  deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
 
-main = execParser opts >>= run
+manpage :: String
+manpage = unlines [ "TODO" ]
+
+main = do
+    args <- getArgs
+    case args of ["--manpage"] -> putStr manpage
+                 _ -> do execParser opts >>= run
   where
     opts = info (helper <*> confSpec)
         ( fullDesc

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git



More information about the Pkg-haskell-commits mailing list