Bug#657904: converting /usr/share/doc/console-setup into a symlink

2012-07-28 Thread Sven Joachim
tags 657904 + patch
thanks

While working on this bug, I found two related problems:

- console-setup-mini has the same problem as console-setup and also
  needs /usr/share/doc/console-setup-mini converted into a symlink.

- console-setup* packages are missing a tight dependency on
  keyboard-configuration, see Policy 12.3.

See the attached patches which seem to solve these problems, unless the
admin has done something stupid like dropping files into
/usr/share/doc/console-setup.  I don't think it's really necessary to
clean up after them if they do such things.

Note to potential NMU'ers: it is assumed that 1.82 will be the first
fixed version, if that's not the case you need to adjust the postinst
scripts.

Cheers,
   Sven

From cc4a2e6e8d78076c2ef0f92d3d39958186a6f701 Mon Sep 17 00:00:00 2001
From: Sven Joachim svenj...@gmx.de
Date: Sat, 28 Jul 2012 11:55:37 +0200
Subject: [PATCH 1/2] Turn /usr/share/doc/console-setup{,-mini} into symlinks

The snippets here are based on Colin Watson's libpipeline-dev package.
---
 debian/changelog   |6 ++
 debian/console-setup-mini.postinst |   10 ++
 debian/console-setup.postinst  |   23 ++-
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 459496b..7ea5a98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+console-setup (1.82) UNRELEASED; urgency=low
+
+  * Turn /usr/share/doc/console-setup{,-mini} into symlinks. Closes: #657904.
+
+ -- Sven Joachim svenj...@gmx.de  Sat, 28 Jul 2012 11:53:49 +0200
+
 console-setup (1.81) unstable; urgency=low
 
   * Team upload
diff --git a/debian/console-setup-mini.postinst 
b/debian/console-setup-mini.postinst
index b27f3d9..8061bc4 100644
--- a/debian/console-setup-mini.postinst
+++ b/debian/console-setup-mini.postinst
@@ -5,6 +5,16 @@ set -e
 # Source debconf library.
 . /usr/share/debconf/confmodule
 
+if dpkg --compare-versions $2 lt-nl 1.82; then
+   # Replace directory with symlink.
+   if [ ! -L /usr/share/doc/console-setup-mini ]  \
+  [ -d /usr/share/doc/console-setup-mini ]; then
+   if rmdir /usr/share/doc/console-setup-mini 2/dev/null; then
+   ln -sf keyboard-configuration 
/usr/share/doc/console-setup-mini
+   fi
+   fi
+fi
+
 # This works even if we are not on the console
 setupcon --save-only || true
 # This will protest if we are not on the console
diff --git a/debian/console-setup.postinst b/debian/console-setup.postinst
index d8e7f68..0c8b454 100644
--- a/debian/console-setup.postinst
+++ b/debian/console-setup.postinst
@@ -8,19 +8,16 @@ set -e
 CONFIGDIR=/etc/console-setup
 CONFIGFILE=/etc/default/console-setup
 
-# # turn around bug in dpkg (#17624)
-# cd /usr/share/doc
-# if [ $1 = configure ]; then
-# [ -d keyboard-configuration ] || exit 123 # should never fail
-# if [ -d console-setup -a ! -L console-setup ]; then
-# # in case the administrator has created some files
-# cp -a console-setup/* keyboard-configuration/ 2/dev/null || true
-# rm -r console-setup
-# ln -s keyboard-configuration console-setup
-# elif [ ! -e console-setup ]; then
-# ln -s keyboard-configuration console-setup
-# fi
-# fi
+# turn around bug in dpkg (#17624)
+if dpkg --compare-versions $2 lt-nl 1.82; then
+   # Replace directory with symlink.
+   if [ ! -L /usr/share/doc/console-setup ]  \
+  [ -d /usr/share/doc/console-setup ]; then
+   if rmdir /usr/share/doc/console-setup 2/dev/null; then
+   ln -sf keyboard-configuration 
/usr/share/doc/console-setup
+   fi
+   fi
+fi
 
 if [ $1 = configure ]; then
 
-- 
1.7.10.4

From c0c90097ec53951e784215b2ee26cb5418ac4635 Mon Sep 17 00:00:00 2001
From: Sven Joachim svenj...@gmx.de
Date: Sat, 28 Jul 2012 12:06:52 +0200
Subject: [PATCH 2/2] Tighten the dependency of console-setup-* on
 keyboard-configuration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As per Policy ยง12.3, /usr/share/doc symlinks are only allowed if both
packages have the same version.
---
 debian/changelog |1 +
 debian/control   |8 
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7ea5a98..bd51da5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 console-setup (1.82) UNRELEASED; urgency=low
 
   * Turn /usr/share/doc/console-setup{,-mini} into symlinks. Closes: #657904.
+  * Tighten the dependency of console-setup-* on keyboard-configuration.
 
  -- Sven Joachim svenj...@gmx.de  Sat, 28 Jul 2012 11:53:49 +0200
 
diff --git a/debian/control b/debian/control
index fd85468..69f2ed0 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Package: console-setup
 Section: utils
 Architecture: all
 Pre-Depends: debconf (= 1.5.34)
-Depends: console-setup-linux | 

Bug#657904: converting /usr/share/doc/console-setup into a symlink

2012-07-28 Thread Julien Cristau
On Sat, Jul 28, 2012 at 14:15:02 +0200, Sven Joachim wrote:

 tags 657904 + patch
 thanks
 
 While working on this bug, I found two related problems:
 
 - console-setup-mini has the same problem as console-setup and also
   needs /usr/share/doc/console-setup-mini converted into a symlink.
 
 - console-setup* packages are missing a tight dependency on
   keyboard-configuration, see Policy 12.3.
 
 See the attached patches which seem to solve these problems, unless the
 admin has done something stupid like dropping files into
 /usr/share/doc/console-setup.  I don't think it's really necessary to
 clean up after them if they do such things.
 
 Note to potential NMU'ers: it is assumed that 1.82 will be the first
 fixed version, if that's not the case you need to adjust the postinst
 scripts.
 
I think personally I would prefer undoing this symlink mess
altogether.  Not sure what others think...

Cheers,
Julien


signature.asc
Description: Digital signature


Bug#657904: converting /usr/share/doc/console-setup into a symlink

2012-07-28 Thread Anton Zinoviev
On Sat, Jul 28, 2012 at 02:27:16PM +0200, Julien Cristau wrote:

 I think personally I would prefer undoing this symlink mess 
 altogether.  Not sure what others think...

Symlinks are there in order to

1. Simplify the maintaining of the package, as there is no need to take 
care of too many directories and what goes where (there have errors in 
the past caused by too many binary packages built by console-setup and 
having to watch too many files if they need to be updated).

2. Help the user find the documentation.  What can be a problem for the 
maintainer is most certainly a bigger problem for the casual user who 
has to dig into various directories and combine the split information.

3. In some cases separate directories lead to artificial and unnecessary 
split of the information.

If the patch of Sven works, it is going to save us from lots of future 
headaches.

Anton Zinoviev


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#657904: converting /usr/share/doc/console-setup into a symlink

2012-07-28 Thread Julien Cristau
On Sat, Jul 28, 2012 at 18:53:19 +0300, Anton Zinoviev wrote:

 On Sat, Jul 28, 2012 at 02:27:16PM +0200, Julien Cristau wrote:
 
  I think personally I would prefer undoing this symlink mess 
  altogether.  Not sure what others think...
 
 Symlinks are there in order to
 
 1. Simplify the maintaining of the package

In my experience their effect is the exact opposite.  But you're the
maintainer so I'm not going to object :)

Cheers,
Julien


signature.asc
Description: Digital signature