diff options
author | Guillem Jover <guillem@debian.org> | 2012-12-31 21:43:39 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-05-04 19:03:13 +0200 |
commit | 6a73e3078b01a71d4a6ea90c85da16523ed56f1d (patch) | |
tree | 4cc7a210e7e851395f7ba4989e3aac4aa9d32710 /scripts/Dpkg/Source/Package | |
parent | 62bc788a45e4a641c28ca9c8c5b9bb08f29faed8 (diff) | |
download | dpkg-6a73e3078b01a71d4a6ea90c85da16523ed56f1d.tar.gz |
Do not use double-quotes on strings that do not need interpolation
Using double-quotes imposes a small performance penalty as the perl
parser needs to check if any interpolation is needed. Use double-quotes
only when the string contains single-quotes. Ideally we'd use
double-quotes too for escaped meta-characters that might otherwise be
confusing to immediately see if they need interpolation or not, but the
policy does not (currently) allow to ignore these.
Fixes ValuesAndExpressions::ProhibitInterpolationOfLiterals.
Warned-by: perlcritic
Diffstat (limited to 'scripts/Dpkg/Source/Package')
-rw-r--r-- | scripts/Dpkg/Source/Package/V1.pm | 92 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V2.pm | 196 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/bzr.pm | 38 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/custom.pm | 8 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/git.pm | 78 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/native.pm | 14 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package/V3/quilt.pm | 48 |
7 files changed, 237 insertions, 237 deletions
diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index 314ae0f16..a8829e9a0 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -18,7 +18,7 @@ package Dpkg::Source::Package::V1; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; use base 'Dpkg::Source::Package'; @@ -38,7 +38,7 @@ use File::Basename; use File::Temp qw(tempfile); use File::Spec; -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub init_options { my ($self) = @_; @@ -49,8 +49,8 @@ sub init_options { } else { $self->{options}{diff_ignore_regexp} = '(?:^|/)debian/source/local-.*$'; } - push @{$self->{options}{tar_ignore}}, "debian/source/local-options", - "debian/source/local-patch-header"; + 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; @@ -60,7 +60,7 @@ sub parse_cmdline_option { my ($self, $opt) = @_; my $o = $self->{options}; if ($opt =~ m/^-s([akpursnAKPUR])$/) { - warning(_g("-s%s option overrides earlier -s%s option"), $1, + 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 @@ -82,7 +82,7 @@ sub do_extract { $sourcestyle =~ y/X/p/; $sourcestyle =~ m/[pun]/ || - usageerr(_g("source handling style -s%s not allowed with -x"), + usageerr(_g('source handling style -s%s not allowed with -x'), $sourcestyle); my $dscdir = $self->{basedir}; @@ -94,20 +94,20 @@ sub do_extract { my ($tarfile, $difffile); foreach my $file ($self->get_files()) { if ($file =~ /^(?:\Q$basename\E\.orig|\Q$basenamerev\E)\.tar\.gz$/) { - error(_g("multiple tarfiles in v1.0 source package")) if $tarfile; + error(_g('multiple tarfiles in v1.0 source package')) if $tarfile; $tarfile = $file; } elsif ($file =~ /^\Q$basenamerev\E\.diff\.gz$/) { $difffile = $file; } else { - error(_g("unrecognized file for a %s source package: %s"), - "v1.0", $file); + error(_g('unrecognized file for a %s source package: %s'), + 'v1.0', $file); } } - error(_g("no tarfile in Files field")) unless $tarfile; + error(_g('no tarfile in Files field')) unless $tarfile; my $native = $difffile ? 0 : 1; if ($native and ($tarfile =~ /\.orig\.tar\.gz$/)) { - warning(_g("native package with .orig.tar")); + warning(_g('native package with .orig.tar')); $native = 0; # V3::native doesn't handle orig.tar } @@ -124,39 +124,39 @@ sub do_extract { "$newdirectory.tmp-keep"); } - info(_g("unpacking %s"), $tarfile); + info(_g('unpacking %s'), $tarfile); my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile"); $tar->extract($expectprefix); if ($sourcestyle =~ /u/) { # -su: keep .orig directory unpacked if (-e "$newdirectory.tmp-keep") { - error(_g("unable to keep orig directory (already exists)")); + error(_g('unable to keep orig directory (already exists)')); } system('cp', '-ar', '--', $expectprefix, "$newdirectory.tmp-keep"); subprocerr("cp $expectprefix to $newdirectory.tmp-keep") if $?; } rename($expectprefix, $newdirectory) || - syserr(_g("failed to rename newly-extracted %s to %s"), + syserr(_g('failed to rename newly-extracted %s to %s'), $expectprefix, $newdirectory); # rename the copied .orig directory if (-e "$newdirectory.tmp-keep") { rename("$newdirectory.tmp-keep", $expectprefix) || - syserr(_g("failed to rename saved %s to %s"), + syserr(_g('failed to rename saved %s to %s'), "$newdirectory.tmp-keep", $expectprefix); } } if ($difffile and not $self->{options}{skip_debianization}) { my $patch = "$dscdir$difffile"; - info(_g("applying %s"), $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}}; - info(_g("upstream files that have been modified: %s"), + info(_g('upstream files that have been modified: %s'), "\n " . join("\n ", @files)) if scalar @files; } } @@ -165,8 +165,8 @@ 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", - _g("only supports gzip compression")); + return ($self->{options}{compression} eq 'gzip', + _g('only supports gzip compression')); } sub do_build { @@ -177,13 +177,13 @@ sub do_build { 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 ". - "argument (with v1.0 source package)")); + usageerr(_g('-b takes at most a directory and an orig source ' . + 'argument (with v1.0 source package)')); } $sourcestyle =~ y/X/A/; unless ($sourcestyle =~ m/[akpursnAKPUR]/) { - usageerr(_g("source handling style -s%s not allowed with -b"), + usageerr(_g('source handling style -s%s not allowed with -b'), $sourcestyle); } @@ -195,7 +195,7 @@ sub do_build { # Try to find a .orig tarball for the package my $origdir = "$dir.orig"; - my $origtargz = $self->get_basename() . ".orig.tar.gz"; + my $origtargz = $self->get_basename() . '.orig.tar.gz'; if (-e $origtargz) { unless (-f $origtargz) { error(_g("packed orig `%s' exists but is not a plain file"), $origtargz); @@ -210,33 +210,33 @@ sub do_build { my $origarg = shift(@argv); if (length($origarg)) { stat($origarg) || - syserr(_g("cannot stat orig argument %s"), $origarg); + syserr(_g('cannot stat orig argument %s'), $origarg); if (-d _) { $origdir = File::Spec->catdir($origarg); $sourcestyle =~ y/aA/rR/; unless ($sourcestyle =~ m/[ursURS]/) { - error(_g("orig argument is unpacked but source handling " . - "style -s%s calls for packed (.orig.tar.<ext>)"), + error(_g('orig argument is unpacked but source handling ' . + 'style -s%s calls for packed (.orig.tar.<ext>)'), $sourcestyle); } } elsif (-f _) { $origtargz = $origarg; $sourcestyle =~ y/aA/pP/; unless ($sourcestyle =~ m/[kpsKPS]/) { - error(_g("orig argument is packed but source handling " . - "style -s%s calls for unpacked (.orig/)"), + error(_g('orig argument is packed but source handling ' . + 'style -s%s calls for unpacked (.orig/)'), $sourcestyle); } } else { - error(_g("orig argument %s is not a plain file or directory"), + error(_g('orig argument %s is not a plain file or directory'), $origarg); } } else { $sourcestyle =~ y/aA/nn/; $sourcestyle =~ m/n/ || - error(_g("orig argument is empty (means no orig, no diff) " . - "but source handling style -s%s wants something"), + error(_g('orig argument is empty (means no orig, no diff) ' . + 'but source handling style -s%s wants something'), $sourcestyle); } } elsif ($sourcestyle =~ m/[aA]/) { @@ -271,8 +271,8 @@ sub do_build { my ($origdirname, $origdirbase) = fileparse($origdir); if ($origdirname ne "$basedirname.orig") { - warning(_g(".orig directory name %s is not <package>" . - "-<upstreamversion> (wanted %s)"), + warning(_g('.orig directory name %s is not <package>' . + '-<upstreamversion> (wanted %s)'), $origdirname, "$basedirname.orig"); } $tardirbase = $origdirbase; @@ -280,26 +280,26 @@ sub do_build { $tarname = $origtargz || "$basename.orig.tar.gz"; unless ($tarname =~ /\Q$basename\E\.orig\.tar\.gz/) { - warning(_g(".orig.tar name %s is not <package>_<upstreamversion>" . - ".orig.tar (wanted %s)"), + warning(_g('.orig.tar name %s is not <package>_<upstreamversion>' . + '.orig.tar (wanted %s)'), $tarname, "$basename.orig.tar.gz"); } } - if ($sourcestyle eq "n") { + if ($sourcestyle eq 'n') { $self->{options}{ARGV} = []; # ensure we have no error Dpkg::Source::Package::V3::native::do_build($self, $dir); } elsif ($sourcestyle =~ m/[nurUR]/) { if (stat($tarname)) { unless ($sourcestyle =~ m/[nUR]/) { error(_g("tarfile `%s' already exists, not overwriting, " . - "giving up; use -sU or -sR to override"), $tarname); + 'giving up; use -sU or -sR to override'), $tarname); } } elsif ($! != ENOENT) { syserr(_g("unable to check for existence of `%s'"), $tarname); } - info(_g("building %s in %s"), + info(_g('building %s in %s'), $sourcepackage, $tarname); my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX", @@ -316,7 +316,7 @@ sub do_build { chmod(0666 &~ umask(), $tarname) || syserr(_g("unable to change permission of `%s'"), $tarname); } else { - info(_g("building %s using existing %s"), + info(_g('building %s using existing %s'), $sourcepackage, $tarname); } @@ -326,7 +326,7 @@ sub do_build { if (stat($origdir)) { unless ($sourcestyle =~ m/[KP]/) { error(_g("orig dir `%s' already exists, not overwriting, ". - "giving up; use -sA, -sK or -sP to override"), + 'giving up; use -sA, -sK or -sP to override'), $origdir); } push @Dpkg::Exit::handlers, sub { erasedir($origdir) }; @@ -344,13 +344,13 @@ sub do_build { my $ur; # Unrepresentable changes if ($sourcestyle =~ m/[kpursKPUR]/) { my $diffname = "$basenamerev.diff.gz"; - info(_g("building %s in %s"), + info(_g('building %s in %s'), $sourcepackage, $diffname); my ($ndfh, $newdiffgz) = tempfile("$diffname.new.XXXXXX", DIR => getcwd(), UNLINK => 0); push @Dpkg::Exit::handlers, sub { unlink($newdiffgz) }; my $diff = Dpkg::Source::Patch->new(filename => $newdiffgz, - compression => "gzip"); + compression => 'gzip'); $diff->create(); $diff->add_diff_directory($origdir, $dir, basedirname => $basedirname, @@ -364,11 +364,11 @@ sub do_build { my @files = grep { ! m{^debian/} } map { s{^[^/]+/+}{}; $_ } sort keys %{$analysis->{filepatched}}; if (scalar @files) { - warning(_g("the diff modifies the following upstream files: %s"), + 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")) + '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}; } @@ -386,7 +386,7 @@ sub do_build { } if ($ur) { - printf(STDERR _g("%s: unrepresentable changes to source")."\n", + printf(STDERR _g('%s: unrepresentable changes to source') . "\n", $progname); exit(1); } diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index 4da8bdae2..be1d363a7 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -18,7 +18,7 @@ package Dpkg::Source::Package::V2; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; use base 'Dpkg::Source::Package'; @@ -43,7 +43,7 @@ use File::Spec; use File::Find; use File::Copy; -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub init_options { my ($self) = @_; @@ -120,7 +120,7 @@ sub do_extract { my $re_ext = $compression_re_file_ext; foreach my $file ($self->get_files()) { (my $uncompressed = $file) =~ s/\.$re_ext$//; - error(_g("duplicate files in %s source package: %s.*"), "v2.0", + error(_g('duplicate files in %s source package: %s.*'), 'v2.0', $uncompressed) if $seen{$uncompressed}; $seen{$uncompressed} = 1; if ($file =~ /^\Q$basename\E\.orig\.tar\.$re_ext$/) { @@ -130,23 +130,23 @@ sub do_extract { } elsif ($file =~ /^\Q$basenamerev\E\.debian\.tar\.$re_ext$/) { $debianfile = $file; } else { - error(_g("unrecognized file for a %s source package: %s"), - "v2.0", $file); + error(_g('unrecognized file for a %s source package: %s'), + 'v2.0', $file); } } unless ($tarfile and $debianfile) { - error(_g("missing orig.tar or debian.tar file in v2.0 source package")); + error(_g('missing orig.tar or debian.tar file in v2.0 source package')); } erasedir($newdirectory); # Extract main tarball - info(_g("unpacking %s"), $tarfile); + info(_g('unpacking %s'), $tarfile); my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile"); $tar->extract($newdirectory, no_fixperms => 1, - options => [ "--anchored", "--no-wildcards-match-slash", - "--exclude", "*/.pc", "--exclude", ".pc" ]); + options => [ '--anchored', '--no-wildcards-match-slash', + '--exclude', '*/.pc', '--exclude', '.pc' ]); # The .pc exclusion is only needed for 3.0 (quilt) and to avoid # having an upstream tarball provide a directory with symlinks # that would be blindly followed when applying the patches @@ -154,7 +154,7 @@ sub do_extract { # Extract additional orig tarballs foreach my $subdir (keys %origtar) { my $file = $origtar{$subdir}; - info(_g("unpacking %s"), $file); + info(_g('unpacking %s'), $file); if (-e "$newdirectory/$subdir") { warning(_g("required removal of `%s' installed by original tarball"), $subdir); erasedir("$newdirectory/$subdir"); @@ -167,7 +167,7 @@ sub do_extract { return if $self->{options}{skip_debianization}; # Extract debian tarball after removing the debian directory - info(_g("unpacking %s"), $debianfile); + info(_g('unpacking %s'), $debianfile); erasedir("$newdirectory/debian"); # Exclude existing symlinks from extraction of debian.tar.gz as we # don't want to overwrite something outside of $newdirectory due to a @@ -176,7 +176,7 @@ sub do_extract { my $wanted = sub { return if not -l $_; my $fn = File::Spec->abs2rel($_, $newdirectory); - push @exclude_symlinks, "--exclude", $fn; + push @exclude_symlinks, '--exclude', $fn; }; find({ wanted => $wanted, no_chdir => 1 }, $newdirectory); $tar = Dpkg::Source::Archive->new(filename => "$dscdir$debianfile"); @@ -190,7 +190,7 @@ sub do_extract { } sub get_autopatch_name { - return "zz_debian-diff-auto"; + return 'zz_debian-diff-auto'; } sub get_patches { @@ -200,7 +200,7 @@ sub get_patches { my $pd = "$dir/debian/patches"; my $auto_patch = $self->get_autopatch_name(); if (-d $pd) { - opendir(my $dir_dh, $pd) || syserr(_g("cannot opendir %s"), $pd); + opendir(my $dir_dh, $pd) || syserr(_g('cannot opendir %s'), $pd); foreach my $patch (sort readdir($dir_dh)) { # patches match same rules as run-parts next unless $patch =~ /^[\w-]+$/ and -f "$pd/$patch"; @@ -217,14 +217,14 @@ sub apply_patches { $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"); + my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); open(my $applied_fh, '>', $applied) || - syserr(_g("cannot write %s"), $applied); + syserr(_g('cannot write %s'), $applied); 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}; + my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch); + 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, @@ -238,11 +238,11 @@ sub unapply_patches { my ($self, $dir, %opts) = @_; my @patches = reverse($self->get_patches($dir, %opts)); return unless scalar(@patches); - my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied"); + my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); 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}; + my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch); + 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, @@ -253,11 +253,11 @@ sub unapply_patches { sub upstream_tarball_template { my ($self) = @_; - my $ext = "{" . join(",", + my $ext = '{' . join(',', sort map { - compression_get_property($_, "file_ext") - } compression_get_list()) . "}"; - return "../" . $self->get_basename() . ".orig.tar.$ext"; + compression_get_property($_, 'file_ext') + } compression_get_list()) . '}'; + return '../' . $self->get_basename() . ".orig.tar.$ext"; } sub can_build { @@ -265,7 +265,7 @@ sub can_build { return 1 if $self->find_original_tarballs(include_supplementary => 0); 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"), + return (0, sprintf(_g('no upstream tarball found at %s'), $self->upstream_tarball_template())); } @@ -276,17 +276,17 @@ sub before_build { sub after_build { my ($self, $dir) = @_; - my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied"); - my $reason = ""; + my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); + my $reason = ''; if (-e $applied) { - open(my $applied_fh, "<", $applied) || - syserr(_g("cannot read %s"), $applied); + open(my $applied_fh, '<', $applied) || + syserr(_g('cannot read %s'), $applied); $reason = <$applied_fh>; close($applied_fh); } my $opt_unapply = $self->{options}{unapply_patches}; - if (($opt_unapply eq "auto" and $reason =~ /^# During preparation/) or - $opt_unapply eq "yes") { + if (($opt_unapply eq 'auto' and $reason =~ /^# During preparation/) or + $opt_unapply eq 'yes') { $self->unapply_patches($dir); } } @@ -300,13 +300,13 @@ sub prepare_build { include_timestamp => $self->{options}{include_timestamp}, use_dev_null => 1, }; - push @{$self->{options}{tar_ignore}}, "debian/patches/.dpkg-source-applied"; + 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." . + my $filename = $self->get_basename() . '.orig.tar.' . $self->{options}{comp_ext}; my $tar = Dpkg::Source::Archive->new(filename => $filename); $tar->create(); @@ -316,9 +316,9 @@ sub prepare_build { sub check_patches_applied { my ($self, $dir) = @_; - my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied"); + my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); unless (-e $applied) { - info(_g("patches are not applied, applying them now")); + info(_g('patches are not applied, applying them now')); $self->apply_patches($dir, usage => 'preparation'); } } @@ -335,8 +335,8 @@ sub generate_patch { foreach (sort $self->find_original_tarballs()) { if (/\.orig\.tar\.$compression_re_file_ext$/) { if (defined($tarfile)) { - error(_g("several orig.tar files found (%s and %s) but only " . - "one is allowed"), $tarfile, $_); + error(_g('several orig.tar files found (%s and %s) but only ' . + 'one is allowed'), $tarfile, $_); } $tarfile = $_; push @origtarballs, $_; @@ -348,11 +348,11 @@ sub generate_patch { } } - error(_g("no upstream tarball found at %s"), + error(_g('no upstream tarball found at %s'), $self->upstream_tarball_template()) unless $tarfile; - if ($opts{usage} eq "build") { - info(_g("building %s using existing %s"), + if ($opts{usage} eq 'build') { + info(_g('building %s using existing %s'), $self->{fields}{'Source'}, "@origtarballs"); } @@ -373,19 +373,19 @@ sub generate_patch { # Copy over the debian directory erasedir("$tmp/debian"); - system("cp", "-a", "--", "$dir/debian", "$tmp/"); - subprocerr(_g("copy of the debian directory")) if $?; + system('cp', '-a', '--', "$dir/debian", "$tmp/"); + 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'); # Create a patch - my ($difffh, $tmpdiff) = tempfile($self->get_basename(1) . ".diff.XXXXXX", + my ($difffh, $tmpdiff) = tempfile($self->get_basename(1) . '.diff.XXXXXX', DIR => File::Spec->tmpdir(), UNLINK => 0); push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) }; my $diff = Dpkg::Source::Patch->new(filename => $tmpdiff, - compression => "none"); + compression => 'none'); $diff->create(); if ($opts{header_from} and -e $opts{header_from}) { my $header_from = Dpkg::Source::Patch->new( @@ -399,10 +399,10 @@ sub generate_patch { %{$self->{diff_options}}, handle_binary_func => $opts{handle_binary}, order_from => $opts{order_from}); - error(_g("unrepresentable changes to source")) if not $diff->finish(); + error(_g('unrepresentable changes to source')) if not $diff->finish(); if (-s $tmpdiff) { - info(_g("local changes detected, the modified files are:")); + info(_g('local changes detected, the modified files are:')); my $analysis = $diff->analyze($dir, verbose => 0); foreach my $fn (sort keys %{$analysis->{filepatched}}) { print " $fn\n"; @@ -440,17 +440,17 @@ sub do_build { my $fn = File::Spec->abs2rel($_, $dir); $binaryfiles->new_binary_found($fn); unless ($include_binaries or $binaryfiles->binary_is_allowed($fn)) { - errormsg(_g("unwanted binary file: %s"), $fn); + errormsg(_g('unwanted binary file: %s'), $fn); $unwanted_binaries++; } } }; - my $tar_ignore_glob = "{" . join(",", + my $tar_ignore_glob = '{' . join(',', map { 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. @@ -474,11 +474,11 @@ sub do_build { return @result; }; find({ wanted => $check_binary, preprocess => $filter_ignore, - no_chdir => 1 }, File::Spec->catdir($dir, "debian")); - error(P_("detected %d unwanted binary file (add it in " . - "debian/source/include-binaries to allow its inclusion).", - "detected %d unwanted binary files (add them in " . - "debian/source/include-binaries to allow their inclusion).", + no_chdir => 1 }, File::Spec->catdir($dir, 'debian')); + error(P_('detected %d unwanted binary file (add it in ' . + 'debian/source/include-binaries to allow its inclusion).', + 'detected %d unwanted binary files (add them in ' . + 'debian/source/include-binaries to allow their inclusion).', $unwanted_binaries), $unwanted_binaries) if $unwanted_binaries; @@ -488,17 +488,17 @@ sub do_build { my $relfn = File::Spec->abs2rel($new, $dir); $binaryfiles->new_binary_found($relfn); unless ($include_binaries or $binaryfiles->binary_is_allowed($relfn)) { - errormsg(_g("cannot represent change to %s: %s"), $relfn, - _g("binary file contents changed")); - errormsg(_g("add %s in debian/source/include-binaries if you want" . - " to store the modified binary in the debian tarball"), + errormsg(_g('cannot represent change to %s: %s'), $relfn, + _g('binary file contents changed')); + errormsg(_g('add %s in debian/source/include-binaries if you want ' . + 'to store the modified binary in the debian tarball'), $relfn); $self->register_error(); } }; # Create a patch - my $autopatch = File::Spec->catfile($dir, "debian", "patches", + my $autopatch = File::Spec->catfile($dir, 'debian', 'patches', $self->get_autopatch_name()); my $tmpdiff = $self->generate_patch($dir, order_from => $autopatch, header_from => $autopatch, @@ -506,9 +506,9 @@ sub do_build { skip_auto => $self->{options}{auto_commit}, usage => 'build'); 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"), + info(_g('you can integrate the local changes with %s'), + 'dpkg-source --commit'); + error(_g('aborting due to unexpected upstream changes, see %s'), $tmpdiff); } push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) }; @@ -516,22 +516,22 @@ sub do_build { # Install the diff as the new autopatch if ($self->{options}{auto_commit}) { - mkpath(File::Spec->catdir($dir, "debian", "patches")); + mkpath(File::Spec->catdir($dir, 'debian', 'patches')); $autopatch = $self->register_patch($dir, $tmpdiff, $self->get_autopatch_name()); - info(_g("local changes have been recorded in a new patch: %s"), + info(_g('local changes have been recorded in a new patch: %s'), $autopatch) if -e $autopatch; - rmdir(File::Spec->catdir($dir, "debian", "patches")); # No check on purpose + rmdir(File::Spec->catdir($dir, 'debian', 'patches')); # No check on purpose } - unlink($tmpdiff) || syserr(_g("cannot remove %s"), $tmpdiff); + unlink($tmpdiff) || syserr(_g('cannot remove %s'), $tmpdiff); pop @Dpkg::Exit::handlers; # Create the debian.tar my $debianfile = "$basenamerev.debian.tar." . $self->{options}{comp_ext}; - info(_g("building %s in %s"), $sourcepackage, $debianfile); + info(_g('building %s in %s'), $sourcepackage, $debianfile); my $tar = Dpkg::Source::Archive->new(filename => $debianfile); $tar->create(options => \@tar_ignore, chdir => $dir); - $tar->add_directory("debian"); + $tar->add_directory('debian'); foreach my $binary ($binaryfiles->get_seen_binaries()) { $tar->add_file($binary) unless $binary =~ m{^debian/}; } @@ -542,19 +542,19 @@ sub do_build { sub get_patch_header { my ($self, $dir) = @_; - my $ph = File::Spec->catfile($dir, "debian", "source", "local-patch-header"); + my $ph = File::Spec->catfile($dir, 'debian', 'source', 'local-patch-header'); unless (-f $ph) { - $ph = File::Spec->catfile($dir, "debian", "source", "patch-header"); + $ph = File::Spec->catfile($dir, 'debian', 'source', 'patch-header'); } my $text; if (-f $ph) { - open(my $ph_fh, "<", $ph) || syserr(_g("cannot read %s"), $ph); - $text = join("", <$ph_fh>); + open(my $ph_fh, '<', $ph) || syserr(_g('cannot read %s'), $ph); + $text = join('', <$ph_fh>); close($ph_fh); return $text; } my $ch_info = changelog_parse(offset => 0, count => 1, - file => File::Spec->catfile($dir, "debian", "changelog")); + file => File::Spec->catfile($dir, 'debian', 'changelog')); return '' if not defined $ch_info; my $header = Dpkg::Control->new(type => CTRL_UNKNOWN); $header->{'Description'} = "<short summary of the patch>\n"; @@ -567,7 +567,7 @@ it.\n"; $header->{'Description'} .= $ch_info->{'Changes'} . "\n"; $header->{'Author'} = $ch_info->{'Maintainer'}; $text = "$header"; - run_vendor_hook("extend-patch-header", \$text, $ch_info); + run_vendor_hook('extend-patch-header', \$text, $ch_info); $text .= "\n--- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here @@ -585,19 +585,19 @@ Last-Update: <YYYY-MM-DD>\n\n"; sub register_patch { my ($self, $dir, $patch_file, $patch_name) = @_; - my $patch = File::Spec->catfile($dir, "debian", "patches", $patch_name); + my $patch = File::Spec->catfile($dir, 'debian', 'patches', $patch_name); if (-s $patch_file) { copy($patch_file, $patch) || - syserr(_g("failed to copy %s to %s"), $patch_file, $patch); + syserr(_g('failed to copy %s to %s'), $patch_file, $patch); chmod(0666 & ~ umask(), $patch) || syserr(_g("unable to change permission of `%s'"), $patch); - my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied"); + my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); open(my $applied_fh, '>>', $applied) || - syserr(_g("cannot write %s"), $applied); + syserr(_g('cannot write %s'), $applied); print $applied_fh "$patch\n"; - close($applied_fh) || syserr(_g("cannot close %s"), $applied); + close($applied_fh) || syserr(_g('cannot close %s'), $applied); } elsif (-e $patch) { - unlink($patch) || syserr(_g("cannot remove %s"), $patch); + unlink($patch) || syserr(_g('cannot remove %s'), $patch); } return $patch; } @@ -608,9 +608,9 @@ sub _is_bad_patch_name { return 1 if not defined($patch_name); return 1 if not length($patch_name); - my $patch = File::Spec->catfile($dir, "debian", "patches", $patch_name); + my $patch = File::Spec->catfile($dir, 'debian', 'patches', $patch_name); if (-e $patch) { - warning(_g("cannot register changes in %s, this patch already exists"), + warning(_g('cannot register changes in %s, this patch already exists'), $patch); return 1; } @@ -639,28 +639,28 @@ sub do_commit { unless ($tmpdiff) { $tmpdiff = $self->generate_patch($dir, handle_binary => $handle_binary, - usage => "commit"); + usage => 'commit'); $binaryfiles->update_debian_source_include_binaries(); } push @Dpkg::Exit::handlers, sub { unlink($tmpdiff) }; unless (-s $tmpdiff) { - unlink($tmpdiff) || syserr(_g("cannot remove %s"), $tmpdiff); - info(_g("there are no local changes to record")); + unlink($tmpdiff) || syserr(_g('cannot remove %s'), $tmpdiff); + info(_g('there are no local changes to record')); return; } while (_is_bad_patch_name($dir, $patch_name)) { # Ask the patch name interactively - print STDOUT _g("Enter the desired patch name: "); + print STDOUT _g('Enter the desired patch name: '); chomp($patch_name = <STDIN>); $patch_name =~ s/\s+/-/g; $patch_name =~ s/\///g; } - mkpath(File::Spec->catdir($dir, "debian", "patches")); + mkpath(File::Spec->catdir($dir, 'debian', 'patches')); my $patch = $self->register_patch($dir, $tmpdiff, $patch_name); - system("sensible-editor", $patch); - unlink($tmpdiff) || syserr(_g("cannot remove %s"), $tmpdiff); + system('sensible-editor', $patch); + unlink($tmpdiff) || syserr(_g('cannot remove %s'), $tmpdiff); pop @Dpkg::Exit::handlers; - info(_g("local changes have been recorded in a new patch: %s"), $patch); + info(_g('local changes have been recorded in a new patch: %s'), $patch); } package Dpkg::Source::Package::V2::BinaryFiles; @@ -679,7 +679,7 @@ sub new { allowed_binaries => {}, seen_binaries => {}, include_binaries_path => - File::Spec->catfile($dir, "debian", "source", "include-binaries"), + File::Spec->catfile($dir, 'debian', 'source', 'include-binaries'), }; bless $self, $class; $self->load_allowed_binaries(); @@ -696,8 +696,8 @@ sub load_allowed_binaries { my ($self) = @_; my $incbin_file = $self->{include_binaries_path}; if (-f $incbin_file) { - open(my $incbin_fh, "<", $incbin_file) || - syserr(_g("cannot read %s"), $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 /^$/; @@ -720,12 +720,12 @@ sub update_debian_source_include_binaries { return unless scalar(@unknown_binaries); 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); + 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"); + info(_g('adding %s to %s'), $binary, 'debian/source/include-binaries'); $self->{allowed_binaries}{$binary} = 1; } close($incbin_fh); diff --git a/scripts/Dpkg/Source/Package/V3/bzr.pm b/scripts/Dpkg/Source/Package/V3/bzr.pm index 28c9935a8..9bc69f23e 100644 --- a/scripts/Dpkg/Source/Package/V3/bzr.pm +++ b/scripts/Dpkg/Source/Package/V3/bzr.pm @@ -24,7 +24,7 @@ package Dpkg::Source::Package::V3::bzr; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; use base 'Dpkg::Source::Package'; @@ -41,7 +41,7 @@ use Dpkg::Source::Archive; use Dpkg::Exit; use Dpkg::Source::Functions qw(erasedir); -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub import { foreach my $dir (split(/:/, $ENV{PATH})) { @@ -49,28 +49,28 @@ sub import { return 1; } } - error(_g("cannot unpack bzr-format source package because " . - "bzr is not in the PATH")); + error(_g('cannot unpack bzr-format source package because ' . + 'bzr is not in the PATH')); } sub sanity_check { my $srcdir = shift; if (! -d "$srcdir/.bzr") { - error(_g("source directory is not the top directory of a bzr repository (%s/.bzr not present), but Format bzr was specified"), + error(_g('source directory is not the top directory of a bzr repository (%s/.bzr not present), but Format bzr was specified'), $srcdir); } # Symlinks from .bzr to outside could cause unpack failures, or # point to files they shouldn't, so check for and don't allow. if (-l "$srcdir/.bzr") { - error(_g("%s is a symlink"), "$srcdir/.bzr"); + error(_g('%s is a symlink'), "$srcdir/.bzr"); } my $abs_srcdir = Cwd::abs_path($srcdir); find(sub { if (-l $_) { if (Cwd::abs_path(readlink($_)) !~ /^\Q$abs_srcdir\E(\/|$)/) { - error(_g("%s is a symlink to outside %s"), + error(_g('%s is a symlink to outside %s'), $File::Find::name, $srcdir); } } @@ -114,8 +114,8 @@ sub do_build { # Check for uncommitted files. # To support dpkg-source -i, remove any ignored files from the # output of bzr status. - open(my $bzr_status_fh, '-|', "bzr", "status") || - subprocerr("bzr status"); + open(my $bzr_status_fh, '-|', 'bzr', 'status') || + subprocerr('bzr status'); my @files; while (<$bzr_status_fh>) { chomp; @@ -125,10 +125,10 @@ sub do_build { push @files, $_; } } - close($bzr_status_fh) || syserr(_g("bzr status exited nonzero")); + close($bzr_status_fh) || syserr(_g('bzr status exited nonzero')); if (@files) { - error(_g("uncommitted, not-ignored changes in working directory: %s"), - join(" ", @files)); + error(_g('uncommitted, not-ignored changes in working directory: %s'), + join(' ', @files)); } chdir($old_cwd) || @@ -138,11 +138,11 @@ sub do_build { push @Dpkg::Exit::handlers, sub { erasedir($tmp) }; my $tardir = "$tmp/$dirname"; - system("bzr", "branch", $dir, $tardir); + system('bzr', 'branch', $dir, $tardir); $? && subprocerr("bzr branch $dir $tardir"); # Remove the working tree. - system("bzr", "remove-tree", $tardir); + system('bzr', 'remove-tree', $tardir); # Some branch metadata files are unhelpful. unlink("$tardir/.bzr/branch/branch-name", @@ -150,7 +150,7 @@ sub do_build { # Create the tar file my $debianfile = "$basenamerev.bzr.tar." . $self->{options}{comp_ext}; - info(_g("building %s in %s"), + info(_g('building %s in %s'), $sourcepackage, $debianfile); my $tar = Dpkg::Source::Archive->new(filename => $debianfile, compression => $self->{options}{compression}, @@ -177,18 +177,18 @@ sub do_extract { my @files = $self->get_files(); if (@files > 1) { - error(_g("format v3.0 uses only one source file")); + error(_g('format v3.0 uses only one source file')); } my $tarfile = $files[0]; if ($tarfile !~ /^\Q$basenamerev\E\.bzr\.tar\.$compression_re_file_ext$/) { - error(_g("expected %s, got %s"), + error(_g('expected %s, got %s'), "$basenamerev.bzr.tar.$compression_re_file_ext", $tarfile); } erasedir($newdirectory); # Extract main tarball - info(_g("unpacking %s"), $tarfile); + info(_g('unpacking %s'), $tarfile); my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile"); $tar->extract($newdirectory); @@ -199,7 +199,7 @@ sub do_extract { syserr(_g("unable to chdir to `%s'"), $newdirectory); # Reconstitute the working tree. - system("bzr", "checkout"); + system('bzr', 'checkout'); chdir($old_cwd) || syserr(_g("unable to chdir to `%s'"), $old_cwd); diff --git a/scripts/Dpkg/Source/Package/V3/custom.pm b/scripts/Dpkg/Source/Package/V3/custom.pm index 9ba8d5874..475a7cf46 100644 --- a/scripts/Dpkg/Source/Package/V3/custom.pm +++ b/scripts/Dpkg/Source/Package/V3/custom.pm @@ -18,7 +18,7 @@ package Dpkg::Source::Package::V3::custom; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; use base 'Dpkg::Source::Package'; @@ -26,7 +26,7 @@ use Dpkg; use Dpkg::Gettext; use Dpkg::ErrorHandling; -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub parse_cmdline_option { my ($self, $opt) = @_; @@ -43,14 +43,14 @@ sub do_extract { sub can_build { my ($self, $dir) = @_; return (scalar(@{$self->{options}{ARGV}}), - _g("no files indicated on command line")); + _g('no files indicated on command line')); } sub do_build { my ($self, $dir) = @_; # Update real target format my $format = $self->{options}{target_format}; - error(_g("--target-format option is missing")) unless $format; + error(_g('--target-format option is missing')) unless $format; $self->{fields}{'Format'} = $format; # Add all files foreach my $file (@{$self->{options}{ARGV}}) { diff --git a/scripts/Dpkg/Source/Package/V3/git.pm b/scripts/Dpkg/Source/Package/V3/git.pm index 863576f86..5bb83ed3c 100644 --- a/scripts/Dpkg/Source/Package/V3/git.pm +++ b/scripts/Dpkg/Source/Package/V3/git.pm @@ -22,7 +22,7 @@ package Dpkg::Source::Package::V3::git; use strict; use warnings; -our $VERSION = "0.02"; +our $VERSION = '0.02'; use base 'Dpkg::Source::Package'; @@ -36,7 +36,7 @@ use Dpkg::ErrorHandling; use Dpkg::Exit; use Dpkg::Source::Functions qw(erasedir); -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; # Remove variables from the environment that might cause git to do # something unexpected. @@ -52,20 +52,20 @@ sub import { return 1; } } - error(_g("cannot unpack git-format source package because " . - "git is not in the PATH")); + error(_g('cannot unpack git-format source package because ' . + 'git is not in the PATH')); } sub sanity_check { my $srcdir = shift; if (! -d "$srcdir/.git") { - error(_g("source directory is not the top directory of a git " . - "repository (%s/.git not present), but Format git was " . - "specified"), $srcdir); + error(_g('source directory is not the top directory of a git ' . + 'repository (%s/.git not present), but Format git was ' . + 'specified'), $srcdir); } if (-s "$srcdir/.gitmodules") { - error(_g("git repository %s uses submodules; this is not yet supported"), + error(_g('git repository %s uses submodules; this is not yet supported'), $srcdir); } @@ -107,17 +107,17 @@ sub do_build { # To support dpkg-source -i, get a list of files # equivalent to the ones git status finds, and remove any # ignored files from it. - my @ignores = "--exclude-per-directory=.gitignore"; + my @ignores = '--exclude-per-directory=.gitignore'; my $core_excludesfile = `git config --get core.excludesfile`; chomp $core_excludesfile; if (length $core_excludesfile && -e $core_excludesfile) { push @ignores, "--exclude-from=$core_excludesfile"; } - if (-e ".git/info/exclude") { - push @ignores, "--exclude-from=.git/info/exclude"; + if (-e '.git/info/exclude') { + push @ignores, '--exclude-from=.git/info/exclude'; } - open(my $git_ls_files_fh, '-|', "git", "ls-files", "--modified", "--deleted", - "-z", "--others", @ignores) || subprocerr("git ls-files"); + open(my $git_ls_files_fh, '-|', 'git', 'ls-files', '--modified', '--deleted', + '-z', '--others', @ignores) || subprocerr('git ls-files'); my @files; { local $/ = "\0"; while (<$git_ls_files_fh>) { @@ -128,10 +128,10 @@ sub do_build { } } } - close($git_ls_files_fh) || syserr(_g("git ls-files exited nonzero")); + close($git_ls_files_fh) || syserr(_g('git ls-files exited nonzero')); if (@files) { - error(_g("uncommitted, not-ignored changes in working directory: %s"), - join(" ", @files)); + error(_g('uncommitted, not-ignored changes in working directory: %s'), + join(' ', @files)); } # If a depth was specified, need to create a shallow clone and @@ -146,29 +146,29 @@ sub do_build { my $clone_dir = "$tmp/repo.git"; # file:// is needed to avoid local cloning, which does not # create a shallow clone. - info(_g("creating shallow clone with depth %s"), + info(_g('creating shallow clone with depth %s'), $self->{options}{git_depth}); - system("git", "clone", "--depth=" . $self->{options}{git_depth}, - "--quiet", "--bare", "file://" . abs_path($dir), $clone_dir); - $? && subprocerr("git clone"); + system('git', 'clone', '--depth=' . $self->{options}{git_depth}, + '--quiet', '--bare', 'file://' . abs_path($dir), $clone_dir); + $? && subprocerr('git clone'); 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"); + system('cp', '-f', 'shallow', "$old_cwd/$shallowfile"); + $? && subprocerr('cp shallow'); } # Create the git bundle. my $bundlefile = "$basenamerev.git"; - 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", + 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, - "HEAD", # ensure HEAD is included no matter what - "--", # avoids ambiguity error when referring to eg, a debian branch + 'HEAD', # ensure HEAD is included no matter what + '--', # avoids ambiguity error when referring to eg, a debian branch ); - $? && subprocerr("git bundle"); + $? && subprocerr('git bundle'); chdir($old_cwd) || syserr(_g("unable to chdir to `%s'"), $old_cwd); @@ -198,35 +198,35 @@ sub do_extract { if (! defined $bundle) { $bundle = $file; } else { - error(_g("format v3.0 (git) uses only one .git file")); + error(_g('format v3.0 (git) uses only one .git file')); } } elsif ($file =~ /^\Q$basenamerev\E\.gitshallow$/) { if (! defined $shallow) { $shallow = $file; } else { - error(_g("format v3.0 (git) uses only one .gitshallow file")); + error(_g('format v3.0 (git) uses only one .gitshallow file')); } } else { - error(_g("format v3.0 (git) unknown file: %s", $file)); + error(_g('format v3.0 (git) unknown file: %s', $file)); } } if (! defined $bundle) { - error(_g("format v3.0 (git) expected %s"), "$basenamerev.git"); + error(_g('format v3.0 (git) expected %s'), "$basenamerev.git"); } erasedir($newdirectory); # Extract git bundle. - info(_g("cloning %s"), $bundle); - system("git", "clone", "--quiet", $dscdir.$bundle, $newdirectory); - $? && subprocerr("git bundle"); + info(_g('cloning %s'), $bundle); + system('git', 'clone', '--quiet', $dscdir . $bundle, $newdirectory); + $? && subprocerr('git bundle'); 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"); + info(_g('setting up shallow clone')); + system('cp', '-f', $dscdir . $shallow, "$newdirectory/.git/shallow"); + $? && subprocerr('cp'); } sanity_check($newdirectory); diff --git a/scripts/Dpkg/Source/Package/V3/native.pm b/scripts/Dpkg/Source/Package/V3/native.pm index 726bc3905..de706f39a 100644 --- a/scripts/Dpkg/Source/Package/V3/native.pm +++ b/scripts/Dpkg/Source/Package/V3/native.pm @@ -18,7 +18,7 @@ package Dpkg::Source::Package::V3::native; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; use base 'Dpkg::Source::Package'; @@ -34,7 +34,7 @@ use Cwd; use File::Basename; use File::Temp qw(tempfile); -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub do_extract { my ($self, $newdirectory) = @_; @@ -48,17 +48,17 @@ sub do_extract { my $tarfile; foreach my $file ($self->get_files()) { if ($file =~ /^\Q$basenamerev\E\.tar\.$compression_re_file_ext$/) { - error(_g("multiple tarfiles in v1.0 source package")) if $tarfile; + error(_g('multiple tarfiles in v1.0 source package')) if $tarfile; $tarfile = $file; } else { - error(_g("unrecognized file for a native source package: %s"), $file); + error(_g('unrecognized file for a native source package: %s'), $file); } } - error(_g("no tarfile in Files field")) unless $tarfile; + error(_g('no tarfile in Files field')) unless $tarfile; erasedir($newdirectory); - info(_g("unpacking %s"), $tarfile); + info(_g('unpacking %s'), $tarfile); my $tar = Dpkg::Source::Archive->new(filename => "$dscdir$tarfile"); $tar->extract($newdirectory); } @@ -81,7 +81,7 @@ sub do_build { my $basenamerev = $self->get_basename(1); my $tarname = "$basenamerev.tar." . $self->{options}{comp_ext}; - info(_g("building %s in %s"), $sourcepackage, $tarname); + info(_g('building %s in %s'), $sourcepackage, $tarname); my ($ntfh, $newtar) = tempfile("$tarname.new.XXXXXX", DIR => getcwd(), UNLINK => 0); diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm index 7ebee244f..bca916b6b 100644 --- a/scripts/Dpkg/Source/Package/V3/quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/quilt.pm @@ -18,7 +18,7 @@ package Dpkg::Source::Package::V3::quilt; use strict; use warnings; -our $VERSION = "0.01"; +our $VERSION = '0.01'; # Based on wig&pen implementation use base 'Dpkg::Source::Package::V2'; @@ -34,7 +34,7 @@ use Dpkg::Exit; use File::Spec; use File::Copy; -our $CURRENT_MINOR_VERSION = "0"; +our $CURRENT_MINOR_VERSION = '0'; sub init_options { my ($self) = @_; @@ -75,15 +75,15 @@ sub can_build { my $quilt = $self->build_quilt_object($dir); $msg = $quilt->find_problems(); return (0, $msg) if $msg; - return (1, ""); + return (1, ''); } sub get_autopatch_name { my ($self) = @_; if ($self->{options}{single_debian_patch}) { - return "debian-changes"; + return 'debian-changes'; } else { - return "debian-changes-" . $self->{fields}{'Version'}; + return 'debian-changes-' . $self->{fields}{'Version'}; } } @@ -107,8 +107,8 @@ sub apply_patches { # Update debian/patches/series symlink if needed to allow quilt usage my $series = $quilt->get_series_file(); my $basename = (File::Spec->splitpath($series))[2]; - if ($basename ne "series") { - my $dest = $quilt->get_patch_file("series"); + if ($basename ne 'series') { + my $dest = $quilt->get_patch_file('series'); unlink($dest) if -l $dest; unless (-f _) { # Don't overwrite real files symlink($basename, $dest) || @@ -118,18 +118,18 @@ sub apply_patches { return unless scalar($quilt->series()); - if ($opts{usage} eq "preparation" and + 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"); - open(my $unapply_fh, ">", $pc_unapply) || - syserr(_g("cannot write %s"), $pc_unapply); + my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply'); + open(my $unapply_fh, '>', $pc_unapply) || + syserr(_g('cannot write %s'), $pc_unapply); close($unapply_fh); } # Apply patches - my $pc_applied = $quilt->get_db_file("applied-patches"); + my $pc_applied = $quilt->get_db_file('applied-patches'); $opts{timestamp} = fs_time($pc_applied); if ($opts{skip_auto}) { my $auto_patch = $self->get_autopatch_name(); @@ -146,7 +146,7 @@ sub unapply_patches { $opts{verbose} //= 1; - my $pc_applied = $quilt->get_db_file("applied-patches"); + my $pc_applied = $quilt->get_db_file('applied-patches'); my @applied = $quilt->applied(); $opts{timestamp} = fs_time($pc_applied) if @applied; @@ -180,9 +180,9 @@ sub do_build { if (scalar grep { $version eq $_ } @{$self->{options}{allow_version_of_quilt_db}}) { - warning(_g("unsupported version of the quilt metadata: %s"), $version); + warning(_g('unsupported version of the quilt metadata: %s'), $version); } else { - error(_g("unsupported version of the quilt metadata: %s"), $version); + error(_g('unsupported version of the quilt metadata: %s'), $version); } } @@ -192,9 +192,9 @@ sub do_build { sub after_build { my ($self, $dir) = @_; my $quilt = $self->build_quilt_object($dir); - my $pc_unapply = $quilt->get_db_file(".dpkg-source-unapply"); + my $pc_unapply = $quilt->get_db_file('.dpkg-source-unapply'); my $opt_unapply = $self->{options}{unapply_patches}; - if (($opt_unapply eq "auto" and -e $pc_unapply) or $opt_unapply eq "yes") { + if (($opt_unapply eq 'auto' and -e $pc_unapply) or $opt_unapply eq 'yes') { unlink($pc_unapply); $self->unapply_patches($dir); } @@ -207,7 +207,7 @@ sub check_patches_applied { my $next = $quilt->next(); return if not defined $next; - my $first_patch = File::Spec->catfile($dir, "debian", "patches", $next); + my $first_patch = File::Spec->catfile($dir, 'debian', 'patches', $next); my $patch_obj = Dpkg::Source::Patch->new(filename => $first_patch); return unless $patch_obj->check_apply($dir); @@ -217,7 +217,7 @@ sub check_patches_applied { sub _add_line { my ($file, $line) = @_; - open(my $file_fh, ">>", $file) || syserr(_g("cannot write %s"), $file); + open(my $file_fh, '>>', $file) || syserr(_g('cannot write %s'), $file); print $file_fh "$line\n"; close($file_fh); } @@ -225,10 +225,10 @@ sub _add_line { sub _drop_line { my ($file, $re) = @_; - open(my $file_fh, "<", $file) || syserr(_g("cannot read %s"), $file); + open(my $file_fh, '<', $file) || syserr(_g('cannot read %s'), $file); my @lines = <$file_fh>; close($file_fh); - open($file_fh, ">", $file) || syserr(_g("cannot write %s"), $file); + open($file_fh, '>', $file) || syserr(_g('cannot write %s'), $file); print($file_fh $_) foreach grep { not /^\Q$re\E\s*$/ } @lines; close($file_fh); } @@ -241,16 +241,16 @@ sub register_patch { my @patches = $quilt->series(); my $has_patch = (grep { $_ eq $patch_name } @patches) ? 1 : 0; my $series = $quilt->get_series_file(); - my $applied = $quilt->get_db_file("applied-patches"); + my $applied = $quilt->get_db_file('applied-patches'); my $patch = $quilt->get_patch_file($patch_name); if (-s $tmpdiff) { copy($tmpdiff, $patch) || - syserr(_g("failed to copy %s to %s"), $tmpdiff, $patch); + syserr(_g('failed to copy %s to %s'), $tmpdiff, $patch); chmod(0666 & ~ umask(), $patch) || syserr(_g("unable to change permission of `%s'"), $patch); } elsif (-e $patch) { - unlink($patch) || syserr(_g("cannot remove %s"), $patch); + unlink($patch) || syserr(_g('cannot remove %s'), $patch); } if (-e $patch) { |