Hi again,

Jonathan Nieder wrote:

> Here's a rough patch to start using alternatives.  To apply, run
> "mv debian/lzma.1 debian/lzma-lzma.1" first.

Here's an updated patch (attached, since the BTS seems to cope best with
that).  Changes since v1:

 - Rename lzma-lzma to lzmp;
 - Let makefile.gcc install lzmp with its real name, instead of relying
   on debian/rules to do that;
 - Make unlzma and lzcat alternatives link to lzmp directly.

In other words, I like to imagine this version is simpler. :)  Though
practically speaking, they're about the same.
From: Jonathan Nieder <jrnie...@gmail.com>
Date: Sun, 28 Aug 2011 19:52:48 -0500
Subject: Provide lzma tools through the alternatives system

Rename lzma to lzmp and manage /usr/bin/lzma, /usr/bin/unlzma,
and /usr/bin/lzcat symlinks through the alternatives system so lzma
and xz-lzma can be installed at the same time.
---
 CPP/7zip/Bundles/LzmaCon/makefile.gcc |    2 +-
 debian/changelog                      |    6 ++++++
 debian/compat                         |    2 +-
 debian/control                        |    1 +
 debian/lzma.install                   |    2 +-
 debian/lzma.links                     |    4 ----
 debian/lzma.manpages                  |    2 +-
 debian/lzma.postinst                  |   13 +++++++++++++
 debian/lzma.prerm                     |   10 ++++++++++
 debian/{lzma.1 => lzmp.1}             |    0
 debian/patches/02_lzmp.diff           |    2 +-
 11 files changed, 35 insertions(+), 9 deletions(-)
 delete mode 100644 debian/lzma.links
 create mode 100644 debian/lzma.postinst
 create mode 100644 debian/lzma.prerm
 rename debian/{lzma.1 => lzmp.1} (100%)

diff --git a/debian/changelog b/debian/changelog
index 5c6e0567..9989b46d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 lzma (9.22-1) experimental; urgency=low
 
+  [ Mohammed Adnène Trojette ]
   * New upstream release (Closes: #460501, #518365)
      + LZMA SDK is placed in the public domain since 4.62.
   * Update debian/patches/02_lzmp.diff.
@@ -17,6 +18,11 @@ lzma (9.22-1) experimental; urgency=low
   * Add deb-lzma script to convert a deb package to LZMA format. Script
     courtesy of Roger Millan. (Closes: #536275)
 
+  [ Jonathan Nieder ]
+  * Bump debhelper compatibility to 7.
+  * Manage lzma, unlzma, and lzcat through the alternatives system.
+    Conflicts: xz-lzma (<< 5.1.1alpha+20110809-3). (Closes: #547802)
+
  -- Mohammed Adnène Trojette <adn+...@diwi.org>  Fri, 26 Aug 2011 19:18:41 
+0200
 
 lzma (4.43-14) unstable; urgency=low
diff --git a/debian/compat b/debian/compat
index 7ed6ff82..7f8f011e 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+7
diff --git a/debian/control b/debian/control
index 8ba09351..54874a60 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Standards-Version: 3.9.2
 Package: lzma
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Conflicts: xz-lzma (<< 5.1.1alpha+20110809-3)
 Description: Compression and decompression in the LZMA format - command line 
utility
  The Lempel-Ziv Markov-chain Algorithm is a compression method based on
  the famous LZ77 algorithm, and was first introduced by 7-Zip for use in
diff --git a/debian/lzma.install b/debian/lzma.install
index 369c901f..9f1bb3d5 100644
--- a/debian/lzma.install
+++ b/debian/lzma.install
@@ -1 +1 @@
-CPP/7zip/Bundles/LzmaCon/lzma usr/bin
+CPP/7zip/Bundles/LzmaCon/lzmp usr/bin
diff --git a/debian/lzma.links b/debian/lzma.links
deleted file mode 100644
index 4327da69..00000000
--- a/debian/lzma.links
+++ /dev/null
@@ -1,4 +0,0 @@
-usr/bin/lzma usr/bin/unlzma
-usr/bin/lzma usr/bin/lzcat
-usr/share/man/man1/lzma.1.gz usr/share/man/man1/unlzma.1.gz
-usr/share/man/man1/lzma.1.gz usr/share/man/man1/lzcat.1.gz
diff --git a/debian/lzma.manpages b/debian/lzma.manpages
index 8325c71c..ecf446cf 100644
--- a/debian/lzma.manpages
+++ b/debian/lzma.manpages
@@ -1 +1 @@
-debian/lzma.1
+debian/lzmp.1
diff --git a/debian/lzma.postinst b/debian/lzma.postinst
new file mode 100644
index 00000000..946d3363
--- /dev/null
+++ b/debian/lzma.postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+update-alternatives \
+       --install /usr/bin/lzma lzma /usr/bin/lzmp 30 \
+       --slave /usr/bin/unlzma unlzma /usr/bin/lzmp \
+       --slave /usr/bin/lzcat lzcat /usr/bin/lzmp \
+       --slave /usr/share/man/man1/lzma.1.gz lzma.1.gz \
+               /usr/share/man/man1/lzmp.1.gz \
+       --slave /usr/share/man/man1/unlzma.1.gz unlzma.1.gz \
+               /usr/share/man/man1/lzmp.1.gz \
+       --slave /usr/share/man/man1/lzcat.1.gz lzcat.1.gz \
+               /usr/share/man/man1/lzmp.1.gz
+#DEBHELPER#
diff --git a/debian/lzma.prerm b/debian/lzma.prerm
new file mode 100644
index 00000000..6e6b2c64
--- /dev/null
+++ b/debian/lzma.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+if
+       test "$1" != upgrade ||
+       # downgrading to a pre-alternatives version
+       dpkg --compare-versions "$2" lt-nl 9.22-1
+then
+       update-alternatives --remove lzma /usr/bin/lzmp
+fi
+#DEBHELPER#
diff --git a/debian/lzma.1 b/debian/lzmp.1
similarity index 100%
rename from debian/lzma.1
rename to debian/lzmp.1
diff --git a/debian/patches/02_lzmp.diff b/debian/patches/02_lzmp.diff
index e4da3c71..67d37a90 100644
--- a/debian/patches/02_lzmp.diff
+++ b/debian/patches/02_lzmp.diff
@@ -956,7 +956,7 @@ Index: lzma-4.43/CPP/7zip/Bundles/LzmaCon/makefile.gcc
 @@ -1,9 +1,10 @@
 -PROG = lzma
 +PROG = lzma_alone
-+PROG2 = lzma
++PROG2 = lzmp
  CXX = g++ -O2 -Wall
  CXX_C = gcc -O2 -Wall
  LIB = -lm
-- 
1.7.6

Reply via email to