Bug#776108: fonts-ipafont-nonfree-jisx0208: leaves alternatives after purge: /usr/share/fonts/truetype/ttf-japanese-{gothic, mincho}.ttf

2015-01-23 Thread Andreas Beckmann
Followup-For: Bug #776108

Attached are two patches, the first one fixes the Vcs-* URLs which point
to a completely different package, the second cleans up the obsolete
alternatives.
I tested the upgrade path squeeze - wheezy - jessie with the updated
package and no alternatives were left any more :-)


Andreas
From 27ba330fef9e28a659a5869dfbadac1da994a394 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann a...@debian.org
Date: Sat, 24 Jan 2015 01:44:16 +0100
Subject: [PATCH 1/2] fix the Vcs-* URLs

---
 debian/changelog | 6 ++
 debian/control   | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index de634fe..a620a69 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+fonts-ipafont-nonfree-jisx0208 (1:00103-3) UNRELEASED; urgency=medium
+
+  * Use the correct Vcs-* URLs.
+
+ -- Andreas Beckmann a...@debian.org  Sat, 24 Jan 2015 01:41:43 +0100
+
 fonts-ipafont-nonfree-jisx0208 (1:00103-2) unstable; urgency=low
 
   * debian/control
diff --git a/debian/control b/debian/control
index 50976d2..077f92a 100644
--- a/debian/control
+++ b/debian/control
@@ -6,8 +6,8 @@ Uploaders: Hideki Yamane henr...@debian.org
 Build-Depends: debhelper (= 9.20120518~)
 Standards-Version: 3.9.4
 Homepage: http://www.ipa.go.jp/
-Vcs-Git: git://anonscm.debian.org/pkg-fonts/fonts-vlgothic/
-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-fonts/fonts-vlgothic.git;a=summary
+Vcs-Git: git://anonscm.debian.org/pkg-fonts/fonts-ipafont-nonfree-jisx0208.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-fonts/fonts-ipafont-nonfree-jisx0208.git
 
 Package: fonts-ipafont-nonfree-jisx0208
 Architecture: all
-- 
2.1.4

From 93da94dfccbc37156938277e2bbaaeaea1ad1890 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann a...@debian.org
Date: Sat, 24 Jan 2015 01:54:54 +0100
Subject: [PATCH 2/2] cleanup obsolete alternatives from ttf-ipafont-jisx0208

---
 debian/changelog  | 2 ++
 debian/fonts-ipafont-nonfree-jisx0208.preinst | 5 +
 2 files changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index a620a69..5ecc6dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 fonts-ipafont-nonfree-jisx0208 (1:00103-3) UNRELEASED; urgency=medium
 
   * Use the correct Vcs-* URLs.
+  * fonts-ipafont-nonfree-jisx0208.preinst: Cleanup obsolete alternatives from
+ttf-ipafont-jisx0208.  (Closes: #776108)
 
  -- Andreas Beckmann a...@debian.org  Sat, 24 Jan 2015 01:41:43 +0100
 
diff --git a/debian/fonts-ipafont-nonfree-jisx0208.preinst b/debian/fonts-ipafont-nonfree-jisx0208.preinst
index 089d15f..634cee7 100644
--- a/debian/fonts-ipafont-nonfree-jisx0208.preinst
+++ b/debian/fonts-ipafont-nonfree-jisx0208.preinst
@@ -30,6 +30,11 @@ rm_conffile() {
 
 case $1 in
 install|upgrade)
+
+# cleanup obsolete alternatives from ttf-ipafont-jisx0208
+update-alternatives --remove ttf-japanese-gothic.ttf /usr/share/fonts/truetype/ipafont-jisx0208/ipag0208_for_legacy_compatibility.ttf
+update-alternatives --remove ttf-japanese-mincho.ttf /usr/share/fonts/truetype/ipafont-jisx0208/ipam0208_for_legacy_compatibility.ttf
+
 if dpkg --compare-versions $2 lt-nl $VERSION; then
 	if [ -f $FILE ]; then
 	if [ -x /usr/bin/defoma-font ]; then
-- 
2.1.4



Bug#776108: fonts-ipafont-nonfree-jisx0208: leaves alternatives after purge: /usr/share/fonts/truetype/ttf-japanese-{gothic, mincho}.ttf

2015-01-23 Thread Andreas Beckmann
Source: fonts-ipafont-nonfree-jisx0208
Version: 1:00103-2
Severity: important
Tags: patch
User: debian...@lists.debian.org
Usertags: piuparts

Hi,

during a test with piuparts I noticed your package left unowned files on
the system after purge, which is a violation of policy 6.8:

https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-removedetails

The leftover files are actually alternatives that were installed by the
package but have not been properly removed.

While there is ongoing discussion how to remove alternatives correctly
(see https://bugs.debian.org/71621 for details) the following strategy
should work for regular cases:
* 'postinst configure' always installs the alternative
* 'prerm remove' removes the alternative
* 'postrm remove' and 'postrm disappear' remove the alternative
In all other cases a maintainer script is invoked (e.g. upgrade,
deconfigure) the alternatives are not modified to preserve user
configuration.
Removing the alternative in 'prerm remove' avoids having a dangling link
once the actual file gets removed, but 'prerm remove' is not called in
all cases (e.g. unpacked but not configured packages or disappearing
packages) so the postrm must remove the alternative again
(update-alternatives gracefully handles removal of non-existing
alternatives).

Note that the arguments for adding and removing alternatives differ, for
removal it's 'update-alternatives --remove name path'.

Filing this as important as having a piuparts clean archive is a release
goal since lenny.

From the attached log (scroll to the bottom...):

2m13.4s INFO: Warning: Package purging left files on system:
  /etc/alternatives/ttf-japanese-gothic.ttf - 
/usr/share/fonts/truetype/ipafont-jisx0208/ipag0208_for_legacy_compatibility.ttf
  not owned
  /etc/alternatives/ttf-japanese-mincho.ttf - 
/usr/share/fonts/truetype/ipafont-jisx0208/ipam0208_for_legacy_compatibility.ttf
  not owned
  /usr/share/fonts/  owned by: fonts-ipafont-nonfree-jisx0208
  /usr/share/fonts/truetype/ owned by: fonts-ipafont-nonfree-jisx0208
  /usr/share/fonts/truetype/ttf-japanese-gothic.ttf - 
/etc/alternatives/ttf-japanese-gothic.ttf not owned
  /usr/share/fonts/truetype/ttf-japanese-mincho.ttf - 
/etc/alternatives/ttf-japanese-mincho.ttf not owned

A patch is following ... please get this fixed for jessie.


cheers,

Andreas


ttf-ipafont-jisx0208_None.log.gz
Description: application/gzip