[xml/sgml-pkgs] Bug#477751: tackling this bug
Helmut Grohne
helmut at subdivi.de
Wed May 9 15:24:52 UTC 2012
On Mon, Apr 30, 2012 at 05:52:35PM +0200, Helmut Grohne wrote:
> On the debhelper side it should be enough to remove all remaining calls
> to update-catalog and introduce a dependency on the changed sgml-base. I
> did not test this thus far.
I worked out the remaining bits and tested them. For convenience the
very same sgml-base.debdiff as in the previous mail is attached. In
addition a debhelper.debdiff fixing this issue is attached. I verified
the following things (in pbuilder):
1) Building sgml-base NMU.
2) Building debhelper NMU.
3) Installing sgml-base NMU.
4) Upgrading sgml-base from sid to NMU.
5) Upgrading debhelper from sid to NMU.
6) Building python-docutils with debhelper NMU.
7) Upgrading docutils-common to binNMU.
8) Purging docutils-common binNMU.
9) Installing docutils-common binNMU.
I did not observe any problems like obvious failures or even conffile
questions. I looked at /etc/sgml/catalog and
/etc/sgml/docutils-common.cat after each step and verified that the
contents are sensible.
Note that downgrading sgml-base leaves artifacts.
Also note that if the debhelper.debdiff gets applied before the
sgml-base.debdiff gets applied, packages built with the updated
debhelper will be uninstallable.
I ask for feedback on this combination of patches. Since the bug is
assigned to debhelper now, I explicitly pull in the sgml-base
maintainers (who seem to be MIA).
Helmut
-------------- next part --------------
diff -Nru sgml-base-1.26+nmu1/debian/changelog sgml-base-1.26+nmu2/debian/changelog
--- sgml-base-1.26+nmu1/debian/changelog 2010-07-18 14:39:38.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/changelog 2012-04-30 17:16:27.000000000 +0200
@@ -1,3 +1,13 @@
+sgml-base (1.26+nmu2) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Generate the super catalog from /etc/sgml directory contents.
+ This does not solve #477751, but the upcoming debhelper changes will solve
+ that bug based on this work.
+ * Do not truncate the manual pages during build.
+
+ -- Helmut Grohne <helmut at subdivi.de> Mon, 30 Apr 2012 17:15:48 +0200
+
sgml-base (1.26+nmu1) unstable; urgency=low
* Non-maintainer upload
diff -Nru sgml-base-1.26+nmu1/debian/control sgml-base-1.26+nmu2/debian/control
--- sgml-base-1.26+nmu1/debian/control 2010-07-18 14:37:50.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/control 2012-04-30 13:15:14.000000000 +0200
@@ -11,7 +11,7 @@
Priority: optional
Architecture: all
Conflicts: sgml-data (<= 0.02), sgmltools-2 (<= 2.0.2-4)
-Depends: ${perl:Depends}
+Depends: ${perl:Depends}, dpkg (>= 1.14.18)
Suggests: sgml-base-doc
Description: SGML infrastructure and SGML catalog file support
This package creates the SGML infrastructure directories and provides
diff -Nru sgml-base-1.26+nmu1/debian/copyright sgml-base-1.26+nmu2/debian/copyright
--- sgml-base-1.26+nmu1/debian/copyright 2004-06-07 05:18:28.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/copyright 2012-04-30 17:06:30.000000000 +0200
@@ -6,6 +6,7 @@
Copyright (C) 1997 Christian Schwarz <schwarz at debian.org>.
Copyright (C) 2001-2004 Ardo van Rangelrooij <ardo at debian.org>
+Copyright (C) 2012 Helmut Grohne <helmut at subdivi.de>
This is free software; you may redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.NEWS sgml-base-1.26+nmu2/debian/sgml-base.NEWS
--- sgml-base-1.26+nmu1/debian/sgml-base.NEWS 1970-01-01 01:00:00.000000000 +0100
+++ sgml-base-1.26+nmu2/debian/sgml-base.NEWS 2012-04-30 16:37:03.000000000 +0200
@@ -0,0 +1,13 @@
+sgml-base (1.26+nmu2) unstable; urgency=low
+
+ Starting with this release the SGML super catalog /etc/sgml/catalog will be
+ replaced with a symbolic link to /var/lib/sgml-base/supercatalog. The latter
+ file can be regenerated from the contents of the /etc/sgml directory including
+ all files ending in .cat using the new update-catalog --update-super option.
+ This call will be (dpkg) triggered by packages placing files in /etc/sgml. The
+ transition to this way of handling the super catalog will loose user changes to
+ /etc/sgml/catalog. Further overwriting of user changes will happen until all
+ packages using dh_installcatalogs are built with a fixed version of debhelper.
+ Sorry for the inconvenience.
+
+ -- Helmut Grohne <helmut at subdivi.de> Mon, 30 Apr 2012 16:37:01 +0200
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.dirs sgml-base-1.26+nmu2/debian/sgml-base.dirs
--- sgml-base-1.26+nmu1/debian/sgml-base.dirs 1970-01-01 01:00:00.000000000 +0100
+++ sgml-base-1.26+nmu2/debian/sgml-base.dirs 2012-04-30 13:16:43.000000000 +0200
@@ -0,0 +1 @@
+var/lib/sgml-base
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.postinst sgml-base-1.26+nmu2/debian/sgml-base.postinst
--- sgml-base-1.26+nmu1/debian/sgml-base.postinst 2004-08-14 17:04:15.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/sgml-base.postinst 2012-04-30 14:15:51.000000000 +0200
@@ -11,20 +11,11 @@
then
## ------------------------------------------------------------------
- ## create SGML root catalog
- [ ! -f /etc/sgml/catalog ] \
- && cp -a /usr/share/sgml-base/catalog.super /etc/sgml/catalog
-
- ## ------------------------------------------------------------------
## clean up /usr/lib/sgml
if [ -d /usr/lib/sgml ]
then
## --------------------------------------------------------------
- ## remove nasty old circular catalog
- update-catalog --remove --super /usr/lib/sgml/catalog || true
-
- ## --------------------------------------------------------------
## remove symlink to /etc/sgml/catalog
rm -f /usr/lib/sgml/catalog
@@ -33,7 +24,6 @@
TRANSCAT=transitional.cat
if [ -f /usr/lib/sgml/${TRANSCAT} ]
then
- update-catalog --remove --super /usr/lib/sgml/${TRANSCAT} || true
mv -f /usr/lib/sgml/${TRANSCAT} /etc/sgml/${TRANSCAT}
if [ -f /usr/lib/sgml/${TRANSCAT}.old ]
then
@@ -71,12 +61,12 @@
fi
## ------------------------------------------------------------------
- TRANSCAT=/etc/sgml/transitional.cat
- if [ -f ${TRANSCAT} ]
- then
- update-catalog --add --super ${TRANSCAT}
- fi
-
+ update-catalog --update-super
+ ln -sf /var/lib/sgml-base/supercatalog /etc/sgml/catalog
+fi
+if [ "$1" = "triggered" ]
+then
+ update-catalog --update-super
fi
## ----------------------------------------------------------------------
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.postrm sgml-base-1.26+nmu2/debian/sgml-base.postrm
--- sgml-base-1.26+nmu1/debian/sgml-base.postrm 2010-07-17 16:15:59.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/sgml-base.postrm 2012-04-30 14:17:30.000000000 +0200
@@ -13,6 +13,9 @@
## ------------------------------------------------------------------
## remove SGML root catalog
rm -f /etc/sgml/catalog /etc/sgml/catalog.old
+ rm -f /var/lib/sgml-base/supercatalog
+ rm -f /var/lib/sgml-base/supercatalog.new
+ rm -f /var/lib/sgml-base/supercatalog.old
## ------------------------------------------------------------------
## remove /etc/sgml and /var/lib/sgml-base
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.prerm sgml-base-1.26+nmu2/debian/sgml-base.prerm
--- sgml-base-1.26+nmu1/debian/sgml-base.prerm 2004-08-14 17:04:15.000000000 +0200
+++ sgml-base-1.26+nmu2/debian/sgml-base.prerm 2012-04-30 14:18:14.000000000 +0200
@@ -14,8 +14,8 @@
TRANSCAT=/etc/sgml/transitional.cat
if [ -f ${TRANSCAT} ]
then
- update-catalog --remove --super ${TRANSCAT} || true
rm -f ${TRANSCAT} ${TRANSCAT}.old
+ update-catalog --update-super
fi
fi
diff -Nru sgml-base-1.26+nmu1/debian/sgml-base.triggers sgml-base-1.26+nmu2/debian/sgml-base.triggers
--- sgml-base-1.26+nmu1/debian/sgml-base.triggers 1970-01-01 01:00:00.000000000 +0100
+++ sgml-base-1.26+nmu2/debian/sgml-base.triggers 2012-04-30 14:06:05.000000000 +0200
@@ -0,0 +1 @@
+interest /etc/sgml
diff -Nru sgml-base-1.26+nmu1/tools/Makefile sgml-base-1.26+nmu2/tools/Makefile
--- sgml-base-1.26+nmu1/tools/Makefile 2004-04-21 21:35:41.000000000 +0200
+++ sgml-base-1.26+nmu2/tools/Makefile 2012-04-30 17:10:00.000000000 +0200
@@ -22,9 +22,10 @@
all: $(man8s)
-%.$(man8_ext): %
-
- $(POD2MAN) --section $(man8_ext) --center $(pkg_name) ${<} ${@}
+# There is no POD documentation. This just truncates the existing manual pages.
+#%.$(man8_ext): %
+#
+# $(POD2MAN) --section $(man8_ext) --center $(pkg_name) ${<} ${@}
install:
diff -Nru sgml-base-1.26+nmu1/tools/update-catalog sgml-base-1.26+nmu2/tools/update-catalog
--- sgml-base-1.26+nmu1/tools/update-catalog 2004-06-21 00:04:49.000000000 +0200
+++ sgml-base-1.26+nmu2/tools/update-catalog 2012-04-30 17:20:52.000000000 +0200
@@ -3,6 +3,7 @@
## Debian GNU/Linux update-catalog version 0.2
## ----------------------------------------------------------------------
## Copyright (c) 2001-2004 Ardo van Rangelrooij
+## Copyright (c) 2012 Helmut Grohne
##
## This is free software; see the GNU General Public Licence version 2
## or later for copying conditions. There is NO warranty.
@@ -28,6 +29,7 @@
use vars qw( $quiet );
use vars qw( $remove );
use vars qw( $super );
+use vars qw( $updatesuper );
use vars qw( $template );
use vars qw( $type );
@@ -56,6 +58,10 @@
{
$debug = 1;
}
+ elsif ( $_ eq '--update-super' )
+ {
+ $updatesuper = 1;
+ }
elsif ( $_ eq '--help' )
{
&help;
@@ -75,16 +81,22 @@
}
## ----------------------------------------------------------------------
-if ( ! @ARGV )
+if ( $add + $remove + $updatesuper != 1)
{
- print STDERR "\n";
- &help;
+ print "Huh? You have to use precisely one out of --add --remove or --update-super.\n";
exit 1;
}
## ----------------------------------------------------------------------
if ( $add || $remove )
{
+ if ( ! @ARGV )
+ {
+ print STDERR "\n";
+ &help;
+ exit 1;
+ }
+
if ( $super )
{
$catalog = '/etc/sgml/catalog';
@@ -93,18 +105,16 @@
{
$catalog = shift( @ARGV );
}
-}
-## ----------------------------------------------------------------------
-if ( ! @ARGV )
-{
- print STDERR "\n";
- &help;
- exit 1;
-}
+ if ( ! @ARGV )
+ {
+ print STDERR "\n";
+ &help;
+ exit 1;
+ }
-## ----------------------------------------------------------------------
-$entry = shift( @ARGV );
+ $entry = shift( @ARGV );
+}
## ----------------------------------------------------------------------
if ( @ARGV )
@@ -115,18 +125,24 @@
}
## ----------------------------------------------------------------------
-if ( $add == $remove )
-{
- print "Huh? You have to use --add or --remove (not both).\n";
- exit 1;
-}
-
-## ----------------------------------------------------------------------
print STDERR "$name: test mode - catalog file will not be updated\n"
if $debug && ! $quiet;
## ----------------------------------------------------------------------
-if ( $add )
+if ( $super )
+{
+ print "update-catalog: Suppressing action on super catalog. Invoking trigger instead.\n";
+ system("dpkg-trigger /etc/sgml");
+ if ( $? != 0 )
+ {
+ print "Invocation of dpkg-trigger failed with status $?.\n";
+ print "Forcing update of the super catalog...\n";
+ &update_super;
+ } else {
+ print "update-catalog: Please rebuild the package being set up with a version of debhelper fixing #477751.\n";
+ }
+}
+elsif ( $add )
{
print "Adding entry $entry to catalog $catalog...\n"
unless $quiet;
@@ -143,6 +159,12 @@
&read_catalog_without_entry;
&write_catalog;
}
+elsif ( $updatesuper )
+{
+ print "Updating the super catalog...\n"
+ unless $quiet;
+ &update_super;
+}
## ----------------------------------------------------------------------
exit 0;
@@ -218,6 +240,46 @@
}
## ----------------------------------------------------------------------
+sub update_super
+{
+ my(@cats);
+ my($catdir)="/etc/sgml";
+ my($supercat)="/var/lib/sgml-base/supercatalog";
+ opendir(CATDIR, $catdir)
+ or die "cannot open catalog directory $catdir: $!";
+ while( readdir CATDIR )
+ {
+ m/^[^.].*\.cat$/ or next;
+ push(@cats, $catdir . "/" . $_);
+ }
+ closedir(CATDIR)
+ or die "cannot close catalog directory $catdir: $!";
+ if ( not $debug )
+ {
+ open( CATALOG, ">$supercat.new")
+ or die "cannot open $supercat.new for writing: $!";
+ print CATALOG "--\n";
+ print CATALOG "## This file is created by update-catalog --update-super.\n";
+ print CATALOG "## Please see update-catalog(8) for how to modify this file.\n";
+ print CATALOG "--\n";
+ for ( @cats ) { print CATALOG "CATALOG $_\n"; }
+ close( CATALOG );
+ if( -e $supercat)
+ {
+ rename( $supercat, "$supercat.old" )
+ or die "cannot rename $supercat to $supercat.old: $!";
+ }
+ rename( "$supercat.new", $supercat )
+ or die "cannot rename $supercat.new to $supercat: $!";
+ }
+ else
+ {
+ print "The new super catalog would contain the following entries.\n";
+ for ( @cats ) { print "CATALOG $_\n"; }
+ }
+}
+
+## ----------------------------------------------------------------------
sub help
{
print STDERR <<END;
diff -Nru sgml-base-1.26+nmu1/tools/update-catalog.8 sgml-base-1.26+nmu2/tools/update-catalog.8
--- sgml-base-1.26+nmu1/tools/update-catalog.8 2004-06-21 00:04:49.000000000 +0200
+++ sgml-base-1.26+nmu2/tools/update-catalog.8 2012-04-30 17:07:09.000000000 +0200
@@ -17,57 +17,58 @@
.SH SYNOPSIS
.B update-catalog
.RI [ options ]
-.B --add --super
-.I centralized_catalog
-.PP
-.B update-catalog
-.RI [ options ]
.B --add
.I centralized_catalog ordinary_catalog
.PP
.B update-catalog
.RI [ options ]
-.B --remove --super
-.I centralized_catalog
+.B --remove
+.I centralized_catalog ordinary_catalog
.PP
.B update-catalog
.RI [ options ]
-.B --remove
-.I centralized_catalog ordinary_catalog
+.B --update-super
.\"
.\" ----------------------------------------------------------------------
.SH DESCRIPTION
.PP
.B update-catalog
-inserts, updates or removes entries in the SGML super catalog
-.I /etc/sgml/catalog
-and the
+inserts, updates or removes entries in the
SGML centralized catalogs located in
.IR /etc/sgml .
+To change the SGML super catalog located in
+.IR /etc/sgml/catalog
+modify the directory contents of
+.IR /etc/sgml
+to contain new files or symbolic links having a
+.B .cat
+extension or remove (or move) existing centralized catalogs and regenerate the super catalog using the
+.B --update-super
+option.
.\"
.\" ----------------------------------------------------------------------
.SH OPTIONS
.TP
.B --add
Adds an entry for the
-.I centralized_catalog
-in the super catalog
-.IR /etc/sgml/catalog ,
-or an entry for the
.I ordinary_catalog
in the
.IR centralized_catalog .
.TP
.B --remove
Removes the entry for the
-.I centralized_catalog
-from the super catalog
-.IR /etc/sgml/catalog ,
-or the entry for the
.I ordinary_catalog
from the
.IR centralized_catalog .
.TP
+.B --update-super
+Regenerates the SGML super catalog from the contents of the
+.IR /etc/sgml
+directory including all files having a
+.B .cat
+extension.
+Files ending in .disabled or .old for instance are not considered.
+.TP
.B --quiet
Prevents the usual diagnostic output.
.TP
@@ -88,6 +89,7 @@
.\" ----------------------------------------------------------------------
.SH COPYRIGHT
Copyright \(co 2001-2004 Ardo van Rangelrooij
+Copyright \(co 2012 Helmut Grohne
This is free software; see the GNU General Public Licence version 2 or
later for copying conditions. There is
-------------- next part --------------
diff -Nru debhelper-9.20120419/autoscripts/postinst-sgmlcatalog debhelper-9.20120419+nmu1/autoscripts/postinst-sgmlcatalog
--- debhelper-9.20120419/autoscripts/postinst-sgmlcatalog 2011-08-07 02:46:45.000000000 +0200
+++ debhelper-9.20120419+nmu1/autoscripts/postinst-sgmlcatalog 1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-if [ "$1" = "configure" ]; then
- rm -f #CENTRALCAT#
- for ordcat in #ORDCATS#; do
- update-catalog --quiet --add #CENTRALCAT# ${ordcat}
- done
- update-catalog --quiet --add --super #CENTRALCAT#
-fi
diff -Nru debhelper-9.20120419/autoscripts/postrm-sgmlcatalog debhelper-9.20120419+nmu1/autoscripts/postrm-sgmlcatalog
--- debhelper-9.20120419/autoscripts/postrm-sgmlcatalog 2011-08-07 02:46:45.000000000 +0200
+++ debhelper-9.20120419+nmu1/autoscripts/postrm-sgmlcatalog 2012-05-04 14:43:14.000000000 +0200
@@ -1,3 +1,3 @@
if [ "$1" = "purge" ]; then
- rm -f #CENTRALCAT# #CENTRALCAT#.old
+ rm -f #CENTRALCAT#.old
fi
diff -Nru debhelper-9.20120419/autoscripts/preinst-sgmlcatalog debhelper-9.20120419+nmu1/autoscripts/preinst-sgmlcatalog
--- debhelper-9.20120419/autoscripts/preinst-sgmlcatalog 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-9.20120419+nmu1/autoscripts/preinst-sgmlcatalog 2012-05-04 14:44:17.000000000 +0200
@@ -0,0 +1,7 @@
+if [ "$1" = "upgrade" ] && ! dpkg-query -S #CENTRALCAT# >/dev/null 2>&1; then
+ # If the dpkg-query command returns non-zero, the central catalog is
+ # not owned by any package. This is due to an old behaviour of
+ # debhelper. Now that file becomes a conffile. In order to avoid a
+ # question during installation, we remove the old non-conffile.
+ rm -f #CENTRALCAT#
+fi
diff -Nru debhelper-9.20120419/autoscripts/prerm-sgmlcatalog debhelper-9.20120419+nmu1/autoscripts/prerm-sgmlcatalog
--- debhelper-9.20120419/autoscripts/prerm-sgmlcatalog 2011-08-07 02:46:45.000000000 +0200
+++ debhelper-9.20120419+nmu1/autoscripts/prerm-sgmlcatalog 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
- update-catalog --quiet --remove --super #CENTRALCAT#
-fi
diff -Nru debhelper-9.20120419/debian/changelog debhelper-9.20120419+nmu1/debian/changelog
--- debhelper-9.20120419/debian/changelog 2012-04-18 01:33:44.000000000 +0200
+++ debhelper-9.20120419+nmu1/debian/changelog 2012-05-04 14:45:47.000000000 +0200
@@ -1,3 +1,11 @@
+debhelper (9.20120419+nmu1) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Turn /etc/sgml/$package.cat into conffiles and introduce dependency
+ on trigger-based sgml-base. Closes: #477751
+
+ -- Helmut Grohne <helmut at subdivi.de> Fri, 04 May 2012 14:44:52 +0200
+
debhelper (9.20120419) unstable; urgency=low
* Fix compat level checking for cmake. Closes: #669181
diff -Nru debhelper-9.20120419/dh_installcatalogs debhelper-9.20120419+nmu1/dh_installcatalogs
--- debhelper-9.20120419/dh_installcatalogs 2011-09-12 18:01:19.000000000 +0200
+++ debhelper-9.20120419+nmu1/dh_installcatalogs 2012-05-04 15:08:23.000000000 +0200
@@ -9,7 +9,7 @@
use strict;
use Debian::Debhelper::Dh_Lib;
-my $sgmlbasever = "1.17";
+my $sgmlbasever = "1.26+nmu2";
=head1 SYNOPSIS
@@ -96,12 +96,16 @@
doit("install","-d","-m755","$tmpdir/etc/sgml");
}
+ my $centralcat = "/etc/sgml/$package.cat";
+
+ open(CENTRALCAT, ">", "$tmpdir$centralcat") || error("failed to write to $tmpdir$centralcat");
+ foreach my $sgmldest (@sgmlinstalled) {
+ print CENTRALCAT "CATALOG " . $sgmldest . "\n";
+ }
+ close CENTRALCAT;
+
if (! $dh{NOSCRIPTS}) {
- my $ordcats = join(" ", @sgmlinstalled);
- my $centralcat = "/etc/sgml/$package.cat";
- autoscript($package, "postinst", "postinst-sgmlcatalog",
- "s%#CENTRALCAT#%$centralcat%g; s%#ORDCATS#%$ordcats%g;");
- autoscript($package, "prerm", "prerm-sgmlcatalog",
+ autoscript($package, "preinst", "preinst-sgmlcatalog",
"s%#CENTRALCAT#%$centralcat%g;");
autoscript($package, "postrm", "postrm-sgmlcatalog",
"s%#CENTRALCAT#%$centralcat%g;");
More information about the debian-xml-sgml-pkgs
mailing list