diff options
author | joey <joey> | 2001-02-09 01:38:37 +0000 |
---|---|---|
committer | joey <joey> | 2001-02-09 01:38:37 +0000 |
commit | e446e8308e654785721d8036a1d53633207053f0 (patch) | |
tree | b94df61d32eb482c3c1bc5a016d96e625e12dca6 | |
parent | 053f6f8b4e7431d32511aef209188a084e8c7e79 (diff) | |
download | debhelper-e446e8308e654785721d8036a1d53633207053f0.tar.gz |
r421: use strict
-rwxr-xr-x | dh_clean | 2 | ||||
-rwxr-xr-x | dh_installmanpages | 27 | ||||
-rwxr-xr-x | dh_perl | 35 | ||||
-rwxr-xr-x | dh_shlibdeps | 17 | ||||
-rwxr-xr-x | dh_strip | 15 | ||||
-rwxr-xr-x | dh_suidregister | 15 | ||||
-rwxr-xr-x | dh_testdir | 3 | ||||
-rwxr-xr-x | dh_testroot | 1 | ||||
-rwxr-xr-x | dh_undocumented | 22 |
9 files changed, 72 insertions, 65 deletions
@@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Clean up $TMP and other tepmorary files generated by the +# Clean up $tmp and other tepmorary files generated by the # build process. use strict; diff --git a/dh_installmanpages b/dh_installmanpages index 81e072e7..5d4b3e30 100755 --- a/dh_installmanpages +++ b/dh_installmanpages @@ -6,6 +6,7 @@ # # This is a little bit (hah!) DWIMish, but still very handy. +use strict; use File::Find; use Debian::Debhelper::Dh_Lib; init(); @@ -26,7 +27,7 @@ sub find_man { if ($File::Find::dir=~m:debian/.*tmp.*:) { return; } - foreach $dir (@allpackages) { + foreach my $dir (@allpackages) { if ($File::Find::dir=~m:debian/\Q$dir\E:) { return; } @@ -72,25 +73,25 @@ sub find_so_man { } } -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); # Find all filenames that look like man pages. @manpages=(); @allpackages=GetPackages(''); find(\&find_man,'.'); # populates @manpages - foreach $page (@manpages) { + foreach my $page (@manpages) { $page=~s:^\./::; # just for looks - $basename=Debian::Debhelper::Dh_Lib::basename($page); + my $basename=basename($page); # Skip all files listed on command line. my $install=1; - foreach $skip (@ARGV) { + foreach my $skip (@ARGV) { # Look at basename of what's on connect line # for backwards compatability. - if ($basename eq Debian::Debhelper::Dh_Lib::basename($skip)) { + if ($basename eq basename($skip)) { $install=undef; last; } @@ -105,13 +106,13 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { my ($section)=$basename=~m/.*\.([1-9])/; - my $destdir="$TMP/usr/$extdir/man/man$section/"; + my $destdir="$tmp/usr/$extdir/man/man$section/"; # Handle translated man pages. my $instname=$basename; my ($langcode)=$basename=~m/.*\.([a-z][a-z])\.([1-9])/; if (defined $langcode && $langcode ne '') { - $destdir="$TMP/usr/$extdir/man/$langcode/man$section/"; + $destdir="$tmp/usr/$extdir/man/$langcode/man$section/"; $instname=~s/\.$langcode\./\./; } @@ -128,12 +129,12 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { # Now the .so conversion. @sofiles=@sodests=(); - foreach $dir (qw{usr/share/man usr/X11R6/man}) { - if (-e "$TMP/$dir") { - find(\&find_so_man, "$TMP/$dir"); + foreach my $dir (qw{usr/share/man usr/X11R6/man}) { + if (-e "$tmp/$dir") { + find(\&find_so_man, "$tmp/$dir"); } } - foreach $sofile (@sofiles) { + foreach my $sofile (@sofiles) { my $sodest=shift(@sodests); doit "rm","-f",$sofile; doit "ln","-sf",$sodest,$sofile; @@ -3,10 +3,11 @@ # Find dependencies on perl stuff # Remove .packlist files +use strict; use Debian::Debhelper::Dh_Lib; init(); -my $ext = ''; +my $perlext = ''; my $lib_dir = 'usr/lib/perl5'; # Figure out the version of perl. If $ENV{PERL} is set, query the perl binary @@ -30,11 +31,11 @@ foreach (@ARGV) { # 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'}); +$perlext='-base' if ($dh{'D_FLAG'}); -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 = ''; @@ -44,7 +45,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { # Check also for alternate locations given on the command line my $dirs = ''; foreach ($lib_dir, @ARGV) { - $dirs .= "$TMP/$_ " if (-d "$TMP/$_"); + $dirs .= "$tmp/$_ " if (-d "$tmp/$_"); } my $re = '(?:' . join('|', ($lib_dir, @ARGV)) . ')'; @@ -52,13 +53,13 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { if ($dirs) { foreach $file (split(/\n/,`find $dirs -type f \\( -name "*.pm" -or -name "*.so" \\)`)) { $found++; - if ($file =~ m<^$TMP/$re/(\d\.\d+)/([^/]+)/>) { + if ($file =~ m<^$tmp/$re/(\d\.\d+)/([^/]+)/>) { $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+)/>) { + } elsif ($file =~ m<^$tmp/$re/(\d.\d+)/>) { $v = $1; check_module_version ($v, $version); $dep_arch = add_deps ($dep_arch, "perl-$v"); @@ -67,14 +68,14 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { } if ($found and not $dep_arch) { - $dep = "perl5$ext"; + $dep = "perl5$perlext"; } 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 \\)`)) { + 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); @@ -84,7 +85,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { # Remove .packlist files and eventually some empty directories if (not $dh{'K_FLAG'}) { - foreach $file (split(/\n/,`find $TMP -type f -name .packlist`)) + foreach $file (split(/\n/,`find $tmp -type f -name .packlist`)) { unlink($file); # Get the directory name @@ -97,14 +98,14 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { next unless $dep; - if (-e "debian/${EXT}substvars") { - open (IN, "<debian/${EXT}substvars"); + if (-e "debian/${ext}substvars") { + open (IN, "<debian/${ext}substvars"); my @lines=grep { ! /^perl:Depends=/ } <IN>; close IN; - open (OUT, ">debian/${EXT}substvars"); + open (OUT, ">debian/${ext}substvars"); print OUT @lines; } else { - open (OUT, ">debian/${EXT}substvars"); + open (OUT, ">debian/${ext}substvars"); } print OUT "perl:Depends=$dep\n"; close OUT; @@ -113,8 +114,8 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { 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+)$/); + # If the $new-base package can exist then add $perlext to $new + $new = "$new$perlext" if ($new =~ m/^(?:perl5|perl-\d\.\d+)$/); # If $new = perl5 or perl5-thread check if perl-X.XXX(-thread)? # is not already in the dependencies diff --git a/dh_shlibdeps b/dh_shlibdeps index a0666b93..93f9bd07 100755 --- a/dh_shlibdeps +++ b/dh_shlibdeps @@ -2,26 +2,25 @@ # # Find dependancies. Simple dpkg-shlibdeps wrapper. +use strict; use Cwd; use Debian::Debhelper::Dh_Lib; init(); -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); - $EXT=pkgext($PACKAGE); +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $ext=pkgext($package); my @filelist; my $ff; # Generate a list of ELF binaries in the package, ignoring any # we were told to exclude. - if (! defined($dh{EXCLUDE_FIND}) || $dh{EXCLUDE_FIND} eq '') { - $find_options=""; - } - else { + my $find_options=''; + if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { $find_options="! \\( $dh{EXCLUDE_FIND} \\)"; } - foreach $file (split(/\n/,`find $TMP -type f \\( -perm +111 -or -name "*.so*" \\) $find_options`)) { + foreach my $file (split(/\n/,`find $tmp -type f \\( -perm +111 -or -name "*.so*" \\) $find_options`)) { # TODO: this is slow, optimize. Ie, file can run once on multiple files.. $ff=`file "$file"`; if ($ff=~m/ELF/ && $ff!~/statically linked/) { @@ -38,6 +37,6 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { $ENV{'LD_LIBRARY_PATH'}=$dh{L_PARAMS}; verbose_print("LD_LIBRARY_PATH=$dh{L_PARAMS} \\"); } - doit("dpkg-shlibdeps","-Tdebian/${EXT}substvars",@{$dh{U_PARAMS}},'-dDepends',@filelist); + doit("dpkg-shlibdeps","-Tdebian/${ext}substvars",@{$dh{U_PARAMS}},'-dDepends',@filelist); } } @@ -2,6 +2,7 @@ # # Strip files. +use strict; use File::Find; use Debian::Debhelper::Dh_Lib; init(); @@ -20,8 +21,8 @@ sub testfile { # See if we were asked to exclude this file. # Note that we have to test on the full filename, including directory. - $fn="$File::Find::dir/$_"; - foreach $f (@{$dh{EXCLUDE}}) { + my $fn="$File::Find::dir/$_"; + foreach my $f (@{$dh{EXCLUDE}}) { return if ($fn=~m/\Q$f\E/); } @@ -36,7 +37,7 @@ sub testfile { } # Is it executable? -x isn't good enough, so we need to use stat. - (undef,undef,$mode,undef)=stat(_); + my (undef,undef,$mode,undef)=stat(_); if ($mode & 0111) { # Ok, expensive test. my $type=`file $_`; @@ -53,11 +54,11 @@ sub testfile { } } -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); - @shared_libs=@executables=@static_libs=(); - find(\&testfile,$TMP); + my (@shared_libs, @executables, @static_libs); + find(\&testfile,$tmp); foreach (@shared_libs) { # Note that all calls to strip on shared libs diff --git a/dh_suidregister b/dh_suidregister index 6a1efafa..9e30bf39 100755 --- a/dh_suidregister +++ b/dh_suidregister @@ -2,31 +2,32 @@ # # Obsolete. +use strict; use Debian::Debhelper::Dh_Lib; init(); my $notused=1; -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); - $suid=pkgfile($PACKAGE,"suid"); +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $suid=pkgfile($package,"suid"); # All this code is here just to see if we would have done something # before.. - @files=(); + my @files; if ($suid) { - @files=filearray($suid, $TMP); + @files=filearray($suid, $tmp); } - if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @files, @ARGV; } if (! @files && ! $suid) { # No files specified (and no empty debian/suid file), so # guess what files to process. - @files=split(/\n/,`find $TMP -type f -perm +6000`); + @files=split(/\n/,`find $tmp -type f -perm +6000`); } if (@files) { @@ -4,10 +4,11 @@ # Tests for the existance of debian/control, and for the existance # of any other files you specify on the command line. +use strict; use Debian::Debhelper::Dh_Lib; init(); -foreach $file ('debian/control', @ARGV) { +foreach my $file ('debian/control', @ARGV) { if (! -e $file) { error("\"$file\" not found. Are you sure you are in the correct directory?"); } diff --git a/dh_testroot b/dh_testroot index 0d1e2bda..9192f853 100755 --- a/dh_testroot +++ b/dh_testroot @@ -2,6 +2,7 @@ # # Checks to make sure you are root. +use strict; use Debian::Debhelper::Dh_Lib; if ($< != 0) { diff --git a/dh_undocumented b/dh_undocumented index 93328ad0..7de53445 100755 --- a/dh_undocumented +++ b/dh_undocumented @@ -6,29 +6,31 @@ # Also, it looks for debian/undocumented files for more lists of # undocumented man pages. +use strict; use Debian::Debhelper::Dh_Lib; init(); -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); - $undocumented=pkgfile($PACKAGE,"undocumented"); +foreach my $package (@{$dh{DOPACKAGES}}) { + my $tmp=tmpdir($package); + my $undocumented=pkgfile($package,"undocumented"); - @undoc=(); + my @undoc; if ($undocumented) { @undoc=filearray($undocumented); } - if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { + if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) { push @undoc, @ARGV; } - foreach $file (@undoc) { + foreach my $file (@undoc) { $file=~s/.gz$//; # .gz extension is optional in input. # Determine what directory the file belongs in, # /usr/share/man, or /usr/X11R6/man, and how the link to # the undocuemtned.7 man page will look. - ($section)=$file=~m/^.*\.(\d)/; + my ($dir, $reldir); + my ($section)=$file=~m/^.*\.(\d)/; if (!$section) { error("\"$file\" does not have an extension."); } @@ -45,9 +47,9 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { $reldir=""; } - if (! -d "$TMP/$dir") { - doit("install","-d","$TMP/$dir"); + if (! -d "$tmp/$dir") { + doit("install","-d","$tmp/$dir"); } - doit("ln","-sf","${reldir}undocumented.7.gz","$TMP/$dir/$file.gz"); + doit("ln","-sf","${reldir}undocumented.7.gz","$tmp/$dir/$file.gz"); } } |