diff options
author | Guillem Jover <guillem@debian.org> | 2013-04-21 06:10:17 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-04-30 20:59:27 +0200 |
commit | 62bc788a45e4a641c28ca9c8c5b9bb08f29faed8 (patch) | |
tree | 440e84bf7a9a0ec56aea27cd7f5568ca581b2d46 /scripts/Dpkg/Source/Package | |
parent | d6851023a9ab87e3109fca3f2f9c6b5210575663 (diff) | |
download | dpkg-62bc788a45e4a641c28ca9c8c5b9bb08f29faed8.tar.gz |
Do not quote simple identifier hash keys in element accesses
Addresses ValuesAndExpressions::ProhibitInterpolationOfLiterals.
Warned-by: perlcritic
Diffstat (limited to 'scripts/Dpkg/Source/Package')
-rw-r--r-- | scripts/Dpkg/Source/Package/V1.pm | 56 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V2.pm | 160 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/bzr.pm | 20 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/custom.pm | 10 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/git.pm | 20 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/native.pm | 18 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/quilt.pm | 56 |
7 files changed, 170 insertions, 170 deletions
diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index f278c5c46..314ae0f16 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -44,32 +44,32 @@ sub init_options { my ($self) = @_; # Don't call $self->SUPER::init_options() on purpose, V1.0 has no # ignore by default - if ($self->{'options'}{'diff_ignore_regexp'}) { - $self->{'options'}{'diff_ignore_regexp'} .= '|(?:^|/)debian/source/local-.*$'; + if ($self->{options}{diff_ignore_regexp}) { + $self->{options}{diff_ignore_regexp} .= '|(?:^|/)debian/source/local-.*$'; } else { - $self->{'options'}{'diff_ignore_regexp'} = '(?:^|/)debian/source/local-.*$'; + $self->{options}{diff_ignore_regexp} = '(?:^|/)debian/source/local-.*$'; } - push @{$self->{'options'}{'tar_ignore'}}, "debian/source/local-options", + push @{$self->{options}{tar_ignore}}, "debian/source/local-options", "debian/source/local-patch-header"; - $self->{'options'}{'sourcestyle'} ||= 'X'; - $self->{'options'}{'skip_debianization'} ||= 0; - $self->{'options'}{'abort_on_upstream_changes'} ||= 0; + $self->{options}{sourcestyle} ||= 'X'; + $self->{options}{skip_debianization} ||= 0; + $self->{options}{abort_on_upstream_changes} ||= 0; } sub parse_cmdline_option { my ($self, $opt) = @_; - my $o = $self->{'options'}; + my $o = $self->{options}; if ($opt =~ m/^-s([akpursnAKPUR])$/) { warning(_g("-s%s option overrides earlier -s%s option"), $1, - $o->{'sourcestyle'}) if $o->{'sourcestyle'} ne 'X'; - $o->{'sourcestyle'} = $1; - $o->{'copy_orig_tarballs'} = 0 if $1 eq 'n'; # Extract option -sn + $o->{sourcestyle}) if $o->{sourcestyle} ne 'X'; + $o->{sourcestyle} = $1; + $o->{copy_orig_tarballs} = 0 if $1 eq 'n'; # Extract option -sn return 1; } elsif ($opt =~ m/^--skip-debianization$/) { - $o->{'skip_debianization'} = 1; + $o->{skip_debianization} = 1; return 1; } elsif ($opt =~ m/^--abort-on-upstream-changes$/) { - $o->{'abort_on_upstream_changes'} = 1; + $o->{abort_on_upstream_changes} = 1; return 1; } return 0; @@ -77,15 +77,15 @@ sub parse_cmdline_option { sub do_extract { my ($self, $newdirectory) = @_; - my $sourcestyle = $self->{'options'}{'sourcestyle'}; - my $fields = $self->{'fields'}; + my $sourcestyle = $self->{options}{sourcestyle}; + my $fields = $self->{fields}; $sourcestyle =~ y/X/p/; $sourcestyle =~ m/[pun]/ || usageerr(_g("source handling style -s%s not allowed with -x"), $sourcestyle); - my $dscdir = $self->{'basedir'}; + my $dscdir = $self->{basedir}; my $basename = $self->get_basename(); my $basenamerev = $self->get_basename(1); @@ -149,13 +149,13 @@ sub do_extract { } } - if ($difffile and not $self->{'options'}{'skip_debianization'}) { + if ($difffile and not $self->{options}{skip_debianization}) { my $patch = "$dscdir$difffile"; info(_g("applying %s"), $difffile); my $patch_obj = Dpkg::Source::Patch->new(filename => $patch); my $analysis = $patch_obj->apply($newdirectory, force_timestamp => 1); my @files = grep { ! m{^\Q$newdirectory\E/debian/} } - sort keys %{$analysis->{'filepatched'}}; + sort keys %{$analysis->{filepatched}}; info(_g("upstream files that have been modified: %s"), "\n " . join("\n ", @files)) if scalar @files; } @@ -165,16 +165,16 @@ sub can_build { my ($self, $dir) = @_; # As long as we can use gzip, we can do it as we have # native packages as fallback - return ($self->{'options'}{'compression'} eq "gzip", + return ($self->{options}{compression} eq "gzip", _g("only supports gzip compression")); } sub do_build { my ($self, $dir) = @_; - my $sourcestyle = $self->{'options'}{'sourcestyle'}; - my @argv = @{$self->{'options'}{'ARGV'}}; - my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}}; - my $diff_ignore_regexp = $self->{'options'}{'diff_ignore_regexp'}; + my $sourcestyle = $self->{options}{sourcestyle}; + my @argv = @{$self->{options}{ARGV}}; + my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}}; + my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp}; if (scalar(@argv) > 1) { usageerr(_g("-b takes at most a directory and an orig source ". @@ -187,7 +187,7 @@ sub do_build { $sourcestyle); } - my $sourcepackage = $self->{'fields'}{'Source'}; + my $sourcepackage = $self->{fields}{'Source'}; my $basenamerev = $self->get_basename(1); my $basename = $self->get_basename(); my $basedirname = $basename; @@ -287,7 +287,7 @@ sub do_build { } if ($sourcestyle eq "n") { - $self->{'options'}{'ARGV'} = []; # ensure we have no error + $self->{options}{ARGV} = []; # ensure we have no error Dpkg::Source::Package::V3::native::do_build($self, $dir); } elsif ($sourcestyle =~ m/[nurUR]/) { if (stat($tarname)) { @@ -306,7 +306,7 @@ sub do_build { DIR => getcwd(), UNLINK => 0); my $tar = Dpkg::Source::Archive->new(filename => $newtar, compression => compression_guess_from_filename($tarname), - compression_level => $self->{'options'}{'comp_level'}); + compression_level => $self->{options}{comp_level}); $tar->create(options => \@tar_ignore, chdir => $tardirbase); $tar->add_directory($tardirname); $tar->finish(); @@ -362,14 +362,14 @@ sub do_build { my $analysis = $diff->analyze($origdir); my @files = grep { ! m{^debian/} } map { s{^[^/]+/+}{}; $_ } - sort keys %{$analysis->{'filepatched'}}; + sort keys %{$analysis->{filepatched}}; if (scalar @files) { warning(_g("the diff modifies the following upstream files: %s"), "\n " . join("\n ", @files)); info(_g("use the '3.0 (quilt)' format to have separate and " . "documented changes to upstream files, see dpkg-source(1)")); error(_g("aborting due to --abort-on-upstream-changes")) - if $self->{'options'}{'abort_on_upstream_changes'}; + if $self->{options}{abort_on_upstream_changes}; } rename($newdiffgz, $diffname) || diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index ee9687386..4da8bdae2 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -48,60 +48,60 @@ our $CURRENT_MINOR_VERSION = "0"; sub init_options { my ($self) = @_; $self->SUPER::init_options(); - $self->{'options'}{'include_removal'} = 0 - unless exists $self->{'options'}{'include_removal'}; - $self->{'options'}{'include_timestamp'} = 0 - unless exists $self->{'options'}{'include_timestamp'}; - $self->{'options'}{'include_binaries'} = 0 - unless exists $self->{'options'}{'include_binaries'}; - $self->{'options'}{'preparation'} = 1 - unless exists $self->{'options'}{'preparation'}; - $self->{'options'}{'skip_patches'} = 0 - unless exists $self->{'options'}{'skip_patches'}; - $self->{'options'}{'unapply_patches'} = 'auto' - unless exists $self->{'options'}{'unapply_patches'}; - $self->{'options'}{'skip_debianization'} = 0 - unless exists $self->{'options'}{'skip_debianization'}; - $self->{'options'}{'create_empty_orig'} = 0 - unless exists $self->{'options'}{'create_empty_orig'}; - $self->{'options'}{'auto_commit'} = 0 - unless exists $self->{'options'}{'auto_commit'}; + $self->{options}{include_removal} = 0 + unless exists $self->{options}{include_removal}; + $self->{options}{include_timestamp} = 0 + unless exists $self->{options}{include_timestamp}; + $self->{options}{include_binaries} = 0 + unless exists $self->{options}{include_binaries}; + $self->{options}{preparation} = 1 + unless exists $self->{options}{preparation}; + $self->{options}{skip_patches} = 0 + unless exists $self->{options}{skip_patches}; + $self->{options}{unapply_patches} = 'auto' + unless exists $self->{options}{unapply_patches}; + $self->{options}{skip_debianization} = 0 + unless exists $self->{options}{skip_debianization}; + $self->{options}{create_empty_orig} = 0 + unless exists $self->{options}{create_empty_orig}; + $self->{options}{auto_commit} = 0 + unless exists $self->{options}{auto_commit}; } sub parse_cmdline_option { my ($self, $opt) = @_; if ($opt =~ /^--include-removal$/) { - $self->{'options'}{'include_removal'} = 1; + $self->{options}{include_removal} = 1; return 1; } elsif ($opt =~ /^--include-timestamp$/) { - $self->{'options'}{'include_timestamp'} = 1; + $self->{options}{include_timestamp} = 1; return 1; } elsif ($opt =~ /^--include-binaries$/) { - $self->{'options'}{'include_binaries'} = 1; + $self->{options}{include_binaries} = 1; return 1; } elsif ($opt =~ /^--no-preparation$/) { - $self->{'options'}{'preparation'} = 0; + $self->{options}{preparation} = 0; return 1; } elsif ($opt =~ /^--skip-patches$/) { - $self->{'options'}{'skip_patches'} = 1; + $self->{options}{skip_patches} = 1; return 1; } elsif ($opt =~ /^--unapply-patches$/) { - $self->{'options'}{'unapply_patches'} = 'yes'; + $self->{options}{unapply_patches} = 'yes'; return 1; } elsif ($opt =~ /^--no-unapply-patches$/) { - $self->{'options'}{'unapply_patches'} = 'no'; + $self->{options}{unapply_patches} = 'no'; return 1; } elsif ($opt =~ /^--skip-debianization$/) { - $self->{'options'}{'skip_debianization'} = 1; + $self->{options}{skip_debianization} = 1; return 1; } elsif ($opt =~ /^--create-empty-orig$/) { - $self->{'options'}{'create_empty_orig'} = 1; + $self->{options}{create_empty_orig} = 1; return 1; } elsif ($opt =~ /^--abort-on-upstream-changes$/) { - $self->{'options'}{'auto_commit'} = 0; + $self->{options}{auto_commit} = 0; return 1; } elsif ($opt =~ /^--auto-commit$/) { - $self->{'options'}{'auto_commit'} = 1; + $self->{options}{auto_commit} = 1; return 1; } return 0; @@ -109,9 +109,9 @@ sub parse_cmdline_option { sub do_extract { my ($self, $newdirectory) = @_; - my $fields = $self->{'fields'}; + my $fields = $self->{fields}; - my $dscdir = $self->{'basedir'}; + my $dscdir = $self->{basedir}; my $basename = $self->get_basename(); my $basenamerev = $self->get_basename(1); @@ -164,7 +164,7 @@ sub do_extract { } # Stop here if debianization is not wanted - return if $self->{'options'}{'skip_debianization'}; + return if $self->{options}{skip_debianization}; # Extract debian tarball after removing the debian directory info(_g("unpacking %s"), $debianfile); @@ -186,7 +186,7 @@ sub do_extract { # Apply patches (in a separate method as it might be overriden) $self->apply_patches($newdirectory, usage => 'unpack') - unless $self->{'options'}{'skip_patches'}; + unless $self->{options}{skip_patches}; } sub get_autopatch_name { @@ -195,7 +195,7 @@ sub get_autopatch_name { sub get_patches { my ($self, $dir, %opts) = @_; - $opts{"skip_auto"} //= 0; + $opts{skip_auto} //= 0; my @patches; my $pd = "$dir/debian/patches"; my $auto_patch = $self->get_autopatch_name(); @@ -204,7 +204,7 @@ sub get_patches { foreach my $patch (sort readdir($dir_dh)) { # patches match same rules as run-parts next unless $patch =~ /^[\w-]+$/ and -f "$pd/$patch"; - next if $opts{"skip_auto"} and $patch eq $auto_patch; + next if $opts{skip_auto} and $patch eq $auto_patch; push @patches, $patch; } closedir($dir_dh); @@ -214,17 +214,17 @@ sub get_patches { sub apply_patches { my ($self, $dir, %opts) = @_; - $opts{"skip_auto"} //= 0; + $opts{skip_auto} //= 0; my @patches = $self->get_patches($dir, %opts); return unless scalar(@patches); my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied"); open(my $applied_fh, '>', $applied) || syserr(_g("cannot write %s"), $applied); - print $applied_fh "# During $opts{'usage'}\n"; + print $applied_fh "# During $opts{usage}\n"; my $timestamp = fs_time($applied); foreach my $patch ($self->get_patches($dir, %opts)) { my $path = File::Spec->catfile($dir, "debian", "patches", $patch); - info(_g("applying %s"), $patch) unless $opts{"skip_auto"}; + info(_g("applying %s"), $patch) unless $opts{skip_auto}; my $patch_obj = Dpkg::Source::Patch->new(filename => $path); $patch_obj->apply($dir, force_timestamp => 1, timestamp => $timestamp, @@ -242,7 +242,7 @@ sub unapply_patches { my $timestamp = fs_time($applied); foreach my $patch (@patches) { my $path = File::Spec->catfile($dir, "debian", "patches", $patch); - info(_g("unapplying %s"), $patch) unless $opts{"quiet"}; + info(_g("unapplying %s"), $patch) unless $opts{quiet}; my $patch_obj = Dpkg::Source::Patch->new(filename => $path); $patch_obj->apply($dir, force_timestamp => 1, verbose => 0, timestamp => $timestamp, @@ -263,7 +263,7 @@ sub upstream_tarball_template { sub can_build { my ($self, $dir) = @_; return 1 if $self->find_original_tarballs(include_supplementary => 0); - return 1 if $self->{'options'}{'create_empty_orig'} and + return 1 if $self->{options}{create_empty_orig} and $self->find_original_tarballs(include_main => 0); return (0, sprintf(_g("no upstream tarball found at %s"), $self->upstream_tarball_template())); @@ -271,7 +271,7 @@ sub can_build { sub before_build { my ($self, $dir) = @_; - $self->check_patches_applied($dir) if $self->{'options'}{'preparation'}; + $self->check_patches_applied($dir) if $self->{options}{preparation}; } sub after_build { @@ -284,7 +284,7 @@ sub after_build { $reason = <$applied_fh>; close($applied_fh); } - my $opt_unapply = $self->{'options'}{'unapply_patches'}; + my $opt_unapply = $self->{options}{unapply_patches}; if (($opt_unapply eq "auto" and $reason =~ /^# During preparation/) or $opt_unapply eq "yes") { $self->unapply_patches($dir); @@ -293,21 +293,21 @@ sub after_build { sub prepare_build { my ($self, $dir) = @_; - $self->{'diff_options'} = { - diff_ignore_regexp => $self->{'options'}{'diff_ignore_regexp'} . + $self->{diff_options} = { + diff_ignore_regexp => $self->{options}{diff_ignore_regexp} . '|(^|/)debian/patches/.dpkg-source-applied$', - include_removal => $self->{'options'}{'include_removal'}, - include_timestamp => $self->{'options'}{'include_timestamp'}, + include_removal => $self->{options}{include_removal}, + include_timestamp => $self->{options}{include_timestamp}, use_dev_null => 1, }; - push @{$self->{'options'}{'tar_ignore'}}, "debian/patches/.dpkg-source-applied"; - $self->check_patches_applied($dir) if $self->{'options'}{'preparation'}; - if ($self->{'options'}{'create_empty_orig'} and + push @{$self->{options}{tar_ignore}}, "debian/patches/.dpkg-source-applied"; + $self->check_patches_applied($dir) if $self->{options}{preparation}; + if ($self->{options}{create_empty_orig} and not $self->find_original_tarballs(include_supplementary => 0)) { # No main orig.tar, create a dummy one my $filename = $self->get_basename() . ".orig.tar." . - $self->{'options'}{'comp_ext'}; + $self->{options}{comp_ext}; my $tar = Dpkg::Source::Archive->new(filename => $filename); $tar->create(); $tar->finish(); @@ -351,9 +351,9 @@ sub generate_patch { error(_g("no upstream tarball found at %s"), $self->upstream_tarball_template()) unless $tarfile; - if ($opts{'usage'} eq "build") { + if ($opts{usage} eq "build") { info(_g("building %s using existing %s"), - $self->{'fields'}{'Source'}, "@origtarballs"); + $self->{fields}{'Source'}, "@origtarballs"); } # Unpack a second copy for comparison @@ -377,8 +377,8 @@ sub generate_patch { subprocerr(_g("copy of the debian directory")) if $?; # Apply all patches except the last automatic one - $opts{'skip_auto'} //= 0; - $self->apply_patches($tmp, skip_auto => $opts{'skip_auto'}, usage => 'build'); + $opts{skip_auto} //= 0; + $self->apply_patches($tmp, skip_auto => $opts{skip_auto}, usage => 'build'); # Create a patch my ($difffh, $tmpdiff) = tempfile($self->get_basename(1) . ".diff.XXXXXX", @@ -387,24 +387,24 @@ sub generate_patch { my $diff = Dpkg::Source::Patch->new(filename => $tmpdiff, compression => "none"); $diff->create(); - if ($opts{'header_from'} and -e $opts{'header_from'}) { + if ($opts{header_from} and -e $opts{header_from}) { my $header_from = Dpkg::Source::Patch->new( - filename => $opts{'header_from'}); + filename => $opts{header_from}); my $analysis = $header_from->analyze($dir, verbose => 0); - $diff->set_header($analysis->{'patchheader'}); + $diff->set_header($analysis->{patchheader}); } else { $diff->set_header($self->get_patch_header($dir)); } $diff->add_diff_directory($tmp, $dir, basedirname => $basedirname, - %{$self->{'diff_options'}}, - handle_binary_func => $opts{'handle_binary'}, - order_from => $opts{'order_from'}); + %{$self->{diff_options}}, + handle_binary_func => $opts{handle_binary}, + order_from => $opts{order_from}); error(_g("unrepresentable changes to source")) if not $diff->finish(); if (-s $tmpdiff) { info(_g("local changes detected, the modified files are:")); my $analysis = $diff->analyze($dir, verbose => 0); - foreach my $fn (sort keys %{$analysis->{'filepatched'}}) { + foreach my $fn (sort keys %{$analysis->{filepatched}}) { print " $fn\n"; } } @@ -419,17 +419,17 @@ sub generate_patch { sub do_build { my ($self, $dir) = @_; - my @argv = @{$self->{'options'}{'ARGV'}}; + my @argv = @{$self->{options}{ARGV}}; if (scalar(@argv)) { usageerr(_g("-b takes only one parameter with format `%s'"), - $self->{'fields'}{'Format'}); + $self->{fields}{'Format'}); } $self->prepare_build($dir); - my $include_binaries = $self->{'options'}{'include_binaries'}; - my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}}; + my $include_binaries = $self->{options}{include_binaries}; + my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}}; - my $sourcepackage = $self->{'fields'}{'Source'}; + my $sourcepackage = $self->{fields}{'Source'}; my $basenamerev = $self->get_basename(1); # Check if the debian directory contains unwanted binary files @@ -450,7 +450,7 @@ sub do_build { my $copy = $_; $copy =~ s/,/\\,/g; $copy; - } @{$self->{'options'}{'tar_ignore'}}) . "}"; + } @{$self->{options}{tar_ignore}}) . "}"; my $filter_ignore = sub { # Filter out files that are not going to be included in the debian # tarball due to ignores. @@ -503,9 +503,9 @@ sub do_build { my $tmpdiff = $self->generate_patch($dir, order_from => $autopatch, header_from => $autopatch, handle_binary => $handle_binary, - skip_auto => $self->{'options'}{'auto_commit'}, + skip_auto => $self->{options}{auto_commit}, usage => 'build'); - unless (-z $tmpdiff or $self->{'options'}{'auto_commit'}) { + unless (-z $tmpdiff or $self->{options}{auto_commit}) { info(_g("you can integrate the local changes with %s"), "dpkg-source --commit"); error(_g("aborting due to unexpected upstream changes, see %s"), @@ -515,7 +515,7 @@ sub do_build { $binaryfiles->update_debian_source_include_binaries() if $include_binaries; # Install the diff as the new autopatch - if ($self->{'options'}{'auto_commit'}) { + if ($self->{options}{auto_commit}) { mkpath(File::Spec->catdir($dir, "debian", "patches")); $autopatch = $self->register_patch($dir, $tmpdiff, $self->get_autopatch_name()); @@ -527,7 +527,7 @@ sub do_build { pop @Dpkg::Exit::handlers; # Create the debian.tar - my $debianfile = "$basenamerev.debian.tar." . $self->{'options'}{'comp_ext'}; + my $debianfile = "$basenamerev.debian.tar." . $self->{options}{comp_ext}; info(_g("building %s in %s"), $sourcepackage, $debianfile); my $tar = Dpkg::Source::Archive->new(filename => $debianfile); $tar->create(options => \@tar_ignore, chdir => $dir); @@ -619,7 +619,7 @@ sub _is_bad_patch_name { sub do_commit { my ($self, $dir) = @_; - my ($patch_name, $tmpdiff) = @{$self->{'options'}{'ARGV'}}; + my ($patch_name, $tmpdiff) = @{$self->{options}{ARGV}}; $self->prepare_build($dir); @@ -689,19 +689,19 @@ sub new { sub new_binary_found { my ($self, $path) = @_; - $self->{'seen_binaries'}{$path} = 1; + $self->{seen_binaries}{$path} = 1; } sub load_allowed_binaries { my ($self) = @_; - my $incbin_file = $self->{'include_binaries_path'}; + my $incbin_file = $self->{include_binaries_path}; if (-f $incbin_file) { open(my $incbin_fh, "<", $incbin_file) || syserr(_g("cannot read %s"), $incbin_file); while (defined($_ = <$incbin_fh>)) { chomp; s/^\s*//; s/\s*$//; next if /^#/ or /^$/; - $self->{'allowed_binaries'}{$_} = 1; + $self->{allowed_binaries}{$_} = 1; } close($incbin_fh); } @@ -709,7 +709,7 @@ sub load_allowed_binaries { sub binary_is_allowed { my ($self, $path) = @_; - return 1 if exists $self->{'allowed_binaries'}{$path}; + return 1 if exists $self->{allowed_binaries}{$path}; return 0; } @@ -719,14 +719,14 @@ sub update_debian_source_include_binaries { my @unknown_binaries = $self->get_unknown_binaries(); return unless scalar(@unknown_binaries); - my $incbin_file = $self->{'include_binaries_path'}; - mkpath(File::Spec->catdir($self->{'dir'}, "debian", "source")); + my $incbin_file = $self->{include_binaries_path}; + mkpath(File::Spec->catdir($self->{dir}, "debian", "source")); open(my $incbin_fh, ">>", $incbin_file) || syserr(_g("cannot write %s"), $incbin_file); foreach my $binary (@unknown_binaries) { print $incbin_fh "$binary\n"; info(_g("adding %s to %s"), $binary, "debian/source/include-binaries"); - $self->{'allowed_binaries'}{$binary} = 1; + $self->{allowed_binaries}{$binary} = 1; } close($incbin_fh); } @@ -738,7 +738,7 @@ sub get_unknown_binaries { sub get_seen_binaries { my ($self) = @_; - my @seen = sort keys %{$self->{'seen_binaries'}}; + my @seen = sort keys %{$self->{seen_binaries}}; return @seen; } diff --git a/scripts/Dpkg/Source/Package/V3/bzr.pm b/scripts/Dpkg/Source/Package/V3/bzr.pm index bba97fb21..28c9935a8 100644 --- a/scripts/Dpkg/Source/Package/V3/bzr.pm +++ b/scripts/Dpkg/Source/Package/V3/bzr.pm @@ -86,20 +86,20 @@ sub can_build { sub do_build { my ($self, $dir) = @_; - my @argv = @{$self->{'options'}{'ARGV'}}; + my @argv = @{$self->{options}{ARGV}}; # TODO: warn here? - #my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}}; - my $diff_ignore_regexp = $self->{'options'}{'diff_ignore_regexp'}; + #my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}}; + my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp}; $dir =~ s{/+$}{}; # Strip trailing / my ($dirname, $updir) = fileparse($dir); if (scalar(@argv)) { usageerr(_g("-b takes only one parameter with format `%s'"), - $self->{'fields'}{'Format'}); + $self->{fields}{'Format'}); } - my $sourcepackage = $self->{'fields'}{'Source'}; + my $sourcepackage = $self->{fields}{'Source'}; my $basenamerev = $self->get_basename(1); my $basename = $self->get_basename(); my $basedirname = $basename; @@ -149,12 +149,12 @@ sub do_build { "$tardir/.bzr/branch/parent"); # Create the tar file - my $debianfile = "$basenamerev.bzr.tar." . $self->{'options'}{'comp_ext'}; + my $debianfile = "$basenamerev.bzr.tar." . $self->{options}{comp_ext}; info(_g("building %s in %s"), $sourcepackage, $debianfile); my $tar = Dpkg::Source::Archive->new(filename => $debianfile, - compression => $self->{'options'}{'compression'}, - compression_level => $self->{'options'}{'comp_level'}); + compression => $self->{options}{compression}, + compression_level => $self->{options}{comp_level}); $tar->create(chdir => $tmp); $tar->add_directory($dirname); $tar->finish(); @@ -168,9 +168,9 @@ sub do_build { # Called after a tarball is unpacked, to check out the working copy. sub do_extract { my ($self, $newdirectory) = @_; - my $fields = $self->{'fields'}; + my $fields = $self->{fields}; - my $dscdir = $self->{'basedir'}; + my $dscdir = $self->{basedir}; my $basename = $self->get_basename(); my $basenamerev = $self->get_basename(1); diff --git a/scripts/Dpkg/Source/Package/V3/custom.pm b/scripts/Dpkg/Source/Package/V3/custom.pm index e27cdc68a..9ba8d5874 100644 --- a/scripts/Dpkg/Source/Package/V3/custom.pm +++ b/scripts/Dpkg/Source/Package/V3/custom.pm @@ -31,7 +31,7 @@ our $CURRENT_MINOR_VERSION = "0"; sub parse_cmdline_option { my ($self, $opt) = @_; if ($opt =~ /^--target-format=(.*)$/) { - $self->{'options'}{'target_format'} = $1; + $self->{options}{target_format} = $1; return 1; } return 0; @@ -42,18 +42,18 @@ sub do_extract { sub can_build { my ($self, $dir) = @_; - return (scalar(@{$self->{'options'}{'ARGV'}}), + return (scalar(@{$self->{options}{ARGV}}), _g("no files indicated on command line")); } sub do_build { my ($self, $dir) = @_; # Update real target format - my $format = $self->{'options'}{'target_format'}; + my $format = $self->{options}{target_format}; error(_g("--target-format option is missing")) unless $format; - $self->{'fields'}{'Format'} = $format; + $self->{fields}{'Format'} = $format; # Add all files - foreach my $file (@{$self->{'options'}{'ARGV'}}) { + foreach my $file (@{$self->{options}{ARGV}}) { $self->add_file($file); } } diff --git a/scripts/Dpkg/Source/Package/V3/git.pm b/scripts/Dpkg/Source/Package/V3/git.pm index b1e4a0dbc..863576f86 100644 --- a/scripts/Dpkg/Source/Package/V3/git.pm +++ b/scripts/Dpkg/Source/Package/V3/git.pm @@ -76,10 +76,10 @@ sub parse_cmdline_option { my ($self, $opt) = @_; return 1 if $self->SUPER::parse_cmdline_option($opt); if ($opt =~ /^--git-ref=(.*)$/) { - push @{$self->{'options'}{'git_ref'}}, $1; + push @{$self->{options}{git_ref}}, $1; return 1; } elsif ($opt =~ /^--git-depth=(\d+)$/) { - $self->{'options'}{'git_depth'} = $1; + $self->{options}{git_depth} = $1; return 1; } return 0; @@ -92,7 +92,7 @@ sub can_build { sub do_build { my ($self, $dir) = @_; - my $diff_ignore_regexp = $self->{'options'}{'diff_ignore_regexp'}; + my $diff_ignore_regexp = $self->{options}{diff_ignore_regexp}; $dir =~ s{/+$}{}; # Strip trailing / my ($dirname, $updir) = fileparse($dir); @@ -138,7 +138,7 @@ sub do_build { # bundle that. my $tmp; my $shallowfile; - if ($self->{'options'}{'git_depth'}) { + if ($self->{options}{git_depth}) { chdir($old_cwd) || syserr(_g("unable to chdir to `%s'"), $old_cwd); $tmp = tempdir("$dirname.git.XXXXXX", DIR => $updir); @@ -147,8 +147,8 @@ sub do_build { # file:// is needed to avoid local cloning, which does not # create a shallow clone. info(_g("creating shallow clone with depth %s"), - $self->{'options'}{'git_depth'}); - system("git", "clone", "--depth=" . $self->{'options'}{'git_depth'}, + $self->{options}{git_depth}); + system("git", "clone", "--depth=" . $self->{options}{git_depth}, "--quiet", "--bare", "file://" . abs_path($dir), $clone_dir); $? && subprocerr("git clone"); chdir($clone_dir) || @@ -160,8 +160,8 @@ sub do_build { # Create the git bundle. my $bundlefile = "$basenamerev.git"; - my @bundle_arg = $self->{'options'}{'git_ref'} ? - (@{$self->{'options'}{'git_ref'}}) : "--all"; + my @bundle_arg = $self->{options}{git_ref} ? + (@{$self->{options}{git_ref}}) : "--all"; info(_g("bundling: %s"), join(" ", @bundle_arg)); system("git", "bundle", "create", "$old_cwd/$bundlefile", @bundle_arg, @@ -186,9 +186,9 @@ sub do_build { sub do_extract { my ($self, $newdirectory) = @_; - my $fields = $self->{'fields'}; + my $fields = $self->{fields}; - my $dscdir = $self->{'basedir'}; + my $dscdir = $self->{basedir}; my $basenamerev = $self->get_basename(1); my @files = $self->get_files(); diff --git a/scripts/Dpkg/Source/Package/V3/native.pm b/scripts/Dpkg/Source/Package/V3/native.pm index de0b43c5f..726bc3905 100644 --- a/scripts/Dpkg/Source/Package/V3/native.pm +++ b/scripts/Dpkg/Source/Package/V3/native.pm @@ -38,10 +38,10 @@ our $CURRENT_MINOR_VERSION = "0"; sub do_extract { my ($self, $newdirectory) = @_; - my $sourcestyle = $self->{'options'}{'sourcestyle'}; - my $fields = $self->{'fields'}; + my $sourcestyle = $self->{options}{sourcestyle}; + my $fields = $self->{fields}; - my $dscdir = $self->{'basedir'}; + my $dscdir = $self->{basedir}; my $basename = $self->get_basename(); my $basenamerev = $self->get_basename(1); @@ -69,17 +69,17 @@ sub can_build { sub do_build { my ($self, $dir) = @_; - my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}}; - my @argv = @{$self->{'options'}{'ARGV'}}; + my @tar_ignore = map { "--exclude=$_" } @{$self->{options}{tar_ignore}}; + my @argv = @{$self->{options}{ARGV}}; if (scalar(@argv)) { usageerr(_g("-b takes only one parameter with format `%s'"), - $self->{'fields'}{'Format'}); + $self->{fields}{'Format'}); } - my $sourcepackage = $self->{'fields'}{'Source'}; + my $sourcepackage = $self->{fields}{'Source'}; my $basenamerev = $self->get_basename(1); - my $tarname = "$basenamerev.tar." . $self->{'options'}{'comp_ext'}; + my $tarname = "$basenamerev.tar." . $self->{options}{comp_ext}; info(_g("building %s in %s"), $sourcepackage, $tarname); @@ -90,7 +90,7 @@ sub do_build { my ($dirname, $dirbase) = fileparse($dir); my $tar = Dpkg::Source::Archive->new(filename => $newtar, compression => compression_guess_from_filename($tarname), - compression_level => $self->{'options'}{'comp_level'}); + compression_level => $self->{options}{comp_level}); $tar->create(options => \@tar_ignore, chdir => $dirbase); $tar->add_directory($dirname); $tar->finish(); diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm index dee4c1760..7ebee244f 100644 --- a/scripts/Dpkg/Source/Package/V3/quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/quilt.pm @@ -38,10 +38,10 @@ our $CURRENT_MINOR_VERSION = "0"; sub init_options { my ($self) = @_; - $self->{'options'}{'single_debian_patch'} = 0 - unless exists $self->{'options'}{'single_debian_patch'}; - $self->{'options'}{'allow_version_of_quilt_db'} = [] - unless exists $self->{'options'}{'allow_version_of_quilt_db'}; + $self->{options}{single_debian_patch} = 0 + unless exists $self->{options}{single_debian_patch}; + $self->{options}{allow_version_of_quilt_db} = [] + unless exists $self->{options}{allow_version_of_quilt_db}; $self->SUPER::init_options(); } @@ -50,12 +50,12 @@ sub parse_cmdline_option { my ($self, $opt) = @_; return 1 if $self->SUPER::parse_cmdline_option($opt); if ($opt =~ /^--single-debian-patch$/) { - $self->{'options'}{'single_debian_patch'} = 1; + $self->{options}{single_debian_patch} = 1; # For backwards compatibility. - $self->{'options'}{'auto_commit'} = 1; + $self->{options}{auto_commit} = 1; return 1; } elsif ($opt =~ /^--allow-version-of-quilt-db=(.*)$/) { - push @{$self->{'options'}{'allow_version_of_quilt_db'}}, $1; + push @{$self->{options}{allow_version_of_quilt_db}}, $1; return 1; } return 0; @@ -63,9 +63,9 @@ sub parse_cmdline_option { sub build_quilt_object { my ($self, $dir) = @_; - return $self->{'quilt'}{$dir} if exists $self->{'quilt'}{$dir}; - $self->{'quilt'}{$dir} = Dpkg::Source::Quilt->new($dir); - return $self->{'quilt'}{$dir}; + return $self->{quilt}{$dir} if exists $self->{quilt}{$dir}; + $self->{quilt}{$dir} = Dpkg::Source::Quilt->new($dir); + return $self->{quilt}{$dir}; } sub can_build { @@ -80,25 +80,25 @@ sub can_build { sub get_autopatch_name { my ($self) = @_; - if ($self->{'options'}{'single_debian_patch'}) { + if ($self->{options}{single_debian_patch}) { return "debian-changes"; } else { - return "debian-changes-" . $self->{'fields'}{'Version'}; + return "debian-changes-" . $self->{fields}{'Version'}; } } sub apply_patches { my ($self, $dir, %opts) = @_; - if ($opts{'usage'} eq 'unpack') { - $opts{'verbose'} = 1; - } elsif ($opts{'usage'} eq 'build') { - $opts{'warn_options'} = 1; - $opts{'verbose'} = 0; + if ($opts{usage} eq 'unpack') { + $opts{verbose} = 1; + } elsif ($opts{usage} eq 'build') { + $opts{warn_options} = 1; + $opts{verbose} = 0; } my $quilt = $self->build_quilt_object($dir); - $quilt->load_series(%opts) if $opts{'warn_options'}; # Trigger warnings + $quilt->load_series(%opts) if $opts{warn_options}; # Trigger warnings # Always create the quilt db so that if the maintainer calls quilt to # create a patch, it's stored in the right directory @@ -118,8 +118,8 @@ sub apply_patches { return unless scalar($quilt->series()); - if ($opts{'usage'} eq "preparation" and - $self->{'options'}{'unapply_patches'} eq 'auto') { + if ($opts{usage} eq "preparation" and + $self->{options}{unapply_patches} eq 'auto') { # We're applying the patches in --before-build, remember to unapply # them afterwards in --after-build my $pc_unapply = $quilt->get_db_file(".dpkg-source-unapply"); @@ -130,8 +130,8 @@ sub apply_patches { # Apply patches my $pc_applied = $quilt->get_db_file("applied-patches"); - $opts{"timestamp"} = fs_time($pc_applied); - if ($opts{"skip_auto"}) { + $opts{timestamp} = fs_time($pc_applied); + if ($opts{skip_auto}) { my $auto_patch = $self->get_autopatch_name(); $quilt->push(%opts) while ($quilt->next() and $quilt->next() ne $auto_patch); } else { @@ -144,11 +144,11 @@ sub unapply_patches { my $quilt = $self->build_quilt_object($dir); - $opts{'verbose'} //= 1; + $opts{verbose} //= 1; my $pc_applied = $quilt->get_db_file("applied-patches"); my @applied = $quilt->applied(); - $opts{"timestamp"} = fs_time($pc_applied) if @applied; + $opts{timestamp} = fs_time($pc_applied) if @applied; $quilt->pop(%opts) while $quilt->top(); @@ -164,10 +164,10 @@ sub prepare_build { my $func = sub { return 1 if $_[0] =~ m{^debian/patches/series$} and -l $_[0]; return 1 if $_[0] =~ /^\.pc(\/|$)/; - return 1 if $_[0] =~ /$self->{'options'}{'diff_ignore_regexp'}/; + return 1 if $_[0] =~ /$self->{options}{diff_ignore_regexp}/; return 0; }; - $self->{'diff_options'}{'diff_ignore_func'} = $func; + $self->{diff_options}{diff_ignore_func} = $func; } sub do_build { @@ -178,7 +178,7 @@ sub do_build { if (defined($version) and $version != 2) { if (scalar grep { $version eq $_ } - @{$self->{'options'}{'allow_version_of_quilt_db'}}) + @{$self->{options}{allow_version_of_quilt_db}}) { warning(_g("unsupported version of the quilt metadata: %s"), $version); } else { @@ -193,7 +193,7 @@ sub after_build { my ($self, $dir) = @_; my $quilt = $self->build_quilt_object($dir); my $pc_unapply = $quilt->get_db_file(".dpkg-source-unapply"); - my $opt_unapply = $self->{'options'}{'unapply_patches'}; + my $opt_unapply = $self->{options}{unapply_patches}; if (($opt_unapply eq "auto" and -e $pc_unapply) or $opt_unapply eq "yes") { unlink($pc_unapply); $self->unapply_patches($dir); |