"L|libpackage=s" => \$options{LIBPACKAGE},
+ "name=s" => \$options{NAME},
+
"<>" => \&NonOption,
);
}
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;
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;
# * 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();
}
}
# 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;
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.
{
=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
+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.
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
=head1 SYNOPSIS
-B<dh_installcron> [S<B<debhelper options>>]
+B<dh_installcron> [S<B<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
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();
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.
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));
}
}
=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
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
# 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.
else {
$script=$package;
}
-
+
my $init=pkgfile($package,$script) || pkgfile($package,"init") ||
pkgfile($package,"init.d");
my $default=pkgfile($package,'default');
=head1 SYNOPSIS
-B<dh_installlogrotate> [S<I<debhelper options>>]
+B<dh_installlogrotate> [S<I<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
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();
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));
}
}
=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
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
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} &&
=head1 SYNOPSIS
-B<dh_installpam> [S<I<debhelper options>>] [B<-n>]
+B<dh_installpam> [S<I<debhelper options>>] [B<--name=>I<name>]
=head1 DESCRIPTION
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();
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));
}
}
--- /dev/null
+#!/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
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
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.
--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
* debconf-mergetemplates support and the debian/template.ll files and the
debconf-utils dependency.
* dh_undocumented
+* dh_installinit --init-script