From d827c6cf1631209f5042a9d1d8a7ecc24223c8a0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 23:06:40 +0200 Subject: Adding upstream version 13.11.4. Signed-off-by: Daniel Baumann --- dh_installcatalogs | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 dh_installcatalogs (limited to 'dh_installcatalogs') diff --git a/dh_installcatalogs b/dh_installcatalogs new file mode 100755 index 0000000..aa5f45d --- /dev/null +++ b/dh_installcatalogs @@ -0,0 +1,138 @@ +#!/usr/bin/perl + +=head1 NAME + +dh_installcatalogs - install and register SGML Catalogs + +=cut + +use strict; +use warnings; +use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + +my $sgmlbasever = "1.28"; + +=head1 SYNOPSIS + +B [S>] [B<-n>] + +=head1 DESCRIPTION + +B is a debhelper program that installs and +registers SGML catalogs. It complies with the Debian XML/SGML policy. + +Catalogs will be registered in a supercatalog, in +F.cat>. + +This command automatically adds maintainer script snippets for +registering and unregistering the catalogs and supercatalogs (unless +B<-n> is used). These snippets are inserted into the maintainer +scripts and the B file by B; see +L for an explanation of Debhelper maintainer script +snippets. + +A dependency on B will be added to B<${misc:Depends}>, so be +sure your package uses that variable in F. + +=head1 FILES + +=over 4 + +=item debian/I.sgmlcatalogs + +Lists the catalogs to be installed per package. Each line in that file +should be of the form C I>, where I indicates where the +catalog resides in the source tree, and I indicates the destination +location for the catalog under the package build area. I should +start with F. + +Supports substitution variables in compat 13 and later as +documented in L. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<-n>, B<--no-scripts> + +Do not modify F/F/F scripts nor add an +activation trigger. + +=back + +=head1 NOTES + +Note that this command is not idempotent. L 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(); + +# PROMISE: DH NOOP WITHOUT sgmlcatalogs cli-options() + +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)) { + # Ensure the parent exist + install_dir($tmpdir."/".dirname($dest)); + } + + install_file($source,$fulldest); + + push(@sgmlinstalled,$dest); + } + } + if (@sgmlinstalled) { + addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever"); + + install_dir("$tmpdir/etc/sgml"); + + my $centralcat = "/etc/sgml/$package.cat"; + + open(my $fd, ">", "$tmpdir$centralcat") || error("failed to write to $tmpdir$centralcat"); + foreach my $sgmldest (@sgmlinstalled) { + print {$fd} "CATALOG " . $sgmldest . "\n"; + } + close($fd) or error("close $tmpdir$centralcat: $!"); + + if (! $dh{NOSCRIPTS}) { + autotrigger($package, "activate-await", "update-sgmlcatalog"); + autoscript($package, "postrm", "postrm-sgmlcatalog", + { 'CENTRALCAT' => $centralcat }); + } + } + else { + # remove the dependency + addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever", 1); + } +} + +=head1 SEE ALSO + +L + +F + +=head1 AUTHOR + +Adam Di Carlo + +=cut -- cgit v1.2.3