summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey>2003-08-22 19:40:51 +0000
committerjoey <joey>2003-08-22 19:40:51 +0000
commit917726187d01b79c7aa454a953f2e483a5171061 (patch)
tree7f614ae4c96f9cd3facf2f25e1be5c49a2c7ff15
parent5dd373940d0348cc4dce74d0b0aa148d35b29934 (diff)
r1596: * Remove duplicate packages from DOPACKAGES after argument processing.
Closes: #112950 * dh_compress: deal with links pointing to links pointing to compressed files, no matter what order find returns them. Closes: #204169 * dh_installmodules, dh_installpam, dh_installcron, dh_installinit, dh_installogrotate: add --name= option, that can be used to specify the name to use for the file(s) installed by these commands. For example, dh_installcron --name=foo will install debian/package.foo.cron.daily to etc/cron.daily/foo. Closes: #138202, #101003, #68545, #148844 (Thanks to Thomas Hood for connecting these bug reports.) * dh_installinit: deprecated --init-script option in favor of the above. * Add dh_installppp. Closes: #43403
-rw-r--r--Debian/Debhelper/Dh_Getopt.pm12
-rw-r--r--Debian/Debhelper/Dh_Lib.pm28
-rw-r--r--debhelper.pod12
-rw-r--r--debian/changelog17
-rwxr-xr-xdh_compress26
-rwxr-xr-xdh_installcron18
-rwxr-xr-xdh_installinit31
-rwxr-xr-xdh_installlogrotate16
-rwxr-xr-xdh_installmodules11
-rwxr-xr-xdh_installpam16
-rwxr-xr-xdh_installppp66
-rwxr-xr-xdh_perl3
-rw-r--r--doc/PROGRAMMING2
-rw-r--r--doc/TODO5
14 files changed, 216 insertions, 47 deletions
diff --git a/Debian/Debhelper/Dh_Getopt.pm b/Debian/Debhelper/Dh_Getopt.pm
index 53db13a..364187a 100644
--- a/Debian/Debhelper/Dh_Getopt.pm
+++ b/Debian/Debhelper/Dh_Getopt.pm
@@ -149,6 +149,8 @@ sub parseopts {
"L|libpackage=s" => \$options{LIBPACKAGE},
+ "name=s" => \$options{NAME},
+
"<>" => \&NonOption,
);
@@ -173,13 +175,19 @@ sub parseopts {
}
push @{$options{DOPACKAGES}},GetPackages();
}
-
+
# Remove excluded packages from the list of packages to act on.
+ # Also unique the list, in case some options were specified that
+ # added a package to it twice.
my @package_list;
my $package;
+ my %packages_seen;
foreach $package (@{$options{DOPACKAGES}}) {
if (! $exclude_package{$package}) {
- push @package_list, $package;
+ if (! exists $packages_seen{$package}) {
+ $packages_seen{$package}=1;
+ push @package_list, $package;
+ }
}
}
@{$options{DOPACKAGES}}=@package_list;
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 345630d..0eea018 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -11,9 +11,9 @@ use Exporter;
use vars qw(@ISA @EXPORT %dh);
@ISA=qw(Exporter);
@EXPORT=qw(&init &doit &complex_doit &verbose_print &error &warning &tmpdir
- &pkgfile &pkgext &isnative &autoscript &filearray &filedoublearray
- &GetPackages &basename &dirname &xargs %dh &compat &addsubstvar
- &delsubstvar &excludefile);
+ &pkgfile &pkgext &pkgfilename &isnative &autoscript &filearray
+ &filedoublearray &GetPackages &basename &dirname &xargs %dh
+ &compat &addsubstvar &delsubstvar &excludefile);
my $max_compat=4;
@@ -283,10 +283,18 @@ sub tmpdir {
# * debian/package.filename.buildarch
# * debian/package.filename
# * debian/file (if the package is the main package)
+# If --name was specified then tonly the first two are tried, and they must
+# have the name after the pacage name:
+# * debian/package.name.filename.buildarch
+# * debian/package.name.filename
sub pkgfile {
my $package=shift;
my $filename=shift;
+ if (defined $dh{NAME}) {
+ $filename="$dh{NAME}.$filename";
+ }
+
if (-f "debian/$package.$filename.".buildarch()) {
return "debian/$package.$filename.".buildarch();
}
@@ -302,7 +310,7 @@ sub pkgfile {
}
# Pass it a name of a binary package, it returns the name to prefix to files
-# in debian for this package.
+# in debian/ for this package.
sub pkgext {
my $package=shift;
@@ -312,6 +320,18 @@ sub pkgext {
return "$package.";
}
+# Pass it the name of a binary package, it returns the name to install
+# files by in eg, etc. Normally this is the same, but --name can override
+# it.
+sub pkgfilename {
+ my $package=shift;
+
+ if (defined $dh{NAME}) {
+ return $dh{NAME};
+ }
+ return $package;
+}
+
# Returns 1 if the package is a native debian package, null otherwise.
# As a side effect, sets $dh{VERSION} to the version of this package.
{
diff --git a/debhelper.pod b/debhelper.pod
index ad40d71..8b26ca6 100644
--- a/debhelper.pod
+++ b/debhelper.pod
@@ -361,13 +361,11 @@ Set to 1 to enable no-act mode.
=item DH_OPTIONS
-Anything in this variable will be prepended to the command line
-arguments of all debhelper commands. This is useful in some situations,
-for example, if you need to pass -p to all debhelper commands that will be
-run. If you use DH_OPTIONS, be sure to build depend on "debhelper >= 1.1.17" --
-older debhelpers will ignore it and do things you don't want them to. One very
-good way to set DH_OPTIONS is by using "Target-specific Variable Values" in
-your debian/rules file. See the make documentation for details on doing this.
+Anything in this variable will be prepended to the command line arguments
+of all debhelper commands. This is useful in some situations, for example,
+if you need to pass -p to all debhelper commands that will be run. One good
+way to set DH_OPTIONS is by using "Target-specific Variable Values" in your
+debian/rules file. See the make documentation for details on doing this.
=item DH_ALWAYS_EXCLUDE
diff --git a/debian/changelog b/debian/changelog
index 61cc5cf..c1e7e0c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+debhelper (4.1.68) unstable; urgency=low
+
+ * Remove duplicate packages from DOPACKAGES after argument processing.
+ Closes: #112950
+ * dh_compress: deal with links pointing to links pointing to compressed
+ files, no matter what order find returns them. Closes: #204169
+ * dh_installmodules, dh_installpam, dh_installcron, dh_installinit,
+ dh_installogrotate: add --name= option, that can be used to specify
+ the name to use for the file(s) installed by these commands. For example,
+ dh_installcron --name=foo will install debian/package.foo.cron.daily to
+ etc/cron.daily/foo. Closes: #138202, #101003, #68545, #148844
+ (Thanks to Thomas Hood for connecting these bug reports.)
+ * dh_installinit: deprecated --init-script option in favor of the above.
+ * Add dh_installppp. Closes: #43403
+
+ -- Joey Hess <joeyh@debian.org> Fri, 22 Aug 2003 15:27:36 -0400
+
debhelper (4.1.67) unstable; urgency=low
* dh_python: Another patch, for pythonX.Y-foo packages.
diff --git a/dh_compress b/dh_compress
index 9d287af..cbdf627 100755
--- a/dh_compress
+++ b/dh_compress
@@ -166,16 +166,24 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
chdir($olddir);
# Fix up symlinks that were pointing to the uncompressed files.
- open (FIND,"find $tmp -type l |");
- while (<FIND>) {
- chomp;
- my ($directory)=m:(.*)/:;
- my $linkval=readlink($_);
- if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") {
- doit("rm","-f",$_);
- doit("ln","-sf","$linkval.gz","$_.gz");
+ my %links = map { chomp; $_ => 1 } `find $tmp -type l`;
+ my $changed;
+ # Keep looping through looking for broken links until no more
+ # changes are made. This is done in case there are links pointing
+ # to links, pointing to compressed files.
+ do {
+ $changed = 0;
+ foreach my $link (keys %links) {
+ my ($directory) = $link =~ m:(.*)/:;
+ my $linkval = readlink($link);
+ if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") {
+ doit("rm","-f",$link);
+ doit("ln","-sf","$linkval.gz","$link.gz");
+ delete $links{$link};
+ $changed++;
+ }
}
- }
+ } while $changed;
}
=head1 SEE ALSO
diff --git a/dh_installcron b/dh_installcron
index d28277c..7de5457 100755
--- a/dh_installcron
+++ b/dh_installcron
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_installcron> [S<B<debhelper options>>]
+B<dh_installcron> [S<B<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
@@ -20,6 +20,18 @@ cron scripts into etc/cron.*/ in package build directories. The files
debian/package.cron.daily, debian/package.cron.weekly,
debian/package.cron.monthly, and debian/package.cron.d are installed.
+=head1 OPTIONS
+
+=over 4
+
+=item B<--name=>I<name>
+
+Look for files named debian/package.name.cron.* and install them as
+etc/cron.*/name, instead of using the usual files and installing them
+as the package name.
+
+=back
+
=cut
init();
@@ -32,7 +44,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! -d "$tmp/etc/cron.$type") {
doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.$type");
}
- doit("install",$cron,"$tmp/etc/cron.$type/$package");
+ doit("install",$cron,"$tmp/etc/cron.$type/".pkgfilename($package));
}
}
# Seperate because this needs to be mode 644.
@@ -41,7 +53,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! -d "$tmp/etc/cron.d") {
doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.d");
}
- doit("install","-m",644,$cron,"$tmp/etc/cron.d/$package");
+ doit("install","-m",644,$cron,"$tmp/etc/cron.d/".pkgfilename($package));
}
}
diff --git a/dh_installinit b/dh_installinit
index 5e4e1f3..384eca2 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_installinit> [S<I<debhelper options>>] [B<--init-script=>I<scriptname>] [B<-n>] [B<-r>] [B<-d>] [S<B<--> I<params>>]
+B<dh_installinit> [S<I<debhelper options>>] [B<--name=>I<name>] [B<-n>] [B<-r>] [B<-d>] [S<B<--> I<params>>]
=head1 DESCRIPTION
@@ -62,16 +62,24 @@ described below.)
Pass "params" to L<update-rc.d(8)>. If not specified, "defaults" will be
passed to L<update-rc.d(8)>.
+=item B<--name=>I<name>
+
+Use "name" as the filename the the init script is installed as in
+etc/init.d/ (and also use it as the filename for the defaults file, if it
+is installed). When this parameter is used, dh_installinit looks for and
+installs files named debian/package.name.init and debian/package.name.default,
+instead of the usual debian/package.init and debian/pacage.default.
+
=item B<--init-script=>I<scriptname>
-Use "scriptname" as for the filename the init script is installed as in
+Use "scriptname" as the filename the init script is installed as in
etc/init.d/ (and also use it as the filename for the defaults file, if it
-is installed). This is useful if you need to have an init script with a name
-different from the package's name. Note that if you use this parameter,
-dh_installinit will look to see if a file in the debian/ directory exists
-that looks like "package.scriptname" and if so will install it as the init
-script in preference to the files it normally installs. This feature is really
-only useful if you need a single package to install more than one init script.
+is installed). If you use this parameter, dh_installinit will look to see
+if a file in the debian/ directory exists that looks like
+"package.scriptname" and if so will install it as the init script in
+preference to the files it normally installs.
+
+This parameter is deprecated, use the --name parameter instead.
=back
@@ -90,7 +98,10 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
# Figure out what filename to install it as.
my $script;
- if ($dh{D_FLAG}) {
+ if (defined $dh{NAME}) {
+ $script=$dh{NAME};
+ }
+ elsif ($dh{D_FLAG}) {
# -d on the command line sets D_FLAG. We will
# remove a trailing 'd' from the package name and
# use that as the name.
@@ -108,7 +119,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
else {
$script=$package;
}
-
+
my $init=pkgfile($package,$script) || pkgfile($package,"init") ||
pkgfile($package,"init.d");
my $default=pkgfile($package,'default');
diff --git a/dh_installlogrotate b/dh_installlogrotate
index e028bf7..9cf1533 100755
--- a/dh_installlogrotate
+++ b/dh_installlogrotate
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_installlogrotate> [S<I<debhelper options>>]
+B<dh_installlogrotate> [S<I<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
@@ -19,6 +19,18 @@ dh_installlogrotate is a debhelper program that is responsible for installing
logrotate config files into etc/logrotate.d in package build directories.
Files named debian/package.logrotate are installed.
+=head1 OPTIONS
+
+=over 4
+
+=item B<--name=>I<name>
+
+Look for files named debian/package.name.logrotate and install them as
+etc/logrotate.d/name, instead of using the usual files and installing them
+as the package name.
+
+=back
+
=cut
init();
@@ -31,7 +43,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! -d "$tmp/etc/logrotate.d") {
doit("install","-o",0,"-g",0,"-d","$tmp/etc/logrotate.d");
}
- doit("install","-m",644,$file,"$tmp/etc/logrotate.d/$package");
+ doit("install","-m",644,$file,"$tmp/etc/logrotate.d/".pkgfilename($package));
}
}
diff --git a/dh_installmodules b/dh_installmodules
index 13fd8f5..36ba519 100755
--- a/dh_installmodules
+++ b/dh_installmodules
@@ -13,7 +13,7 @@ use File::Find;
=head1 SYNOPSIS
-B<dh_installmodules> [S<I<debhelper options>>] [B<-n>]
+B<dh_installmodules> [S<I<debhelper options>>] [B<-n>] [B<--name=>I<name>]
=head1 DESCRIPTION
@@ -37,6 +37,13 @@ has .o files in /lib/modules.
Do not modify postinst/postrm scripts.
+=item B<--name=>I<name>
+
+Use "name" as the filename the the modules file is installed in
+etc/modutils/. When this parameter is used, dh_installmodules looks for and
+installs files named debian/package.name.modules instead of the usual
+debian/package.modules.
+
=back
=head1 NOTES
@@ -71,7 +78,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! -e "$tmp/etc/modutils") {
doit("install","-d","$tmp/etc/modutils");
}
- doit("install","-m","0644",$file,"$tmp/etc/modutils/$package");
+ doit("install","-m","0644",$file,"$tmp/etc/modutils/".pkgfilename($package));
}
if (! $dh{NOSCRIPTS} &&
diff --git a/dh_installpam b/dh_installpam
index 0f25179..68678f8 100755
--- a/dh_installpam
+++ b/dh_installpam
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
-B<dh_installpam> [S<I<debhelper options>>] [B<-n>]
+B<dh_installpam> [S<I<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
@@ -21,6 +21,18 @@ files used by PAM into package build directories.
If a file named debian/package.pam exists, then it is installed into
etc/pam.d/package in the package build directory.
+=head1 OPTIONS
+
+=over 4
+
+=item B<--name=>I<name>
+
+Look for files named debian/package.name.pam and install them as
+etc/pam.d/name, instead of using the usual files and installing them as
+the package name.
+
+=back
+
=cut
init();
@@ -33,7 +45,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
if (! -d "$tmp/etc/pam.d") {
doit("install","-d","$tmp/etc/pam.d");
}
- doit("install","-p","-m644",$pam,"$tmp/etc/pam.d/$package");
+ doit("install","-p","-m644",$pam,"$tmp/etc/pam.d/".pkgfilename($package));
}
}
diff --git a/dh_installppp b/dh_installppp
new file mode 100755
index 0000000..06cb193
--- /dev/null
+++ b/dh_installppp
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_installppp - install ppp if-up and if-down files
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installppp> [S<I<debhelper options>>] [B<--name=>I<name>]
+
+=head1 DESCRIPTION
+
+dh_installppp is a debhelper program that is responsible for installing
+ppp if-up and if-down scripts. into package build directories.
+
+If a file named debian/package.ppp.ip-up exists, then it is installed into
+etc/ppp/ip-up.d/package in the package build directory.
+Files named debian/package.ppp.ip-down are installed to
+etc/ppp/ip-down.d/package
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--name=>I<name>
+
+Look for files named debian/package.name.ppp.ip-* and install them as
+etc/ppp/ip-*/name, instead of using the usual files and installing them
+as the package name.
+
+=back
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+
+ foreach my $script (qw(up down)) {
+ my $file=pkgfile($package, "ppp.ip-$script");
+ if ($file ne '') {
+ if (! -d "$tmp/etc/ppp/ip-$script.d") {
+ doit("install","-d","$tmp/etc/ppp/ip-$script.d");
+ }
+ doit("install","-p","-m755",$file,"$tmp/etc/ppp/ip-$script.d/".pkgfilename($package));
+ }
+ }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Joey Hess <joeyh@debian.org>
+
+=cut
diff --git a/dh_perl b/dh_perl
index 34624d3..65b1da0 100755
--- a/dh_perl
+++ b/dh_perl
@@ -85,8 +85,7 @@ use constant PM_MODULE => 2;
use constant XS_MODULE => 4;
foreach my $package (@{$dh{DOPACKAGES}}) {
- my $tmp = tmpdir($package);
- my $ext = pkgext($package);
+ my $tmp=tmpdir($package);
delsubstvar($package, "perl:Depends"); # for idempotency
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 6cae08a..9fa79d1 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -134,6 +134,8 @@ switch variable description
dh_installemacsen will ever use this)
--number PRIORITY will be set to a number (deprecated)
--priority PRIORITY will be set to a number
+--name NAME a name to use for installed files, instead of
+ the package name
Any additional command line parameters that do not start with "-" will be
ignored, and you can access them later just as you normally would.
diff --git a/doc/TODO b/doc/TODO
index fdeb606..d078ada 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -34,10 +34,6 @@ Wishlist items:
--section is not given. So I should be able to stop parsing it myself for
section, after dpkg 1.10 has been around long enough.
-* Support comments in config files? (#206422)
-* dh_installppp
-* dh_installnetwork
-
Deprecated:
* DH_COMPAT 1. Can be removed once all packages are seen to be using 2 or
@@ -54,3 +50,4 @@ Deprecated:
* debconf-mergetemplates support and the debian/template.ll files and the
debconf-utils dependency.
* dh_undocumented
+* dh_installinit --init-script