[DHG_packages] 01/01: tldr: manage with update-alternatives

Clint Adams clint at moszumanska.debian.org
Sat Jan 6 18:07:18 UTC 2018


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

clint pushed a commit to branch master
in repository DHG_packages.

commit ee0d4d50226eaef7de4d8244dc89a6c72ee46a9a
Author: Clint Adams <clint at debian.org>
Date:   Sat Jan 6 13:05:57 2018 -0500

    tldr: manage with update-alternatives
---
 p/haskell-tldr/debian/changelog                              | 10 ++++++++++
 p/haskell-tldr/debian/control                                |  5 ++++-
 .../debian/patches/no-initialize-on-help-or-version.diff     | 12 ++++++++++++
 p/haskell-tldr/debian/patches/series                         |  1 +
 p/haskell-tldr/debian/rules                                  |  6 ++++++
 p/haskell-tldr/debian/tldr.install                           |  3 ++-
 p/haskell-tldr/debian/tldr.manpages                          |  1 +
 p/haskell-tldr/debian/tldr.postinst                          | 11 +++++++++++
 p/haskell-tldr/debian/tldr.prerm                             |  9 +++++++++
 9 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/p/haskell-tldr/debian/changelog b/p/haskell-tldr/debian/changelog
index b4c97e1..50e8566 100644
--- a/p/haskell-tldr/debian/changelog
+++ b/p/haskell-tldr/debian/changelog
@@ -1,3 +1,13 @@
+haskell-tldr (0.2.3-2) unstable; urgency=medium
+
+  * Manage /usr/bin/tldr and /usr/share/man/man1/tldr.1 with
+    alternatives.  closes: #885793 .
+  * Patch tldr to not initialize ~/.tldr if the user is just doing
+    a --help or --version.
+  * Generate man page with help2man.
+
+ -- Clint Adams <clint at debian.org>  Sat, 06 Jan 2018 13:03:43 -0500
+
 haskell-tldr (0.2.3-1) unstable; urgency=low
 
   * Initial release.
diff --git a/p/haskell-tldr/debian/control b/p/haskell-tldr/debian/control
index 49b71d4..e4b90ab 100644
--- a/p/haskell-tldr/debian/control
+++ b/p/haskell-tldr/debian/control
@@ -6,6 +6,8 @@ Section: haskell
 Build-Depends: debhelper (>= 9),
  haskell-devscripts-minimal | haskell-devscripts (>= 0.8),
  cdbs,
+ dh-exec,
+ help2man,
  ghc,
  ghc-prof,
  libghc-ansi-terminal-dev,
@@ -75,10 +77,11 @@ Section: doc
 Depends: ${haskell:Depends},
  ${misc:Depends},
  ${shlibs:Depends},
- ${shlibs:Depends},
+ git,
 Recommends: ${haskell:Recommends},
 Suggests: ${haskell:Suggests},
 Conflicts: ${haskell:Conflicts},
+ tldr-py (<< 0.7.0-2~),
 Provides: ${haskell:Provides},
 Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
  ${haskell:LongDescription}
diff --git a/p/haskell-tldr/debian/patches/no-initialize-on-help-or-version.diff b/p/haskell-tldr/debian/patches/no-initialize-on-help-or-version.diff
new file mode 100644
index 0000000..cb53360
--- /dev/null
+++ b/p/haskell-tldr/debian/patches/no-initialize-on-help-or-version.diff
@@ -0,0 +1,12 @@
+--- a/app/Main.hs
++++ b/app/Main.hs
+@@ -97,8 +97,8 @@
+ 
+ main :: IO ()
+ main = do
+-  initializeTldrPages
+   args <- getArgs
++  when (args /= ["--version"] && args /= ["--help"]) initializeTldrPages
+   case execParserPure (prefs noBacktrack) tldrParserInfo args of
+     Failure _
+       | null args -> withArgs ["--help"] (execParser tldrParserInfo) >> return ()
diff --git a/p/haskell-tldr/debian/patches/series b/p/haskell-tldr/debian/patches/series
new file mode 100644
index 0000000..c72ce07
--- /dev/null
+++ b/p/haskell-tldr/debian/patches/series
@@ -0,0 +1 @@
+no-initialize-on-help-or-version.diff
diff --git a/p/haskell-tldr/debian/rules b/p/haskell-tldr/debian/rules
index 51789b0..6015b06 100755
--- a/p/haskell-tldr/debian/rules
+++ b/p/haskell-tldr/debian/rules
@@ -9,3 +9,9 @@ include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/hlibrary.mk
 
 build/tldr:: build-ghc-stamp
+
+install/tldr:: tldr-hs.1
+
+tldr-hs.1:
+	./dist-ghc/build/tldr/tldr --help
+	help2man -N -o $@ ./dist-ghc/build/tldr/tldr
diff --git a/p/haskell-tldr/debian/tldr.install b/p/haskell-tldr/debian/tldr.install
old mode 100644
new mode 100755
index 0e68018..500dcb9
--- a/p/haskell-tldr/debian/tldr.install
+++ b/p/haskell-tldr/debian/tldr.install
@@ -1 +1,2 @@
-dist-ghc/build/tldr/tldr usr/bin
+#!/usr/bin/dh-exec
+dist-ghc/build/tldr/tldr => /usr/bin/tldr-hs
diff --git a/p/haskell-tldr/debian/tldr.manpages b/p/haskell-tldr/debian/tldr.manpages
new file mode 100644
index 0000000..1060675
--- /dev/null
+++ b/p/haskell-tldr/debian/tldr.manpages
@@ -0,0 +1 @@
+tldr-hs.1
diff --git a/p/haskell-tldr/debian/tldr.postinst b/p/haskell-tldr/debian/tldr.postinst
new file mode 100644
index 0000000..49e8e72
--- /dev/null
+++ b/p/haskell-tldr/debian/tldr.postinst
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+    update-alternatives \
+        --install /usr/bin/tldr tldr /usr/bin/tldr-hs 10 \
+        --slave /usr/share/man/man1/tldr.1.gz tldr.1.gz /usr/share/man/man1/tldr-hs.1.gz
+fi
+
+#DEBHELPER#
diff --git a/p/haskell-tldr/debian/tldr.prerm b/p/haskell-tldr/debian/tldr.prerm
new file mode 100644
index 0000000..23588cf
--- /dev/null
+++ b/p/haskell-tldr/debian/tldr.prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
+    update-alternatives --remove tldr /usr/bin/tldr-hs
+fi
+
+#DEBHELPER#

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



More information about the Pkg-haskell-commits mailing list