diff options
Diffstat (limited to 'scripts/Dpkg')
-rw-r--r-- | scripts/Dpkg/Control/HashCore.pm | 3 | ||||
-rw-r--r-- | scripts/Dpkg/Package.pm | 9 | ||||
-rw-r--r-- | scripts/Dpkg/Shlibs/SymbolFile.pm | 6 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V1.pm | 6 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/Bzr.pm | 2 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/Git.pm | 10 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Patch.pm | 14 | ||||
-rw-r--r-- | scripts/Dpkg/Substvars.pm | 6 | ||||
-rw-r--r-- | scripts/Dpkg/Vars.pm | 9 |
9 files changed, 41 insertions, 24 deletions
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index 009eb1012..2cb47d8e1 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/scripts/Dpkg/Control/HashCore.pm @@ -224,9 +224,10 @@ sub parse { if ($expect_pgp_sig) { # Skip empty lines $_ = <$fh> while defined($_) && $_ =~ /^\s*$/; - length($_) || + unless (length $_) { $self->parse_error($desc, _g('expected PGP signature, ' . 'found EOF after blank line')); + } s/\s*\n$//; unless (m/^-----BEGIN PGP SIGNATURE-----$/) { $self->parse_error($desc, _g('expected PGP signature, ' . diff --git a/scripts/Dpkg/Package.pm b/scripts/Dpkg/Package.pm index 2a4b439b6..674a7e94f 100644 --- a/scripts/Dpkg/Package.pm +++ b/scripts/Dpkg/Package.pm @@ -29,12 +29,15 @@ our @EXPORT = qw(pkg_name_is_illegal); sub pkg_name_is_illegal($) { my $name = shift || ''; - $name eq '' && + if ($name eq '') { return _g('may not be empty string'); - $name =~ m/[^-+.0-9a-z]/o && + } + if ($name =~ m/[^-+.0-9a-z]/o) { return sprintf(_g("character '%s' not allowed"), $&); - $name =~ m/^[0-9a-z]/o || + } + if ($name !~ m/^[0-9a-z]/o) { return _g('must start with an alphanumeric character'); + } return; } diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index d953c369d..a4fda9b1c 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -385,7 +385,11 @@ sub find_matching_pattern { # machinery sub merge_symbols { my ($self, $object, $minver) = @_; - my $soname = $object->{SONAME} || error(_g('cannot merge symbols from objects without SONAME')); + + my $soname = $object->{SONAME}; + error(_g('cannot merge symbols from objects without SONAME')) + unless $soname; + my %dynsyms; foreach my $sym ($object->get_exported_dynamic_symbols()) { my $name = $sym->{name} . '@' . diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index f63d987ef..7bb548c7b 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -81,9 +81,10 @@ sub do_extract { my $fields = $self->{fields}; $sourcestyle =~ y/X/p/; - $sourcestyle =~ m/[pun]/ || + unless ($sourcestyle =~ m/[pun]/) { usageerr(_g('source handling style -s%s not allowed with -x'), $sourcestyle); + } my $dscdir = $self->{basedir}; @@ -236,10 +237,11 @@ sub do_build { } } else { $sourcestyle =~ y/aA/nn/; - $sourcestyle =~ m/n/ || + unless ($sourcestyle =~ m/n/) { error(_g('orig argument is empty (means no orig, no diff) ' . 'but source handling style -s%s wants something'), $sourcestyle); + } } } elsif ($sourcestyle =~ m/[aA]/) { # We have no explicit <orig-dir> or <orig-targz>, try to use diff --git a/scripts/Dpkg/Source/Package/V3/Bzr.pm b/scripts/Dpkg/Source/Package/V3/Bzr.pm index 86ca1826d..725ed6ffd 100644 --- a/scripts/Dpkg/Source/Package/V3/Bzr.pm +++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm @@ -141,7 +141,7 @@ sub do_build { my $tardir = "$tmp/$dirname"; system('bzr', 'branch', $dir, $tardir); - $? && subprocerr("bzr branch $dir $tardir"); + subprocerr("bzr branch $dir $tardir") if $?; # Remove the working tree. system('bzr', 'remove-tree', $tardir); diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm index 3ac6384d4..2ca079556 100644 --- a/scripts/Dpkg/Source/Package/V3/Git.pm +++ b/scripts/Dpkg/Source/Package/V3/Git.pm @@ -152,12 +152,12 @@ sub do_build { $self->{options}{git_depth}); system('git', 'clone', '--depth=' . $self->{options}{git_depth}, '--quiet', '--bare', 'file://' . abs_path($dir), $clone_dir); - $? && subprocerr('git clone'); + subprocerr('git clone') if $?; chdir($clone_dir) || syserr(_g("unable to chdir to `%s'"), $clone_dir); $shallowfile = "$basenamerev.gitshallow"; system('cp', '-f', 'shallow', "$old_cwd/$shallowfile"); - $? && subprocerr('cp shallow'); + subprocerr('cp shallow') if $?; } # Create the git bundle. @@ -170,7 +170,7 @@ sub do_build { 'HEAD', # ensure HEAD is included no matter what '--', # avoids ambiguity error when referring to eg, a debian branch ); - $? && subprocerr('git bundle'); + subprocerr('git bundle') if $?; chdir($old_cwd) || syserr(_g("unable to chdir to `%s'"), $old_cwd); @@ -221,14 +221,14 @@ sub do_extract { # Extract git bundle. info(_g('cloning %s'), $bundle); system('git', 'clone', '--quiet', $dscdir . $bundle, $newdirectory); - $? && subprocerr('git bundle'); + subprocerr('git bundle') if $?; if (defined $shallow) { # Move shallow info file into place, so git does not # try to follow parents of shallow refs. info(_g('setting up shallow clone')); system('cp', '-f', $dscdir . $shallow, "$newdirectory/.git/shallow"); - $? && subprocerr('cp'); + subprocerr('cp') if $?; } sanity_check($newdirectory); diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm index 4f61ad10f..a77dd78f5 100644 --- a/scripts/Dpkg/Source/Patch.pm +++ b/scripts/Dpkg/Source/Patch.pm @@ -169,18 +169,23 @@ sub add_diff_directory { $self->_fail_not_same_type("$old/$fn", "$new/$fn"); return; } - defined(my $n = readlink("$new/$fn")) || + my $n = readlink("$new/$fn"); + unless (defined $n) { syserr(_g('cannot read link %s'), "$new/$fn"); - defined(my $n2 = readlink("$old/$fn")) || + } + my $n2 = readlink("$old/$fn"); + unless (defined $n2) { syserr(_g('cannot read link %s'), "$old/$fn"); + } unless ($n eq $n2) { $self->_fail_not_same_type("$old/$fn", "$new/$fn"); } } elsif (-f _) { my $old_file = "$old/$fn"; if (not lstat("$old/$fn")) { - $! == ENOENT || + if ($! != ENOENT) { syserr(_g('cannot stat file %s'), "$old/$fn"); + } $old_file = '/dev/null'; } elsif (not -f _) { $self->_fail_not_same_type("$old/$fn", "$new/$fn"); @@ -202,8 +207,9 @@ sub add_diff_directory { _g('device or socket is not allowed')); } elsif (-d _) { if (not lstat("$old/$fn")) { - $! == ENOENT || + if ($! != ENOENT) { syserr(_g('cannot stat file %s'), "$old/$fn"); + } } elsif (not -d _) { $self->_fail_not_same_type("$old/$fn", "$new/$fn"); } diff --git a/scripts/Dpkg/Substvars.pm b/scripts/Dpkg/Substvars.pm index 9ea91f90c..8992a2fee 100644 --- a/scripts/Dpkg/Substvars.pm +++ b/scripts/Dpkg/Substvars.pm @@ -173,9 +173,10 @@ sub parse { while (<$fh>) { next if m/^\s*\#/ || !m/\S/; s/\s*\n$//; - m/^(\w[-:0-9A-Za-z]*)\=(.*)$/ || + if (! m/^(\w[-:0-9A-Za-z]*)\=(.*)$/) { error(_g('bad line in substvars file %s at line %d'), $varlistfile, $.); + } $self->{vars}{$1} = $2; } } @@ -244,9 +245,10 @@ sub substvars { # reset the recursive counter. $count = 0 if (length($3) < length($rhs)); - $count < $maxsubsts || + if ($count >= $maxsubsts) { error($opts{msg_prefix} . _g("too many substitutions - recursive ? - in \`%s'"), $v); + } $lhs = $1; $vn = $2; $rhs = $3; if (defined($self->{vars}{$vn})) { $v = $lhs . $self->{vars}{$vn} . $rhs; diff --git a/scripts/Dpkg/Vars.pm b/scripts/Dpkg/Vars.pm index 31e4d0fb4..000753270 100644 --- a/scripts/Dpkg/Vars.pm +++ b/scripts/Dpkg/Vars.pm @@ -39,12 +39,11 @@ sub set_source_package { my $err = pkg_name_is_illegal($v); error(_g("source package name '%s' is illegal: %s"), $v, $err) if $err; - if (defined($sourcepackage)) { - $v eq $sourcepackage || - error(_g('source package has two conflicting values - %s and %s'), - $sourcepackage, $v); - } else { + if (not defined($sourcepackage)) { $sourcepackage = $v; + } elsif ($v ne $sourcepackage) { + error(_g('source package has two conflicting values - %s and %s'), + $sourcepackage, $v); } } |