diff options
author | unknown <unknown> | 2003-07-28 18:45:21 +0000 |
---|---|---|
committer | unknown <unknown> | 2003-07-28 18:45:21 +0000 |
commit | 6c3a91cd903333aa03c3c648fdd796ef10cbc2f6 (patch) | |
tree | 8729bf86eb7747cd3b593e3c7888653e1548886d | |
parent | d579dae0cf159c50dcd902ff4a35590f7dcff395 (diff) | |
parent | 63e45075003b1d9fcff097b5644a81131c346653 (diff) | |
download | debhelper-version_2.0.86.tar.gz |
r884: This commit was manufactured by cvs2svn to create tagversion_2.0.86
'debian_version_2_0_86'.
-rwxr-xr-x | dh_clean | 111 | ||||
-rwxr-xr-x | dh_gencontrol | 80 | ||||
-rwxr-xr-x | dh_installcron | 58 | ||||
-rwxr-xr-x | dh_installdirs | 97 | ||||
-rwxr-xr-x | dh_installemacsen | 118 | ||||
-rwxr-xr-x | dh_installinit | 181 | ||||
-rwxr-xr-x | dh_installmenu | 91 | ||||
-rwxr-xr-x | dh_installmime | 75 | ||||
-rwxr-xr-x | dh_installmodules | 94 | ||||
-rwxr-xr-x | dh_installpam | 50 | ||||
-rwxr-xr-x | dh_link | 181 | ||||
-rwxr-xr-x | dh_listpackages | 38 | ||||
-rwxr-xr-x | dh_md5sums | 95 | ||||
-rwxr-xr-x | dh_perl | 249 | ||||
-rwxr-xr-x | dh_strip | 154 | ||||
-rwxr-xr-x | dh_testdir | 53 | ||||
-rwxr-xr-x | dh_testversion | 84 | ||||
-rw-r--r-- | t/dh_link | 12 |
18 files changed, 156 insertions, 1665 deletions
@@ -1,77 +1,25 @@ #!/usr/bin/perl -w +# +# Clean up $TMP and other tepmorary files generated by the +# build process. -=head1 NAME - -dh_clean - clean up package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_clean> [S<I<debhelper options>>] [B<-k>] [B<-d>] [B<-X>I<item>] [S<I<file ...>>] - -=head1 DESCRIPTION - -dh_clean is a debhelper program that is responsible for cleaning up after a -package is built. It removes the package build directories, and removes some -other files including debian/files, and any detritus left behind by other -debhelper commands. It also removes common files that should not appear in a -debian diff: - #*# *~ DEADJOE *.orig *.rej *.SUMS TAGS core .deps/* *.P - -=head1 OPTIONS - -=over 4 - -=item B<-k>, B<--keep> - -Do not delete debian/files. When do you want to use this? Anytime you have a -debian/rules that has 2 binary targets that build different .deb packages; -for example, one target is binary-arch, and the other is binary-indep, or -one target builds the shared library, and the other the -dev package. If you -didn't use -k in these cases, then debian/files would be deleted in the -middle, and your changes file will only contain the last binary package that -was built. - -=item B<-d>, B<--dirs-only> - -Only clean the package build directories, do not clean up any other files -at all. - -=item B<-X>I<item> B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from being -deleted, even if they would normally be deleted. You may use this option -multiple times to build up a list of things to exclude. - -=item I<file ...> - -Delete these files too. - -=back - -=cut - +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; init(); -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $ext=pkgext($package); +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $EXT=pkgext($PACKAGE); if (! $dh{D_FLAG}) { - doit("rm","-f","debian/${ext}substvars") - unless excludefile("debian/${ext}substvars"); - - # These are all debhelper temp files, and so it is safe to - # wildcard them. - complex_doit("rm -f debian/$ext*.debhelper"); + doit("rm","-f","debian/$EXT\substvars", + "debian/$EXT\postinst.debhelper", + "debian/$EXT\postrm.debhelper", + "debian/$EXT\preinst.debhelper", + "debian/$EXT\prerm.debhelper"); } - doit ("rm","-rf",$tmp) - unless excludefile($tmp); + doit ("rm","-rf",$TMP); } if (! $dh{D_FLAG}) { @@ -80,14 +28,7 @@ if (! $dh{D_FLAG}) { } if (! $dh{K_FLAG}) { - doit("rm","-f","debian/files") - unless excludefile("debian/files"); - } - - # See if some files that would normally be deleted are excluded. - my $find_options=''; - if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { - $find_options="-a ! ( $dh{EXCLUDE_FIND} )"; + doit("rm","-f","debian/files"); } # Remove other temp files. @@ -95,27 +36,11 @@ if (! $dh{D_FLAG}) { # parameters). Note that you _don't_ quote wildcards used by find # in here. doit(split(/\s+/,"find . -type f -a - ( -name #*# -o -name .*~ -o -name *~ -o -name DEADJOE + ( -name #*# -o -name *~ -o -name DEADJOE -o -name *.orig -o -name *.rej -o -name *.bak -o -name .*.orig -o -name .*.rej -o -name .SUMS -o -name TAGS -o -name core -o ( -path */.deps/* -a -name *.P ) - ) $find_options -exec rm -f {} ;")); - - # Stupid autoconf cache directory. - doit("rm", "-rf", "autom4te.cache") - unless excludefile("autom4te.cache"); + ) -exec rm -f {} ;")); } -doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! compat(1); - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut +doit('rm', '-rf', 'debian/tmp') if -x 'debian/tmp' && ! Dh_Lib::compat(1); diff --git a/dh_gencontrol b/dh_gencontrol deleted file mode 100755 index 4e9ff3e8..00000000 --- a/dh_gencontrol +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_gencontrol - generate and install control file - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_gencontrol> [S<I<debhelper options>>] [S<B<--> I<params>>] - -=head1 DESCRIPTION - -dh_gencontrol is a debhelper program that is responsible for generating -control files, and installing them into the DEBIAN directory with the -proper permissions. - -This program is merely a wrapper around L<dpkg-gencontrol(1)>, which calls -it once for each package being acted on, and passes in some additional -useful flags including "-isp". - -=head1 OPTIONS - -=over 4 - -=item B<-u>I<params>, B<--dpkg-gencontrol-params>I<params> - -=item B<--> I<params> - -Pass "params" to L<dpkg-gencontrol(1)>. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $ext=pkgext($package); - - my $changelog=pkgfile($package,'changelog'); - if (! $changelog) { - $changelog='debian/changelog'; - } - - if ( ! -d "$tmp/DEBIAN" ) { - doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN"); - } - - # Generate and install control file. - my @command="dpkg-gencontrol"; - if (GetPackages() > 1) { - push @command, "-p$package"; - } - doit(@command, "-l$changelog", "-isp", "-Tdebian/${ext}substvars", - "-P$tmp",@{$dh{U_PARAMS}}); - - # This chmod is only necessary if the user sets the umask to - # something odd. - doit("chmod","644","$tmp/DEBIAN/control"); - - doit("chown","0.0","$tmp/DEBIAN/control"); -} - -=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_installcron b/dh_installcron deleted file mode 100755 index d28277c5..00000000 --- a/dh_installcron +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installcron - install cron scripts into etc/cron.* - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installcron> [S<B<debhelper options>>] - -=head1 DESCRIPTION - -dh_installcron is a debhelper program that is responsible for installing -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. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - foreach my $type (qw{daily weekly monthly}) { - my $cron=pkgfile($package,"cron.$type"); - if ($cron) { - 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"); - } - } - # Seperate because this needs to be mode 644. - my $cron=pkgfile($package,"cron.d"); - if ($cron) { - 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"); - } -} - -=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_installdirs b/dh_installdirs deleted file mode 100755 index 3bd4ea80..00000000 --- a/dh_installdirs +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installdirs - create subdirectories in package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir ...>>] - -=head1 DESCRIPTION - -dh_installdirs is a debhelper program that is responsible for creating -subdirectories in package build directories. - -Any directory names specified as parameters will be created in the package -build directory of the first package dh_installdirs is told to act on. By -default, this is the first binary package in debian/control, but if you use --p, -i, or -a flags, it will be the first package specified by those flags. - -A file named debian/package.dirs can list other directories to be created. -Separate the directory names with whitespace. - -Be sure to only use directory names relative to the package build -directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead. - -=head1 OPTIONS - -=over 4 - -=item B<-A>, B<--all> - -Create any directories specified by command line parameters in ALL packages -acted on, not just the first. - -=item I<dir ...> - -Create these directories in the package build directory of the first -package acted on. (Or in all packages if -A is specified.) - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $file=pkgfile($package,"dirs"); - - if (! -e $tmp) { - doit("install","-d",$tmp); - } - - my @dirs; - - if ($file) { - @dirs=filearray($file) - } - - if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { - push @dirs, @ARGV; - } - - if (@dirs) { - # Stick the $tmp onto the front of all the dirs. - # This is necessary, for 2 reasons, one to make them - # be in the right directory, but more importantly, it - # protects against the danger of absolute dirs being - # specified. - @dirs=map { - $_="$tmp/$_"; - tr:/:/:s; # just beautification. - $_ - } @dirs; - - # Create dirs. - doit("install","-d",@dirs); - } -} - -=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_installemacsen b/dh_installemacsen deleted file mode 100755 index 80b83e69..00000000 --- a/dh_installemacsen +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installemacsen - register an emacs add on package - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installemacsen> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [B<--flavor=>I<foo>] - -=head1 DESCRIPTION - -dh_installemacsen is a debhelper program that is responsible for installing -files used by the debian emacsen-common package into package build -directories. - -It also automatically generates the postinst and prerm commands needed to -register a package as an emacs add on package. See L<dh_installdeb(1)> -for an explanation of how this works. - -If a file named debian/package.emacsen-install exists, then it is installed -into -usr/lib/emacsen-common/packages/install/package in the package build -directory. Similarly, debian/package.emacsen-remove is installed into -usr/lib/emacsen-common/packages/remove/package . And similarly, -debian/package.emacsen-startup is installed into -etc/emacs/site-start.d/50<package>.el (by default). - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/prerm scripts. - -=item B<--priority=>I<n> - -Sets the priority number of a site-start.d file. Default is 50. - -=item B<--flavor=>I<foo> - -Sets the flavor a site-start.d file will be installed in. Default is -"emacs", alternatives include "xemacs" and "emacs20". - -=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(); - -if (! defined $dh{PRIORITY}) { - $dh{PRIORITY}=50; -} -if (! defined $dh{FLAVOR}) { - $dh{FLAVOR}='emacs'; -} - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - - my $emacsen_install=pkgfile($package,"emacsen-install"); - my $emacsen_remove=pkgfile($package,"emacsen-remove"); - my $emacsen_startup=pkgfile($package,"emacsen-startup"); - - if ($emacsen_install ne '') { - if (! -d "$tmp/usr/lib/emacsen-common/packages/install") { - doit("install","-d","$tmp/usr/lib/emacsen-common/packages/install"); - } - doit("install","-m0755",$emacsen_install,"$tmp/usr/lib/emacsen-common/packages/install/$package"); - } - - if ($emacsen_remove ne '') { - if (! -d "$tmp/usr/lib/emacsen-common/packages/remove") { - doit("install","-d","$tmp/usr/lib/emacsen-common/packages/remove"); - } - doit("install","-m0755","$emacsen_remove","$tmp/usr/lib/emacsen-common/packages/remove/$package"); - } - - if ($emacsen_startup ne '') { - if (! -d "$tmp/etc/$dh{FLAVOR}/site-start.d/") { - doit("install","-d","$tmp/etc/$dh{FLAVOR}/site-start.d/"); - } - doit("install","-m0644",$emacsen_startup,"$tmp/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$package.el"); - } - - if ($emacsen_install ne '' || $emacsen_remove ne '') { - if (! $dh{NOSCRIPTS}) { - autoscript($package,"postinst","postinst-emacsen", - "s/#PACKAGE#/$package/"); - autoscript($package,"prerm","prerm-emacsen", - "s/#PACKAGE#/$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_installinit b/dh_installinit deleted file mode 100755 index 5e4e1f35..00000000 --- a/dh_installinit +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installinit - install init scripts into package build directories - -=cut - -use strict; -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>>] - -=head1 DESCRIPTION - -dh_installinit is a debhelper program that is responsible for installing -init scripts and associated defaults files into package build directories. - -It also automatically generates the postinst and postrm and prerm commands -needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init -scripts. - -If a file named debian/package.init exists, then it is installed into -etc/init.d/package in the package build directory, with "package" replaced -by the package name. - -If a file named debian/package.default exists, then it is installed into -etc/default/package in the package build directory, with "package" replaced -by the package name. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm/prerm scripts. - -=item B<-r>, B<--no-restart-on-upgrade> - -Do not restart init script on upgrade. - -=item B<--no-start> - -Do not start the init script on install or upgrade, or stop it on removal. -Only call update-rc.d. Useful for rcS scripts. - -=item B<-d>, B<--remove-d> - -Remove trailing "d" from the name of the package, and use the result for the -filename the init script is installed as in etc/init.d/ , and the default file -is installed as in etc/default/ . This may be useful for daemons with names -ending in "d". (Note: this takes precedence over the --init-script parameter -described below.) - -=item B<-u>I<params> B<--update-rcd-params=>I<params> - -=item B<--> I<params> - -Pass "params" to L<update-rc.d(8)>. If not specified, "defaults" will be -passed to L<update-rc.d(8)>. - -=item B<--init-script=>I<scriptname> - -Use "scriptname" as for 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. - -=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(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - - # Figure out what filename to install it as. - my $script; - if ($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. - $script=$package; - if ($script=~m/(.*)d$/) { - $script=$1; - } - else { - warning("\"$package\" has no final d' in its name, but -d was specified."); - } - } - elsif ($dh{INIT_SCRIPT}) { - $script=$dh{INIT_SCRIPT}; - } - else { - $script=$package; - } - - my $init=pkgfile($package,$script) || pkgfile($package,"init") || - pkgfile($package,"init.d"); - my $default=pkgfile($package,'default'); - - if ($default ne '') { - if (! -d "$tmp/etc/default") { - doit("install","-d","$tmp/etc/default"); - } - doit("install","-p","-m644",$default,"$tmp/etc/default/$script"); - } - - if ($init ne '') { - if (! -d "$tmp/etc/init.d") { - doit("install","-d","$tmp/etc/init.d"); - } - - doit("install","-p","-m755",$init,"$tmp/etc/init.d/$script"); - - # This is set by the -u "foo" command line switch, it's - # the parameters to pass to update-rc.d. If not set, - # we have to say "defaults". - my $params=''; - if (defined($dh{U_PARAMS})) { - $params=join(' ',@{$dh{U_PARAMS}}); - } - if ($params eq '') { - $params="defaults"; - } - - if (! $dh{NOSCRIPTS}) { - if (! $dh{NO_START}) { - # update-rc.d, and start script - autoscript($package,"postinst", "postinst-init", - "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); - - if ($dh{R_FLAG}) { - # stops script only on remove - autoscript($package,"prerm","prerm-init-norestart", - "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); - } - else { - # always stops script - autoscript($package,"prerm","prerm-init", - "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); - } - } - else { - # just update-rc.d - autoscript($package,"postinst", "postinst-init-nostart", - "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); - } - - # removes rc.d links - autoscript($package,"postrm","postrm-init", - "s/#SCRIPT#/$script/;s/#INITPARMS#/$params/"); - } - } -} - -=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_installmenu b/dh_installmenu deleted file mode 100755 index 420b2164..00000000 --- a/dh_installmenu +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmenu - install debian menu files into package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installmenu> [S<B<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmenu is a debhelper program that is responsible for installing -files used by the debian menu package into package build directories. - -It also automatically generates the postinst and postrm commands needed to -interface with the debian menu package. See L<dh_installdeb(1)> for an -explanation of how this works. - -If a file named debian/package.menu exists, then it is installed into -usr/lib/menu/package in the package build directory. This is a debian menu -file. See L<menufile(5L)> for its format. - -If a file named debian/package.menu-method exits, then it is installed into -etc/menu-methods/package in the package build directory. This is a debian -menu method file. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/postrm scripts. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $menu=pkgfile($package,"menu"); - my $menu_method=pkgfile($package,"menu-method"); - - if ($menu ne '') { - if (! -d "$tmp/usr/lib/menu") { - doit("install","-d","$tmp/usr/lib/menu"); - } - doit("install","-p","-m644",$menu,"$tmp/usr/lib/menu/$package"); - - # Add the scripts if a menu-method file doesn't exist. - # The scripts for menu-method handle everything these do, too. - if ($menu_method eq "" && ! $dh{NOSCRIPTS}) { - autoscript($package,"postinst","postinst-menu"); - autoscript($package,"postrm","postrm-menu") - } - } - - if ($menu_method ne '') { - if (!-d "$tmp/etc/menu-methods") { - doit("install","-d","$tmp/etc/menu-methods"); - } - doit("install","-p",$menu_method,"$tmp/etc/menu-methods/$package"); - - if (! $dh{NOSCRIPTS}) { - autoscript($package,"postinst","postinst-menu-method","s/#PACKAGE#/$package/"); - autoscript($package,"postrm","postrm-menu-method","s/#PACKAGE#/$package/"); - } - } -} - -=head1 SEE ALSO - -L<debhelper(7)> -L<update-menus(1)> -L<menufile(5)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut diff --git a/dh_installmime b/dh_installmime deleted file mode 100755 index 8ffd5236..00000000 --- a/dh_installmime +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmime - install mime files into package build directories - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installmime> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmime is a debhelper program that is responsible for installing -mime files into package build directories. - -It also automatically generates the postinst and postrm commands needed to -interface with the debian mime-support package. See L<dh_installdeb(1)> for -an explanation of how this works. - -If a file named debian/package.mime exists, then it is installed into -usr/lib/mime/packages/package in the package build directory. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/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(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $mime=pkgfile($package,"mime"); - - if ($mime ne '') { - if (! -d "$tmp/usr/lib/mime/packages") { - doit("install","-d","$tmp/usr/lib/mime/packages"); - } - doit("install","-p","-m644",$mime,"$tmp/usr/lib/mime/packages/$package"); - - if (! $dh{NOSCRIPTS}) { - autoscript($package,"postinst","postinst-mime"); - autoscript($package,"postrm","postrm-mime") - } - } -} - -=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_installmodules b/dh_installmodules deleted file mode 100755 index 13fd8f5c..00000000 --- a/dh_installmodules +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installmodules - register modules with modutils - - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; -use File::Find; - -=head1 SYNOPSIS - -B<dh_installmodules> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installmodules is a debhelper program that is responsible for -registering kernel modules with modutils. - -Files named debian/package.modules will be installed as -etc/modutils/package in the package build directory. - -Then postinst and postrm commands are automatically generated to register -the modules when the package is installed. See L<dh_installdeb(1)> for an -explanation of how this works. Note that this will be done for any -package this program acts on which has either the above-mentioned file, or -has .o files in /lib/modules. - -=head1 OPTIONS - -=over 4 - -=item B<-n>, B<--noscripts> - -Do not modify postinst/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(); - -# Returns true if there are any .o files in the passed directory. -sub find_kernel_modules { - my $searchdir=shift; - my @results=(); - - return unless -d $searchdir; - find(sub { push @results, $_ if /\.o$/ }, $searchdir); - return @results > 0; -} - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $file=pkgfile($package,"modules"); - - if (! -e $tmp) { - doit("install","-d",$tmp); - } - - if ($file) { - if (! -e "$tmp/etc/modutils") { - doit("install","-d","$tmp/etc/modutils"); - } - doit("install","-m","0644",$file,"$tmp/etc/modutils/$package"); - } - - if (! $dh{NOSCRIPTS} && - ($file || find_kernel_modules("$tmp/lib/modules"))) { - autoscript($package,"postinst","postinst-modules","s/#PACKAGE#/$package/"); - autoscript($package,"postrm","postrm-modules","s/#PACKAGE#/$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_installpam b/dh_installpam deleted file mode 100755 index 0f251798..00000000 --- a/dh_installpam +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_installpam - install pam support files - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_installpam> [S<I<debhelper options>>] [B<-n>] - -=head1 DESCRIPTION - -dh_installpam is a debhelper program that is responsible for installing -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. - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $pam=pkgfile($package,"pam"); - - if ($pam ne '') { - if (! -d "$tmp/etc/pam.d") { - doit("install","-d","$tmp/etc/pam.d"); - } - doit("install","-p","-m644",$pam,"$tmp/etc/pam.d/$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_link b/dh_link deleted file mode 100755 index 6cb889cd..00000000 --- a/dh_link +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_link - create symlinks in package build directories - -=cut - -use strict; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_link> [S<I<debhelper options>>] [B<-A>] [S<I<source destination ...>>] - -=head1 DESCRIPTION - -dh_link is a debhelper program that creates symlinks in package build -directories. - -dh_link accepts a list of pairs of source and destination files. The source -files are the already existing files that will be symlinked from. The -destination files are the symlinks that will be created. There B<must> be -an equal number of source and destination files specified. - -The list can be specified in two ways. A file named debian/package.links -can list pairs of files. If you use this file, you should put each pair -of files on its own line, and separate the files within the pair with -whitespace. Also, pairs of files can be specified as parameters - these -pairs will only be created in the package build directory of the first -package dh_link is told to act on. By default, this is the first binary -package in debian/control, but if you use -p, -i, or -a flags, it will be -the first package specified by those flags. - -Be sure you B<do> specify the full filename to both the source and -destination files (unlike you would do if you were using something like -L<ln(1)>). - -dh_link will generate symlinks that comply with debian policy - absolute -when policy says they should be absolute, and relative links with as short -a path as possible. It will also create any subdirectories it needs to to put -the symlinks in. - -dh_link also scans the package build tree for existing symlinks which do not -conform to debian policy, and corrects them (v4 only). - -=head1 OPTIONS - -=over 4 - -=item B<-A>, B<--all> - -Create any links specified by command line parameters in ALL packages -acted on, not just the first. - -=item I<source destination ...> - -Create a file named "destination" as a link to a file named "source". Do -this in the package build directory of the first package acted on. -(Or in all packages if -A is specified.) - -=back - -=head1 EXAMPLES - - dh_link usr/share/man/man1/foo.1 usr/share/man/man1/bar.1 - -Make bar.1 be a symlink to foo.1 - - dh_link var/lib/foo usr/lib/foo \ - usr/X11R6/man/man1/foo.1x usr/share/man/man1/bar.1 - -Make /usr/lib/foo/ be a link to /var/lib/foo/, and bar.1 be a symlink to -the X man page foo.1x - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - my $file=pkgfile($package,"links"); - - my @links; - if ($file) { - @links=filearray($file); - } - - # Make sure it has pairs of symlinks and destinations. If it - # doesn't, $#links will be _odd_ (not even, -- it's zero-based). - if (int($#links/2) eq $#links/2) { - error("$file lists a link without a destination."); - } - - if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { - push @links, @ARGV; - } - - # Same test as above, including arguments this time. - if (int($#links/2) eq $#links/2) { - error("parameters list a link without a destination."); - } - - # v4 only and only if there is a temp dir already - if (! compat(3) && -e $tmp) { - # Scan for existing links and add them to @links, so they - # are recreated policy conformant. - find( - sub { - return unless -l; - my $dir=$File::Find::dir; - $dir=~s/^\Q$tmp\E//; - my $target = readlink($_); - if ($target=~/^\//) { - push @links, $target; - } - else { - push @links, "$dir/$target"; - } - push @links, "$dir/$_"; - doit("rm","-f",$_); - - }, - $tmp); - } - - while (@links) { - my $dest=pop @links; - my $src=pop @links; - - # Relavatize src and dest. - $src=~s:^/::; - $dest=~s:^/::; - - # Make sure the directory the link will be in exists. - my $basedir=dirname("$tmp/$dest"); - if (! -e $basedir) { - doit("install","-d",$basedir); - } - - # Policy says that if the link is all within one toplevel - # directory, it should be relative. If it's between - # top level directories, leave it absolute. - my @src_dirs=split(m:/+:,$src); - my @dest_dirs=split(m:/+:,$dest); - if ($src_dirs[0] eq $dest_dirs[0]) { - # Figure out how much of a path $src and $dest - # share in common. - my $x; - for ($x=0; $x<$#src_dirs && $src_dirs[$x] eq $dest_dirs[$x]; $x++) {} - # Build up the new src. - $src=""; - for (1..$#dest_dirs - $x) { - $src.="../"; - } - for ($x .. $#src_dirs) { - $src.=$src_dirs[$_]."/"; - } - $src=~s:/$::; - } - else { - # Make sure it's properly absolute. - $src="/$src"; - } - - doit("ln","-sf",$src,"$tmp/$dest"); - } -} - -=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_listpackages b/dh_listpackages deleted file mode 100755 index f919ef62..00000000 --- a/dh_listpackages +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_listpackages - list binary packages debhelper will act on - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_listpackages> [S<I<debhelper options>>] - -=head1 DESCRIPTION - -dh_listpackages is a debhelper program that outputs a list of all binary -packages debhelper commands will act on. If you pass it some options, it -will change the list to match the packages other debhelper commands would -act on if passed the same options. - -=cut - -init(); -print join("\n",@{$dh{DOPACKAGES}})."\n"; - -=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_md5sums b/dh_md5sums deleted file mode 100755 index 6f794e7f..00000000 --- a/dh_md5sums +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_md5sums - generate DEBIAN/md5sums file - -=cut - -use strict; -use Cwd; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_md5sums> [S<I<debhelper options>>] [B<-x>] [B<-X>I<item>] [B<--include-conffiles>] - -=head1 DESCRIPTION - -dh_md5sums is a debhelper program that is responsible for generating -a DEBIAN/md5sums file, which lists the md5sums of each file in the package. -These files are used by the debsums package. - -All files in DEBIAN/ are omitted from the md5sums file, as are all -conffiles (unless you use the --include-conffiles switch). - -The md5sums file is installed with proper permissions and ownerships. - -=head1 OPTIONS - -=over 4 - -=item B<-x>, B<--include-conffiles> - -Include conffiles in the md5sums list. Note that this information is -redundant since it is included elsewhere in debian packages. - -=item B<-X>I<item>, B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from -being listed in the md5sums file. - -=back - -=cut - -init(); - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - - if (! -d "$tmp/DEBIAN") { - doit("install","-d","$tmp/DEBIAN"); - } - - # Check if we should exclude conffiles. - my $exclude=""; - if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") { - # Generate exclude regexp. - open (CONFF,"$tmp/DEBIAN/conffiles"); - while (<CONFF>) { - chomp; - s/^\///; - $exclude.="! -path \"$_\" "; - } - close CONFF; - } - - # See if we should exclude other files. - if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { - $exclude.="! \\( $dh{EXCLUDE_FIND} \\) "; - } - - my $olddir=getcwd(); - complex_doit("cd $tmp >/dev/null ; find . -type f $exclude ! -regex '.*/DEBIAN/.*' -printf '%P\\0' | xargs -r0 md5sum > DEBIAN/md5sums ; cd '$olddir' >/dev/null"); - # If the file's empty, no reason to waste inodes on it. - if (-z "$tmp/DEBIAN/md5sums") { - doit("rm","-f","$tmp/DEBIAN/md5sums"); - } - else { - doit("chmod",644,"$tmp/DEBIAN/md5sums"); - doit("chown","0.0","$tmp/DEBIAN/md5sums"); - } -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut @@ -1,72 +1,21 @@ #!/usr/bin/perl -w +# +# Find dependencies on perl stuff +# Remove .packlist files -=head1 NAME - -dh_perl - calculates perl dependencies - -=cut - -use strict; -use Config; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_perl> [S<I<debhelper options>>] [B<-d>] [S<I<library dirs ...>>] - -=head1 DESCRIPTION - -dh_perl is a debhelper program that is responsible for generating -the ${perl:Depends} substitutions and adding them to substvars files. - -The program will look at perl scripts and modules in your package, -and will use this information to generate a dependency on perl or -perlapi. The dependency will be substituted into your package's control -file wherever you place the token "${perl:Depends}". - -=head1 OPTIONS - -=over 4 - -=item B<-d> - -In some specific cases you may want to depend on perl-base rather than the -full perl package. If so, you can pass the -d option to make dh_perl generate -a dependency on the correct base package. This is only necessary for some -packages that are included in the base system. - -=item B<-V> - -By default, scripts and architecture independent modules don't depend -on any specific version of perl. The -V option causes the current -version of the perl (or perl-base with -d) package to be specified. - -=item I<library dirs> - -If your package installs perl modules in non-standard -directories, you can make dh_perl check those directories by passing their -names on the command line. It will only check the vendorlib and vendorarch -directories by default. - -=back - -=head1 CONFORMS TO - -Debian policy, version 3.0.1 - -Perl policy, version 1.18 - -=cut - +BEGIN { push @INC, "debian", "/usr/share/debhelper" } +use Dh_Lib; init(); -my $vendorlib = substr $Config{vendorlib}, 1; -my $vendorarch = substr $Config{vendorarch}, 1; +my $ext = ''; +my $lib_dir = 'usr/lib/perl5'; -# the installation dir for arch-indep modules changed to -# /usr/share/perl5 in this version: -my $min_version = '5.6.0-16'; +# Figure out the version of perl. If $ENV{PERL} is set, query the perl binary +# it points to, otherwise query perl directly. +my $version=sprintf("%.3f", $]); +if (defined $ENV{PERL}) { + $version=`$ENV{PERL} -e 'printf "%.3f", \$]'`; +} # Cleaning the paths given on the command line foreach (@ARGV) { @@ -74,74 +23,136 @@ foreach (@ARGV) { s#^/##; } -my $perl = 'perl'; -# If -d is given, then the dependency is on perl-base rather than perl. -$perl .= '-base' if $dh{D_FLAG}; -my $version; +# If -d is given, then we'll try to depend on one of the perl-5.00X-base +# package instead of perl-5.00X +$ext='-base' if ($dh{'D_FLAG'}); -# dependency types -use constant PROGRAM => 1; -use constant PM_MODULE => 2; -use constant XS_MODULE => 4; +foreach $PACKAGE (@{$dh{DOPACKAGES}}) { + $TMP=tmpdir($PACKAGE); + $EXT=pkgext($PACKAGE); -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp = tmpdir($package); - my $ext = pkgext($package); + my ($file, $v, $arch); + my $dep_arch = ''; + my $dep = ''; + my $found = 0; - delsubstvar($package, "perl:Depends"); # for idempotency - # Check also for alternate locations given on the command line - my @dirs = grep -d, map "$tmp/$_", $vendorlib, $vendorarch, @ARGV; + my $dirs = ''; + foreach ($lib_dir, @ARGV) { + $dirs .= "$TMP/$_ " if (-d "$TMP/$_"); + } + my $re = '(?:' . join('|', ($lib_dir, @ARGV)) . ')'; # Look for perl modules and check where they are installed - my $deps = 0; - find sub { - return unless -f; - $deps |= PM_MODULE if /\.pm$/; - $deps |= XS_MODULE if /\.so$/; - }, @dirs if @dirs; - - # find scripts - find sub { - return unless -f and (-x or /\.pl$/); - local *F; - return unless open F, $_; - if (read F, local $_, 32 and m%^#!\s*(/usr/bin/perl|/usr/bin/env\s+perl)\s%) { - $deps |= PROGRAM; + if ($dirs) { + foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) { + $found++; + if ($file =~ m<^$TMP/$re/(\d\.\d{3})/([^/]+)/>) { + $v = $1; + $arch = $2; + check_module_version ($v, $version); + $v .= '-thread' if ($arch =~ /-thread/); + $dep_arch = add_deps ($dep_arch, "perl-$v"); + } elsif ($file =~ m<^$TMP/$re/(\d.\d{3})/>) { + $v = $1; + check_module_version ($v, $version); + $dep_arch = add_deps ($dep_arch, "perl-$v"); } - close F; - }, $tmp; - - if ($deps) { - my $version=""; - if ($deps & XS_MODULE or $dh{V_FLAG_SET}) { - ($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m - unless $version; - $version = ">= $version"; + } + } + + if ($found and not $dep_arch) { + $dep = "perl5$ext"; + } elsif ($dep_arch) { + $dep = $dep_arch; + } + + # Look for perl scripts + my ($ff, $newdep); + foreach $file (split(/\n/,`find $TMP -type f \\( -name "*.pl" -or -perm +111 \\)`)) { + $ff=`file -b $file`; + if ($ff =~ /perl/) { + $newdep = dep_from_script ($file); + $dep = add_deps ($dep, $newdep) if $newdep; } - elsif ($deps & PM_MODULE) { - $version = ">= $min_version"; + } + + # Remove .packlist files and eventually some empty directories + if (not $dh{'K_FLAG'}) { + foreach $file (split(/\n/,`find $TMP -type f -name .packlist`)) + { + unlink($file); + # Get the directory name + while ($file =~ s#/[^/]+$##){ + last if (not -d $file); + last if (not rmdir $file); + } } - - # no need to depend on an un-versioned perl-base -- it's - # essential - addsubstvar($package, "perl:Depends", $perl, $version) - unless $perl eq 'perl-base' && ! length($version); - - # add perlapi-<ver> for XS modules - addsubstvar($package, "perl:Depends", "perlapi-$Config{version}") - if $deps & XS_MODULE; } -} -=head1 SEE ALSO + next unless $dep; -L<debhelper(7)> + if (-e "debian/$EXT\substvars") { + open (IN, "<debian/$EXT\substvars"); + my @lines=grep { ! /^perl:Depends=/ } <IN>; + close IN; + open (OUT, ">debian/$EXT\substvars"); + print OUT @lines; + } else { + open (OUT, ">debian/$EXT\substvars"); + } + print OUT "perl:Depends=$dep\n"; + close OUT; +} -This program is a part of debhelper. +sub add_deps { + my ($dep, $new) = @_; + + # If the $new-base package can exist then add $ext to $new + $new = "$new$ext" if ($new =~ m/^(?:perl5|perl-\d\.\d{3})$/); + + # If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)? + # is not already in the dependencies + if ($new eq "perl5") { + return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}(\s|,|$)/); + } elsif ($new eq "perl5-thread") { + return $dep if ($dep =~ m/(^|\s)perl-5\.\d{3}-thread(\s|,|$)/); + } + + if (not $dep) { + $dep = $new; + } else { + $dep .= ", $new" unless ($dep =~ m/(^|\s)$new(\s|,|$)/); + } -=head1 AUTHOR + return $dep; +} -Brendan O'Dea <bod@debian.org> +sub check_module_version { + my ($v1, $v2) = @_; + unless ($v1 eq $v2) { + warning("A module has been found in perl-$v1 arch directory. But perl-$v2 is the perl currently used ...\n"); + } +} -=cut +sub dep_from_script { + my $file = shift; + my ($line, $perl, $dep); + open (SCRIPT, "<$file") || die "Can't open $file: $!\n"; + $line = <SCRIPT>; + close (SCRIPT); + if ($line =~ m<^#!\s*/usr/bin/(perl\S*)(?:\s+|$)>) { + $perl = $1; + if ($perl eq "perl") { + $dep = "perl5"; + } elsif ($perl eq "perl-thread") { + $dep = "perl5-thread"; + } elsif ($perl =~ m/^perl-\d\.\d{3}(?:-thread)?$/) { + $dep = $perl; + } elsif ($perl =~ m/^perl(\d\.\d{3})(\d\d)$/) { + # Should never happen but ... + $dep = "perl-$1 (=$1.$2)"; + } + } + return $dep; +} diff --git a/dh_strip b/dh_strip deleted file mode 100755 index 9e107f46..00000000 --- a/dh_strip +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_strip - strip executables, shared libraries, and some static libraries - -=cut - -use strict; -use File::Find; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_strip> [S<I<debhelper options>>] [B<-X>I<item>] - -=head1 DESCRIPTION - -dh_strip is a debhelper program that is responsible for stripping -executables, shared libraries, and static libraries that are not used for -debugging. - -This program examines your package build directories and works out what -to strip on its own. It uses L<file(1)> and file permisions and filenames -to figure out what files are shared libraries (*.so), executable binaries, -and static (lib*.a) and debugging libraries (lib*_g.a, debug/*.so), and -strips each as much as is possible. (Which is not at all for debugging -libraries.) In general it seems to make very good guesses, and will do the -right thing in almost all cases. - -Since it is very hard to automatically guess if a file is a -module, and hard to determine how to strip a module, dh_strip does not -currently deal with stripping binary modules such as .o files. - -=head1 OPTIONS - -=over 4 - -=item B<-X>I<item>, B<--exclude=>I<item> - -Exclude files that contain "item" anywhere in their filename from being -stripped. You may use this option multiple times to build up a list of -things to exclude. - -=back - -=head1 NOTES - -If the DEB_BUILD_OPTIONS environment variable contains "nostrip", nothing -will be stripped, in accordance with Debian policy. - -=head1 CONFORMS TO - -Debian policy, version 3.0.1 - -=cut - -init(); - -# This variable can be used to turn off stripping (see Policy). -if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nostrip/) { - exit; -} - -# I could just use `file $_[0]`, but this is safer -sub get_file_type { - my $file=shift; - open (FILE, '-|') # handle all filenames safely - || exec('file', $file) - || die "can't exec file: $!"; - my $type=<FILE>; - close FILE; - return $type; -} - -# Check if a file is an elf binary, shared library, or static library, -# for use by File::Find. It'll fill the following 3 arrays with anything -# it finds: -my (@shared_libs, @executables, @static_libs); -sub testfile { - return if -l $_ or -d $_; # Skip directories and symlinks always. - - # See if we were asked to exclude this file. - # Note that we have to test on the full filename, including directory. - my $fn="$File::Find::dir/$_"; - foreach my $f (@{$dh{EXCLUDE}}) { - return if ($fn=~m/\Q$f\E/); - } - - # Is it a debug library in a debug subdir? - return if $fn=~m/debug\/.*\.so/; - - # Does its filename look like a shared library? - if (m/.*\.so.*?/) { - # Ok, do the expensive test. - my $type=get_file_type($_); - if ($type=~m/.*ELF.*shared.*/) { - push @shared_libs, $fn; - return; - } - } - - # Is it executable? -x isn't good enough, so we need to use stat. - my (undef,undef,$mode,undef)=stat(_); - if ($mode & 0111) { - # Ok, expensive test. - my $type=get_file_type($_); - if ($type=~m/.*ELF.*(executable|shared).*/) { - push @executables, $fn; - return; - } - } - - # Is it a static library, and not a debug library? - if (m/lib.*\.a$/ && ! m/.*_g\.a$/) { - push @static_libs, $fn; - return; - } -} - -foreach my $package (@{$dh{DOPACKAGES}}) { - my $tmp=tmpdir($package); - - @shared_libs=@executables=@static_libs=(); - find(\&testfile,$tmp); - - foreach (@shared_libs) { - # Note that all calls to strip on shared libs - # *must* inclde the --strip-unneeded. - doit("strip","--remove-section=.comment", - "--remove-section=.note","--strip-unneeded",$_); - } - - foreach (@executables) { - doit("strip","--remove-section=.comment", - "--remove-section=.note",$_); - } - - foreach (@static_libs) { - doit("strip","--strip-debug",$_); - } -} - -=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_testdir b/dh_testdir deleted file mode 100755 index 451b9aeb..00000000 --- a/dh_testdir +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_testdir - test directory before building debian package - -=cut - -use strict; -use Debian::Debhelper::Dh_Lib; - -=head1 SYNOPSIS - -B<dh_testdir> [S<I<debhelper options>>] [S<I<file ...>>] - -=head1 DESCRIPTION - -dh_testdir tries to make sure that you are in the correct directory when -building a debian package. It makes sure that the file debian/control -exists, as well as any other files you specify. If not, -it exits with an error. - -=head1 OPTIONS - -=over 4 - -=item I<file ...> - -Test for the existence of these files too. - -=back - -=cut - -init(); - -foreach my $file ('debian/control', @ARGV) { - if (! -e $file) { - error("\"$file\" not found. Are you sure you are in the correct directory?"); - } -} - -=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_testversion b/dh_testversion deleted file mode 100755 index a17f22e9..00000000 --- a/dh_testversion +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME - -dh_testversion - ensure that the correct version of debhelper is installed - -=cut - -use Debian::Debhelper::Dh_Lib; -use Debian::Debhelper::Dh_Version; # contains the version number of debhelper. - -=head1 SYNOPSIS - -B<dh_testversion> [S<I<debhelper options>>] [I<operator>] [I<version>] - -=head1 DESCRIPTION - -Note: This program is deprecated. You should use build dependencies -instead. - -dh_testversion compares the version of debhelper against the version you -specify, and if the condition is not met, exits with an error message. - -You can use this in your debian/rules files if a new debhelper feature is -introduced, and your package requires that feature to build correctly. Use -debhelper's changelog to figure out the version you need. - -Be sure not to overuse dh_testversion. If debhelper version 9.5 -introduces a new dh_autofixbugs command, and your package uses it, then if -someone tries to build it with debhelper 1.0, the build will fail anyway when -dh_autofixbugs cannot be found, so there is no need for you to use -dh_testversion. - -=head1 OPTIONS - -=over 4 - -=item I<operator> - -Optional comparison operator used in comparing the versions. If not -specified, ">=" is used. For descriptions of the comparison operators, see -dpkg --help. - -=item I<version> - -Version number to compare against the current version of debhelper. If not -specified, dh_testversion does nothing. - -=back - -=cut - -init(); - -my($compare, $ver); - -if ($#ARGV > 0) { - $compare=shift; - $ver=shift; -} -elsif ($#ARGV eq 0) { - $compare=">="; - $ver=shift; -} - -warning("This program is deprecated, you should use build dependencies instead."); - -if (defined $compare and defined $ver) { - warning("Something like: \"Build-Depends: debhelper ($compare $ver)\""); - system('dpkg','--compare-versions',$Debian::Debhelper::Dh_Version::version,$compare,$ver) == 0 || - error("debhelper version $Debian::Debhelper::Dh_Version::version is installed, but a version $compare $ver is needed to build this package."); -} - -=head1 SEE ALSO - -L<debhelper(7)> - -This program is a part of debhelper. - -=head1 AUTHOR - -Joey Hess <joeyh@debian.org> - -=cut @@ -1,16 +1,20 @@ #!/usr/bin/perl use Test; -plan(tests => 3); +plan(tests => 4); # It used to not make absolute links in this situation, and it should. # #37774 system("./dh_link","etc/foo","usr/lib/bar"); -ok("/etc/foo",readlink("debian/tmp/usr/lib/bar")); +ok("/etc/foo",readlink("debian/debhelper/usr/lib/bar")); # let's make sure it makes simple relative links ok. system("./dh_link","usr/bin/foo","usr/bin/bar"); -ok("foo",readlink("debian/tmp/usr/bin/bar")); +ok("foo",readlink("debian/debhelper/usr/bin/bar")); # ok, more complex relative links. system("./dh_link","usr/lib/1","usr/bin/2"); -ok("../lib/1",readlink("debian/tmp/usr/bin/2")); +ok("../lib/1",readlink("debian/debhelper/usr/bin/2")); + +# this was bug #40159. Absolute links passes to dh_link. +system("./dh_link","/etc/X11/dfm/system.dfmext","usr/share/dfm/dfmext"); +ok("/etc/X11/dfm/system.dfmext",readlink("debian/debhelper/usr/share/dfm/dfmext")); |