Package: sgml-base
Version: 1.26+nmu1
Severity: normal
Tags: patch pending

I've prepared an NMU for sgml-base (versioned as 1.26+nmu2) and Didier
Raboud was kind enough to uploaded it. It is part of the solution to
#477751 which is assigned to debhelper and will be closed in an
upcoming debhelper upload. This patch just documents the presence of the
NMU and should be closed in the next maintainer upload acknowledging
this NMU.

Helmut
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-05-28 12:53:49.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 <[email protected]>  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-05-28 12:53:49.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-05-28 12:53:49.000000000 +0200
@@ -6,6 +6,7 @@
 
 Copyright (C) 1997 Christian Schwarz <[email protected]>.
 Copyright (C) 2001-2004 Ardo van Rangelrooij <[email protected]>
+Copyright (C) 2012 Helmut Grohne <[email protected]>
 
 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-05-28 12:53:49.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 <[email protected]>  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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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-05-28 12:53:49.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

Reply via email to