]> git.donarmstrong.com Git - debhelper.git/commitdiff
r1596: * Remove duplicate packages from DOPACKAGES after argument processing. version_4.1.68
authorjoey <joey>
Fri, 22 Aug 2003 19:40:51 +0000 (19:40 +0000)
committerjoey <joey>
Fri, 22 Aug 2003 19:40:51 +0000 (19:40 +0000)
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

14 files changed:
Debian/Debhelper/Dh_Getopt.pm
Debian/Debhelper/Dh_Lib.pm
debhelper.pod
debian/changelog
dh_compress
dh_installcron
dh_installinit
dh_installlogrotate
dh_installmodules
dh_installpam
dh_installppp [new file with mode: 0755]
dh_perl
doc/PROGRAMMING
doc/TODO

index 53db13ae294cbab97b5352adf8cf974ee7592522..364187a12b9b440b97695fbb86abfef45f120cd3 100644 (file)
@@ -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;
index 345630d75d59695d9a3b54506a318c39bf417f97..0eea0180f40f9195ffcbb04e452e94105f2f1585 100644 (file)
@@ -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.
 {
index ad40d71419e0c0a428041d23e53f5e7472de5ca1..8b26ca610198d9f01971b23b72210edec1181d43 100644 (file)
@@ -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
 
index 61cc5cfb61f0cfbd0b3fe60d392411e08b48b4fd..c1e7e0c1d257a43d89742d6c6434fcf5c084c5e2 100644 (file)
@@ -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.
index 9d287af420b6477b2b425ce49f2ae2cddfd6e295..cbdf627c55e72205efd1d75f328e5ccc7bb3b3f6 100755 (executable)
@@ -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
index d28277c57e52565e47f87aab97d2af2500b3aaa2..7de54574baeae9161be9eb1fccaef080148030c3 100755 (executable)
@@ -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));
        }
 }
 
index 5e4e1f351fd2e452ffc42245da97f31500a2e663..384eca2b37cf24f55d83dd7ca644c4e0e3f6f2ef 100755 (executable)
@@ -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');
index e028bf7836ee84d306412beaf343c7226c9337cd..9cf1533b8f7319bbe3e9e84b0baf0d9e7d122b49 100755 (executable)
@@ -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));
        }
 }
 
index 13fd8f5c66651e9e3da23897f581807ca2696cd9..36ba519535741df9083a2186304a0c159ea2e197 100755 (executable)
@@ -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} &&
index 0f251798d4e6c918f912e36a5847e2138f339fd5..68678f87f9d20a8b742e839012c8992b861039bc 100755 (executable)
@@ -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 (executable)
index 0000000..06cb193
--- /dev/null
@@ -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 34624d3f38ad3ebd1103fd5dfdb76aee81e03b88..65b1da076d61e8e0fc42876b7c153decb8dd1d84 100755 (executable)
--- 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
        
index 6cae08a5c78ed3fb558fa3e53092e4e01c233d5c..9fa79d1e579a97f53b8a56e097e5cc8b5d508ad6 100644 (file)
@@ -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.
index fdeb606f02e867a8fac85be6f05d465e9b566abb..d078ada3967fb7b4bcd819e45905643fe4f5466f 100644 (file)
--- 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