From 2da6ed90ff536121b387c93385e1cf652f7bd3aa Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 12 Feb 2003 16:25:44 +0000 Subject: [PATCH] r572: * Added dh_installcatalogs, for sgml (and later xml) catalogs. By Adam DiCarlo. Closes: #90025 --- autoscripts/postinst-sgmlcatalog | 7 ++ autoscripts/postrm-sgmlcatalog | 3 + autoscripts/prerm-sgmlcatalog | 3 + debian/changelog | 7 ++ debian/copyright | 10 ++- dh_installcatalogs | 115 +++++++++++++++++++++++++++++++ 6 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 autoscripts/postinst-sgmlcatalog create mode 100644 autoscripts/postrm-sgmlcatalog create mode 100644 autoscripts/prerm-sgmlcatalog create mode 100755 dh_installcatalogs diff --git a/autoscripts/postinst-sgmlcatalog b/autoscripts/postinst-sgmlcatalog new file mode 100644 index 0000000..100dee2 --- /dev/null +++ b/autoscripts/postinst-sgmlcatalog @@ -0,0 +1,7 @@ +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 --git a/autoscripts/postrm-sgmlcatalog b/autoscripts/postrm-sgmlcatalog new file mode 100644 index 0000000..168a694 --- /dev/null +++ b/autoscripts/postrm-sgmlcatalog @@ -0,0 +1,3 @@ +if [ "$1" = "purge" ]; then + rm -f #CENTRALCAT# #CENTRALCAT#.old +fi diff --git a/autoscripts/prerm-sgmlcatalog b/autoscripts/prerm-sgmlcatalog new file mode 100644 index 0000000..cdc96e0 --- /dev/null +++ b/autoscripts/prerm-sgmlcatalog @@ -0,0 +1,3 @@ +if [ "$1" = "remove" ]; then + update-catalog --quiet --remove --super #CENTRALCAT# +fi diff --git a/debian/changelog b/debian/changelog index 2a80e74..70e779c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +debhelper (4.1.31) unstable; urgency=low + + * Added dh_installcatalogs, for sgml (and later xml) catalogs. By + Adam DiCarlo. Closes: #90025 + + -- Joey Hess Wed, 12 Feb 2003 11:26:24 -0500 + debhelper (4.1.30) unstable; urgency=low * Turned dh_undocumented into a no-op, as policy does not want diff --git a/debian/copyright b/debian/copyright index 903e21f..50dfa64 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,4 +1,4 @@ -Debhelper is written by and copyright 1997-2002 Joey Hess . +Debhelper is written by and copyright 1997-2003 Joey Hess . Increasinly miniscule parts of the code (and certainly my inspiration from the whole thing) came from debmake, by Christoph Lameter . @@ -10,5 +10,11 @@ dh_perl is by Brendan O'Dea dh_python is by Josselin Mouette The copyright of this package is GPL, version 2 or later. Files in the -examples/ directory are in the public domain. On Debian systems the +examples/ directory are in the public domain[1]. On Debian systems the complete text of the GPL is in /usr/share/common-licenses/GPL + +[1] Pendants who belive I cannot legally say that code I have written is in + the public domain may consider them instead to be licensed as follows: + + Redistribution and use in source and binary forms, with or without + modification, are permitted under any circumstances. No warranty. diff --git a/dh_installcatalogs b/dh_installcatalogs new file mode 100755 index 0000000..16bab81 --- /dev/null +++ b/dh_installcatalogs @@ -0,0 +1,115 @@ +#!/usr/bin/perl -w + +=head1 NAME + +dh_installcatalog - install and register SGML Catalogs + +=cut + +use strict; +use Debian::Debhelper::Dh_Lib; + +my $sgmlbasever = "1.17"; + +=head1 SYNOPSIS + +B [S>] [B<-n>] + +=head1 DESCRIPTION + +dh_registersgmlcatalog is a debhelper program that installs and +registers SGML catalogs. (Note: it will be extended for XML catalog +registration when xml-core is available.) It complies with the Debian +XML/SGML policy. + +The file F.sgmlcatalogs> contains the catalogs to be +installed per package. Each line in that file should be of the form +C, where C indicates where the catalog resides in +the source tree, and C indicates the destination location for +the catalog under the package build area. C should start with +F. + +Catalogs will be registered in a supercatalog, in +F.cat>. + +This script automatically adds maintainer script snippets for +registering and unregistering the catalogs and "supercatalogs" (unless +B<-n> is used). A dependancy on B will be added to +C<${misc:Depends}>, so be sure your package uses that variable in +F. See L for an explantion of +Debhelper maintainer script snippets. + +=head1 OPTIONS + +=over 4 + +=item B<-n>, B<--noscripts> + +Do not modify F/F/F scripts. + +=back + +=head1 NOTES + +Note that this command is not idempotent. "dh_clean -k" should be +called between invocations of this command. Otherwise, it may cause +multiple instances of the same text to be added to maintainer scripts. + +=cut + +init(); + +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmpdir = tmpdir($package); + my $sgmlcatlistfile = pkgfile($package, "sgmlcatalogs"); + my @sgmlinstalled; # catalogs we've installed + if ($#ARGV >= 0) { + error("extra command-line arguments"); + } + if ($sgmlcatlistfile) { + foreach my $line (filedoublearray($sgmlcatlistfile)) { + my $source = $line->[0]; + my $dest = $line->[1]; + my $fulldest = "$tmpdir/$dest"; + $fulldest =~ s|//|/|g; # beautification + + if (! -d dirname($fulldest)) { + doit("install","-d","-m755",dirname($dest)); + } + + doit("install","-p","-m644",$source,$fulldest); + + push(@sgmlinstalled,$dest); + } + } + if (@sgmlinstalled) { + addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever"); + + 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", + "s%#CENTRALCAT#%$centralcat%g;"); + autoscript($package, "postrm", "postrm-sgmlcatalog", + "s%#CENTRALCAT#%$centralcat%g;"); + } + } + else { + # remove the dependency + addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever", 1); + } +} + +=head1 SEE ALSO + +L + +F + +=head1 AUTHOR + +Adam Di Carlo + +=cut -- 2.39.2