summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey>2003-06-12 14:04:11 +0000
committerjoey <joey>2003-06-12 14:04:11 +0000
commitc6737cf60bbb2079a8e6b3de48b1e518597dafb1 (patch)
tree1c0ea5d82068b3ecbafcd2d873e582eecfbec0d8
parentace87ed101089bbbaddce7274d76f02652e5b0a6 (diff)
downloaddebhelper-c6737cf60bbb2079a8e6b3de48b1e518597dafb1.tar.gz
r589: * Added dh_scrollkeeper, by Ross Burton.
* Added dh_userlocal, by Andrew Stribblehill. (With root.root special case added by me.) * Added dh_installlogcheck, by Jon Middleton. Closes: #184021 * Add aph's name to copyright file too.
-rw-r--r--autoscripts/postinst-scrollkeeper3
-rw-r--r--autoscripts/postinst-usrlocal16
-rw-r--r--autoscripts/postrm-scrollkeeper3
-rw-r--r--autoscripts/prerm-usrlocal7
-rw-r--r--debian/changelog10
-rw-r--r--debian/copyright10
-rwxr-xr-xdh_installlogcheck61
-rwxr-xr-xdh_scrollkeeper108
-rwxr-xr-xdh_usrlocal122
9 files changed, 337 insertions, 3 deletions
diff --git a/autoscripts/postinst-scrollkeeper b/autoscripts/postinst-scrollkeeper
new file mode 100644
index 00000000..5f2a255d
--- /dev/null
+++ b/autoscripts/postinst-scrollkeeper
@@ -0,0 +1,3 @@
+if [ "$1" = "configure" ]; then
+ scrollkeeper-update -q
+fi
diff --git a/autoscripts/postinst-usrlocal b/autoscripts/postinst-usrlocal
new file mode 100644
index 00000000..a2f004db
--- /dev/null
+++ b/autoscripts/postinst-usrlocal
@@ -0,0 +1,16 @@
+if [ "$1" = configure ]; then
+(
+ while read line; do
+ set -- $line
+ dir="$1"; mode="$2"; user="$3"; group="$4"
+ if [ ! -e "$dir" ]; then
+ if mkdir "$dir" 2>/dev/null; then
+ chown "$user":"$group" "$dir"
+ chmod "$mode" "$dir"
+ fi
+ fi
+ done
+) << DATA
+#DIRS#
+DATA
+fi
diff --git a/autoscripts/postrm-scrollkeeper b/autoscripts/postrm-scrollkeeper
new file mode 100644
index 00000000..209a6e14
--- /dev/null
+++ b/autoscripts/postrm-scrollkeeper
@@ -0,0 +1,3 @@
+if [ "$1" = "remove" ]; then
+ scrollkeeper-update -q
+fi
diff --git a/autoscripts/prerm-usrlocal b/autoscripts/prerm-usrlocal
new file mode 100644
index 00000000..baafc23e
--- /dev/null
+++ b/autoscripts/prerm-usrlocal
@@ -0,0 +1,7 @@
+(
+ while read dir; do
+ rmdir "$dir" 2>/dev/null || true
+ done
+) << DATA
+#JUSTDIRS#
+DATA
diff --git a/debian/changelog b/debian/changelog
index 902c451f..20fd27bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+debhelper (4.1.46) unstable; urgency=low
+
+ * Added dh_scrollkeeper, by Ross Burton.
+ * Added dh_userlocal, by Andrew Stribblehill. (With root.root special case
+ added by me.)
+ * Added dh_installlogcheck, by Jon Middleton. Closes: #184021
+ * Add aph's name to copyright file too.
+
+ -- Joey Hess <joeyh@debian.org> Thu, 12 Jun 2003 10:01:28 -0400
+
debhelper (4.1.45) unstable; urgency=low
* Typo fixes from Adam Garside.
diff --git a/debian/copyright b/debian/copyright
index 50dfa64b..931864dd 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -3,11 +3,15 @@ Debhelper is written by and copyright 1997-2003 Joey Hess <joeyh@debian.org>.
Increasinly miniscule parts of the code (and certainly my inspiration from the
whole thing) came from debmake, by Christoph Lameter <clameter@debian.org>.
-Some of the dh_md5sums command is from a program by Charles
+Some of the dh_md5sums command is from a program by Charles
Briscoe-Smith <cpb4@ukc.ac.uk>.
-dh_perl is by Brendan O'Dea <bod@debian.org>
-dh_python is by Josselin Mouette <josselin.mouette@ens-lyon.org>
+dh_perl is by Brendan O'Dea <bod@debian.org>.
+dh_python is by Josselin Mouette <josselin.mouette@ens-lyon.org>.
+dh_installcatalogs is by Adam Di Carlo <aph@debian.org>.
+dh_scrollkeeper is by Ross Burton <ross@burtonini.com>.
+dh_usrlocal is by Andrew Stribblehill <ads@debian.org>.
+dh_installlogcheck is by Jon Middleton <jjm@debian.org>.
The copyright of this package is GPL, version 2 or later. Files in the
examples/ directory are in the public domain[1]. On Debian systems the
diff --git a/dh_installlogcheck b/dh_installlogcheck
new file mode 100755
index 00000000..cea81959
--- /dev/null
+++ b/dh_installlogcheck
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_installlogcheck - install logcheck rulefiles into etc/logcheck/
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installlogcheck> [S<B<debhelper options>>]
+
+=head1 DESCRIPTION
+
+dh_installlocgheck is a debhelper program that is responsible for
+installing logcheck rule files into subdirectories of etc/logcheck/ in
+package build directories. The files debian/package.logcheck.cracking,
+debian/package.logcheck.violations,
+debian/package.logcheck.violations.ignore,
+debian/package.logcheck.ignore.workstation,
+debian/package.logcheck.ignore.server and
+debian/package.logcheck.ignore.paranoid are installed if present.
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+
+ foreach my $type (qw{ignore.d.workstation ignore.d.server
+ ignore.d.paranoid cracking.d
+ violations.d violations.ignore.d}) {
+ my $typenod=$type;
+ $typenod=~s/\.d//;
+ my $logcheck=pkgfile($package,"logcheck.$typenod");
+ if ($logcheck) {
+ if (! -d "$tmp/etc/logcheck/$type") {
+ doit("install","-o",0,"-g",0,"-d","$tmp/etc/logcheck/$type");
+ }
+ my $packagenodot=$package; # run-parts..
+ $packagenodot=~s/\./_/g;
+ doit("install","-m",600,$logcheck,"$tmp/etc/logcheck/$type/$packagenodot");
+ }
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Jon Middleton <jjm@debian.org>
+
+=cut
diff --git a/dh_scrollkeeper b/dh_scrollkeeper
new file mode 100755
index 00000000..fb459cb3
--- /dev/null
+++ b/dh_scrollkeeper
@@ -0,0 +1,108 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_scrollkeeper - generate ScrollKeeper registration scripts
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_scrollkeeper> [S<I<debhelper options>>] [B<-n>] [S<I<directory>>]
+
+=head1 DESCRIPTION
+
+B<dh_scrollkeeper> is a debhelper program that handles correctly
+registering OMF files that it finds in package build trees with
+ScrollKeeper.
+
+This command automatically adds maintainer script snippets for registering
+and unregistering files with ScrollKeeper (unless B<-n> is used). A
+dependency on scrollkeeper will be added to C<${misc:Depends}>, so be sure
+your package uses that variable in F<debian/control>. See
+L<dh_installdeb(1)> for an explantion of Debhelper maintainer script
+snippets.
+
+It will also change any DTD declarations in the OMF and DocBook files
+to refer to local files instead of remote URLs. This change does not
+modify the source files, but the files in the package build tree.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify F<postinst>/F<postrm> 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();
+
+# This is a list of paths where DocBook files might be stored.
+my @xml_paths = (
+ 'usr/share/gnome/help' # GNOME Help
+);
+
+# Append the remaining command line arguments
+push @xml_paths, @ARGV if @ARGV;
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+
+ # Only run if there have been OMF files installed
+ if (-d "$tmp/usr/share/omf") {
+ # Get a list of the OMF files
+ my @omf_files = `find $tmp/usr/share/omf -type f -printf '%p\n'`;
+ if (@omf_files) {
+ # Change any remote DTDs into local DTDs. We only
+ # look at the first 10 lines to avoid changing any
+ # of the content. First, the OMF files
+ foreach my $file (@omf_files) {
+ chomp $file;
+ doit("perl", "-i", "-pe", "'s,http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd,/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd, if \$. < 10'", $file);
+ }
+ # I could be cunning and parse the OMF for the DocBook
+ # files. That is far too much effort. Find to the
+ # rescue! Look for .xml files in the list of
+ # directories we think they might be in.
+ foreach my $xmlpath (@xml_paths) {
+ foreach my $file (`find $tmp/$xmlpath -type f -name \*.xml -printf '%p\n'`) {
+ chomp $file;
+ doit("perl", "-i", "-pe", "'s,http://www.oasis-open.org/docbook/xml/([^/]+)/docbookx.dtd,/usr/share/sgml/docbook/dtd/xml/\\1/docbookx.dtd, if \$. < 10'", $file);
+ }
+ }
+
+ if (! $dh{NOSCRIPTS}) {
+ autoscript($package,"postinst","postinst-scrollkeeper");
+ autoscript($package,"postrm","postrm-scrollkeeper");
+ }
+ # The scripts use scrollkeeper-update with the -q
+ # option, so we require 0.3.8+.
+ addsubstvar($package, "misc:Depends", "scrollkeeper", ">= 0.3.8");
+ }
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Ross Burton <ross@burtonini.com>
+
+=cut
diff --git a/dh_usrlocal b/dh_usrlocal
new file mode 100755
index 00000000..603c37ca
--- /dev/null
+++ b/dh_usrlocal
@@ -0,0 +1,122 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+dh_usrlocal - migrate usr/local directories to maintainer scripts
+
+=cut
+
+use warnings;
+use strict;
+use Debian::Debhelper::Dh_Lib;
+use File::Find;
+use File::stat;
+
+=head1 SYNOPSIS
+
+B<dh_usrlocal> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+dh_usrlocal is a debhelper program that can be used for building packages
+that will provide a subdirectory in /usr/local when installed.
+
+It finds subdirectories of usr/local in the package build directory, and
+removes them, replacing them with maintainer script snippets (unless B<-n>
+is used) to create the directories at install time, and remove them when
+the package is removed, in a manner compliant with Debian policy. See
+L<dh_installdeb(1)> for an explantion of Debhelper maintainer script
+snippets.
+
+If the directories found in the build tree have unusual owners, groups, or
+permisions, then those values will be preserved in the directories made by
+the postinst script. However, as a special exception, if a directory is owned
+by root.root, it will be treated as if it is owned by root.staff and is mode
+2775. This is useful, since that is the group and mode policy recommends for
+directories in /usr/local.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify F<postinst>/F<prerm> 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.
+
+=head1 CONFORMS TO
+
+Debian policy, version 2.2
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp = tmpdir($package);
+
+ if (-d "$tmp/usr/local") {
+ my (@dirs, @justdirs);
+ find({bydepth => 1,
+ no_chdir => 1,
+ wanted => sub {
+ my $fn = $File::Find::name;
+ if (-d $fn) {
+ my $stat = stat $fn;
+ my $user = getpwuid $stat->uid;
+ my $group = getgrgid $stat->gid;
+ my $mode = sprintf "%04lo", ($stat->mode & 07777);
+
+ if ($stat->uid == 0 && $stat->gid == 0) {
+ $group = 'staff';
+ $mode = '2775';
+ }
+
+ $fn =~ s!^\Q$tmp\E!!;
+ return if $fn eq '/usr/local';
+
+ # @dirs is in parents-first order for dir creation...
+ unshift @dirs, "$fn $mode $user $group";
+ # ...whereas @justdirs is depth-first for removal.
+ push @justdirs, $fn;
+ doit("rmdir $_");
+ }
+ else {
+ warning("$fn is not a directory");
+ }
+ }}, "$tmp/usr/local");
+ doit("rmdir $tmp/usr/local");
+
+ my $bs = "\\"; # A single plain backslash
+ my $ebs = $bs x 2; # Escape the backslash from the shell
+ # This constructs the body of a 'sed' c\ expression which
+ # is parsed by the shell in double-quotes
+ my $dirs = join("$ebs\n", @dirs);
+ my $justdirs = join("$ebs\n", @justdirs);
+ if (! $dh{NOSCRIPTS}) {
+ autoscript($package,"postinst", "postinst-usrlocal",
+ "/#DIRS#/ c${ebs}\n${dirs}");
+ autoscript($package,"prerm", "prerm-usrlocal",
+ "/#JUSTDIRS#/ c${ebs}\n${justdirs}");
+ }
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Andrew Stribblehill <ads@debian.org>
+
+=cut