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-distaddfile.pl | |
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-distaddfile.pl')
-rwxr-xr-x | scripts/dpkg-distaddfile.pl | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/scripts/dpkg-distaddfile.pl b/scripts/dpkg-distaddfile.pl index 1229b22fa..272f75435 100755 --- a/scripts/dpkg-distaddfile.pl +++ b/scripts/dpkg-distaddfile.pl @@ -27,7 +27,7 @@ use Dpkg::Gettext; use Dpkg::ErrorHandling; use Dpkg::File; -textdomain("dpkg-dev"); +textdomain('dpkg-dev'); my $fileslistfile = 'debian/files'; @@ -35,21 +35,21 @@ my $fileslistfile = 'debian/files'; sub version { printf _g("Debian %s version %s.\n"), $progname, $version; - printf _g(" + printf _g(' This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty. -"); +'); } sub usage { printf _g( -"Usage: %s [<option>...] <filename> <section> <priority> +'Usage: %s [<option>...] <filename> <section> <priority> Options: -f<files-list-file> write files here instead of debian/files. -?, --help show this help message. --version show the version. -"), $progname; +'), $progname; } while (@ARGV && $ARGV[0] =~ m/^-/) { @@ -69,38 +69,38 @@ while (@ARGV && $ARGV[0] =~ m/^-/) { } } -@ARGV == 3 || usageerr(_g("need exactly a filename, section and priority")); +@ARGV == 3 || usageerr(_g('need exactly a filename, section and priority')); my ($file, $section, $priority) = @ARGV; ($file =~ m/\s/ || $section =~ m/\s/ || $priority =~ m/\s/) && - error(_g("filename, section and priority may contain no whitespace")); + error(_g('filename, section and priority may contain no whitespace')); # Obtain a lock on debian/control to avoid simultaneous updates # of debian/files when parallel building is in use my $lockfh; -sysopen($lockfh, "debian/control", O_WRONLY) || - syserr(_g("cannot write %s"), "debian/control"); -file_lock($lockfh, "debian/control"); +sysopen($lockfh, 'debian/control', O_WRONLY) || + syserr(_g('cannot write %s'), 'debian/control'); +file_lock($lockfh, 'debian/control'); $fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/; open(my $fileslistnew_fh, '>', "$fileslistfile.new") || - syserr(_g("open new files list file")); + syserr(_g('open new files list file')); if (open(my $fileslist_fh, '<', $fileslistfile)) { while (<$fileslist_fh>) { s/\n$//; next if m/^(\S+) / && $1 eq $file; print($fileslistnew_fh "$_\n") || - syserr(_g("copy old entry to new files list file")); + syserr(_g('copy old entry to new files list file')); } close $fileslist_fh or syserr(_g('cannot close %s'), $fileslistfile); } elsif ($! != ENOENT) { - syserr(_g("read old files list file")); + syserr(_g('read old files list file')); } print($fileslistnew_fh "$file $section $priority\n") - || syserr(_g("write new entry to new files list file")); -close($fileslistnew_fh) || syserr(_g("close new files list file")); + || syserr(_g('write new entry to new files list file')); +close($fileslistnew_fh) || syserr(_g('close new files list file')); rename("$fileslistfile.new", $fileslistfile) || - syserr(_g("install new files list file")); + syserr(_g('install new files list file')); # Release the lock -close($lockfh) || syserr(_g("cannot close %s"), "debian/control"); +close($lockfh) || syserr(_g('cannot close %s'), 'debian/control'); |