summaryrefslogtreecommitdiff
path: root/scripts/dpkg-gencontrol.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/dpkg-gencontrol.pl')
-rwxr-xr-xscripts/dpkg-gencontrol.pl98
1 files changed, 49 insertions, 49 deletions
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index f032b6138..16afebb44 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -37,7 +37,7 @@ use Dpkg::Substvars;
use Dpkg::Vars;
use Dpkg::Changelog::Parse;
-textdomain("dpkg-dev");
+textdomain('dpkg-dev');
my $controlfile = 'debian/control';
@@ -61,17 +61,17 @@ my $substvars_loaded = 0;
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>...]")
+'Usage: %s [<option>...]')
. "\n\n" . _g(
-"Options:
+'Options:
-p<package> print control file for package.
-c<control-file> get control info from this file.
-l<changelog-file> get per-version info from this file.
@@ -88,7 +88,7 @@ sub usage {
-T<substvars-file> read variables here, not debian/substvars.
-?, --help show this help message.
--version show the version.
-"), $progname;
+'), $progname;
}
while (@ARGV) {
@@ -139,47 +139,47 @@ umask 0022; # ensure sane default permissions for created files
my %options = (file => $changelogfile);
$options{changelogformat} = $changelogformat if $changelogformat;
my $changelog = changelog_parse(%options);
-if ($changelog->{"Binary-Only"}) {
+if ($changelog->{'Binary-Only'}) {
$options{count} = 1;
$options{offset} = 1;
my $prev_changelog = changelog_parse(%options);
- $sourceversion = $prev_changelog->{"Version"};
+ $sourceversion = $prev_changelog->{'Version'};
} else {
- $sourceversion = $changelog->{"Version"};
+ $sourceversion = $changelog->{'Version'};
}
if (defined $forceversion) {
$binaryversion = $forceversion;
} else {
- $binaryversion = $changelog->{"Version"};
+ $binaryversion = $changelog->{'Version'};
}
$substvars->set_version_substvars($sourceversion, $binaryversion);
$substvars->set_arch_substvars();
-$substvars->load("debian/substvars") if -e "debian/substvars" and not $substvars_loaded;
+$substvars->load('debian/substvars') if -e 'debian/substvars' and not $substvars_loaded;
my $control = Dpkg::Control::Info->new($controlfile);
my $fields = Dpkg::Control->new(type => CTRL_PKG_DEB);
# Old-style bin-nmus change the source version submitted to
# set_version_substvars()
-$sourceversion = $substvars->get("source:Version");
+$sourceversion = $substvars->get('source:Version');
my $pkg;
if (defined($oppackage)) {
$pkg = $control->get_pkg_by_name($oppackage);
- defined($pkg) || error(_g("package %s not in control info"), $oppackage);
+ defined($pkg) || error(_g('package %s not in control info'), $oppackage);
} else {
my @packages = map { $_->{'Package'} } $control->get_packages();
if (@packages == 0) {
- error(_g("no package stanza found in control info"));
+ error(_g('no package stanza found in control info'));
} elsif (@packages > 1) {
- error(_g("must specify package since control info has many (%s)"),
+ error(_g('must specify package since control info has many (%s)'),
"@packages");
}
$pkg = $control->get_pkg_by_idx(1);
}
-$substvars->set_msg_prefix(sprintf(_g("package %s: "), $pkg->{Package}));
+$substvars->set_msg_prefix(sprintf(_g('package %s: '), $pkg->{Package}));
# Scan source package
my $src_fields = $control->get_source();
@@ -244,8 +244,8 @@ $fields->{'Version'} = $binaryversion;
my $facts = Dpkg::Deps::KnownFacts->new();
$facts->add_installed_package($fields->{'Package'}, $fields->{'Version'},
$fields->{'Architecture'}, $fields->{'Multi-Arch'});
-if (exists $pkg->{"Provides"}) {
- my $provides = deps_parse($substvars->substvars($pkg->{"Provides"}, no_warn => 1),
+if (exists $pkg->{'Provides'}) {
+ my $provides = deps_parse($substvars->substvars($pkg->{'Provides'}, no_warn => 1),
reduce_arch => 1, union => 1);
if (defined $provides) {
foreach my $subdep ($provides->get_deps()) {
@@ -261,15 +261,15 @@ if (exists $pkg->{"Provides"}) {
my (@seen_deps);
foreach my $field (field_list_pkg_dep()) {
# Arch: all can't be simplified as the host architecture is not known
- my $reduce_arch = debarch_eq('all', $pkg->{Architecture} || "all") ? 0 : 1;
+ my $reduce_arch = debarch_eq('all', $pkg->{Architecture} || 'all') ? 0 : 1;
if (exists $pkg->{$field}) {
my $dep;
my $field_value = $substvars->substvars($pkg->{$field},
- msg_prefix => sprintf(_g("%s field of package %s: "), $field, $pkg->{Package}));
+ msg_prefix => sprintf(_g('%s field of package %s: '), $field, $pkg->{Package}));
if (field_get_dep_type($field) eq 'normal') {
$dep = deps_parse($field_value, use_arch => 1,
reduce_arch => $reduce_arch);
- error(_g("error occurred while parsing %s field: %s"), $field,
+ error(_g('error occurred while parsing %s field: %s'), $field,
$field_value) unless defined $dep;
$dep->simplify_deps($facts, @seen_deps);
# Remember normal deps to simplify even further weaker deps
@@ -277,13 +277,13 @@ foreach my $field (field_list_pkg_dep()) {
} else {
$dep = deps_parse($field_value, use_arch => 1,
reduce_arch => $reduce_arch, union => 1);
- error(_g("error occurred while parsing %s field: %s"), $field,
+ error(_g('error occurred while parsing %s field: %s'), $field,
$field_value) unless defined $dep;
$dep->simplify_deps($facts);
$dep->sort();
}
- error(_g("the %s field contains an arch-specific dependency but the " .
- "package is architecture all"), $field)
+ error(_g('the %s field contains an arch-specific dependency but the ' .
+ 'package is architecture all'), $field)
if $dep->has_arch_restriction();
$fields->{$field} = $dep->output();
delete $fields->{$field} unless $fields->{$field}; # Delete empty field
@@ -291,10 +291,10 @@ foreach my $field (field_list_pkg_dep()) {
}
for my $f (qw(Package Version)) {
- defined($fields->{$f}) || error(_g("missing information for output field %s"), $f);
+ defined($fields->{$f}) || error(_g('missing information for output field %s'), $f);
}
for my $f (qw(Maintainer Description Architecture)) {
- defined($fields->{$f}) || warning(_g("missing information for output field %s"), $f);
+ defined($fields->{$f}) || warning(_g('missing information for output field %s'), $f);
}
$oppackage = $fields->{'Package'};
@@ -306,7 +306,7 @@ if ($pkg_type eq 'udeb') {
delete $fields->{'Homepage'};
} else {
for my $f (qw(Subarchitecture Kernel-Version Installer-Menu-Item)) {
- warning(_g("%s package with udeb specific field %s"), $pkg_type, $f)
+ warning(_g('%s package with udeb specific field %s'), $pkg_type, $f)
if defined($fields->{$f});
}
}
@@ -314,17 +314,17 @@ if ($pkg_type eq 'udeb') {
my $verdiff = $binaryversion ne $sourceversion;
if ($oppackage ne $sourcepackage || $verdiff) {
$fields->{'Source'} = $sourcepackage;
- $fields->{'Source'} .= " (" . $sourceversion . ")" if $verdiff;
+ $fields->{'Source'} .= ' (' . $sourceversion . ')' if $verdiff;
}
if (!defined($substvars->get('Installed-Size'))) {
my $du_fh;
- defined(my $c = open($du_fh, "-|")) || syserr(_g("cannot fork for %s"), "du");
+ defined(my $c = open($du_fh, '-|')) || syserr(_g('cannot fork for %s'), 'du');
if (!$c) {
chdir("$packagebuilddir") ||
syserr(_g("chdir for du to \`%s'"), $packagebuilddir);
- exec("du", "-k", "-s", "--apparent-size", ".") or
- syserr(_g("unable to execute %s"), "du");
+ exec('du', '-k', '-s', '--apparent-size', '.') or
+ syserr(_g('unable to execute %s'), 'du');
}
my $duo = '';
while (<$du_fh>) {
@@ -354,52 +354,52 @@ for my $f (keys %remove) {
# 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"));
+open(my $fileslistnew_fh, '>', "$fileslistfile.new") ||
+ syserr(_g('open new files list file'));
binmode($fileslistnew_fh);
-if (open(my $fileslist_fh, "<", $fileslistfile)) {
+if (open(my $fileslist_fh, '<', $fileslistfile)) {
binmode($fileslist_fh);
while (<$fileslist_fh>) {
chomp;
next if m/^([-+0-9a-z.]+)_[^_]+_([\w-]+)\.(a-z+) /
&& ($1 eq $oppackage)
&& ($3 eq $pkg_type)
- && (debarch_eq($2, $fields->{'Architecture'} || "")
+ && (debarch_eq($2, $fields->{'Architecture'} || '')
|| debarch_eq($2, 'all'));
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) || syserr(_g("close old files list file"));
+ close($fileslist_fh) || syserr(_g('close old files list file'));
} elsif ($! != ENOENT) {
- syserr(_g("read old files list file"));
+ syserr(_g('read old files list file'));
}
my $sversion = $fields->{'Version'};
$sversion =~ s/^\d+://;
-$forcefilename //= sprintf("%s_%s_%s.%s", $oppackage, $sversion,
- $fields->{'Architecture'} || "", $pkg_type);
+$forcefilename //= sprintf('%s_%s_%s.%s', $oppackage, $sversion,
+ $fields->{'Architecture'} || '', $pkg_type);
print($fileslistnew_fh $substvars->substvars(sprintf("%s %s %s\n",
$forcefilename,
$fields->{'Section'} || '-',
$fields->{'Priority'} || '-')))
- || 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('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'));
# Release the lock
-close($lockfh) || syserr(_g("cannot close %s"), "debian/control");
+close($lockfh) || syserr(_g('cannot close %s'), 'debian/control');
my $cf;
my $fh_output;
if (!$stdout) {
$cf= "$packagebuilddir/DEBIAN/control";
$cf= "./$cf" if $cf =~ m/^\s/;
- open($fh_output, ">", "$cf.new") ||
+ open($fh_output, '>', "$cf.new") ||
syserr(_g("cannot open new output control file \`%s'"), "$cf.new");
} else {
$fh_output = \*STDOUT;
@@ -409,7 +409,7 @@ $fields->apply_substvars($substvars);
$fields->output($fh_output);
if (!$stdout) {
- close($fh_output) || syserr(_g("cannot close %s"), "$cf.new");
+ close($fh_output) || syserr(_g('cannot close %s'), "$cf.new");
rename("$cf.new", "$cf") ||
syserr(_g("cannot install output control file \`%s'"), $cf);
}