+2007-04-03 Guillem Jover <guillem@debian.org>
+
+ * scripts/controllib.pl (warn): Rename to ...
+ (warning): ... this, to avoid collisions with the perl builtin. Fix
+ all users.
+
2007-04-03 Guillem Jover <guillem@debian.org>
* scripts/controllib.pl: Use defined instead of length, when variables
@ARGV && die _g("Usage: 822-date")."\n";
-&warn(_g("This program is deprecated. Please use 'date -R' instead."));
+warning(_g("This program is deprecated. Please use 'date -R' instead."));
print `date -R`;
die(sprintf(_g('unable to get login information for username "%s"'), $getlogin));
}
} else {
- &warn (sprintf(_g('no utmp entry available and LOGNAME not defined; using uid of process (%d)'), $<));
+ warning(sprintf(_g('no utmp entry available and LOGNAME not defined; using uid of process (%d)'), $<));
@fowner = getpwuid($<);
if (!@fowner) {
die (sprintf(_g('unable to get login information for uid %d'), $<));
$v= $lhs.$substvar{$vn}.$rhs;
$count++;
} else {
- &warn(sprintf(_g("unknown substitution variable \${%s}"), $vn));
+ warning(sprintf(_g("unknown substitution variable \${%s}"), $vn));
$v= $lhs.$rhs;
}
}
}
}
if (length($dep_or)) {
- &warn(sprintf(_g("can't parse dependency %s"),$dep_and));
+ warning(sprintf(_g("can't parse dependency %s"), $dep_and));
return undef;
}
push @or_list, [ $package, $relation, $version, \@arches ];
sub unknown {
my $field = $_;
- &warn(sprintf(_g("unknown information field \`%s\' in input data in %s"), $field, $_[0]));
+ warning(sprintf(_g("unknown information field '%s' in input data in %s"),
+ $field, $_[0]));
}
sub syntax {
sub syserr { die sprintf(_g("%s: failure: %s: %s"), $progname, $_[0], $!)."\n"; }
sub error { die sprintf(_g("%s: error: %s"), $progname, $_[0])."\n"; }
sub internerr { die sprintf(_g("%s: internal error: %s"), $progname, $_[0])."\n"; }
-sub warn { if (!$quiet_warnings) { warn sprintf(_g("%s: warning: %s"), $progname, $_[0])."\n"; } }
+
+sub warning
+{
+ if (!$quiet_warnings) {
+ warn sprintf(_g("%s: warning: %s"), $progname, $_[0])."\n";
+ }
+}
+
sub usageerr
{
printf(STDERR "%s: %s\n\n", $progname, "@_");
&usage;
exit(2);
}
-sub warnerror { if ($warnable_error) { &warn( @_ ); } else { &error( @_ ); } }
+
+sub warnerror
+{
+ if ($warnable_error) {
+ warning(@_);
+ } else {
+ error(@_);
+ }
+}
sub subprocerr {
local ($p) = @_;
# Default host: Current gcc.
$gcc = `\${CC:-gcc} -dumpmachine`;
if ($?>>8) {
- &warn(_g("Couldn't determine gcc system type, falling back to default (native compilation)"));
+ warning(_g("Couldn't determine gcc system type, falling back to default (native compilation)"));
$gcc = '';
} else {
chomp $gcc;
if ($gcc ne '') {
$deb_host_arch = &gnu_to_debian($gcc);
unless (defined $deb_host_arch) {
- &warn (sprintf(_g("Unknown gcc system type %s, falling back to default (native compilation)"), $gcc));
+ warning(sprintf(_g("Unknown gcc system type %s, falling back to default (native compilation)"), $gcc));
$gcc = '';
} else {
$gcc = $deb_host_gnu_type = &debian_to_gnu($deb_host_arch);
if ($req_host_gnu_type ne '' && $req_host_arch ne '') {
$dfl_host_gnu_type = &debian_to_gnu ($req_host_arch);
- &warn(sprintf(_g("Default GNU system type %s for Debian arch %s does not match specified GNU system type %s"), $dfl_host_gnu_type, $req_host_arch, $req_host_gnu_type)) if $dfl_host_gnu_type ne $req_host_gnu_type;
+ warning(sprintf(_g("Default GNU system type %s for Debian arch %s does not match specified GNU system type %s"), $dfl_host_gnu_type, $req_host_arch, $req_host_gnu_type)) if $dfl_host_gnu_type ne $req_host_gnu_type;
}
$deb_host_arch = $req_host_arch if $req_host_arch ne '';
#$gcc = `\${CC:-gcc} --print-libgcc-file-name`;
#$gcc =~ s!^.*gcc-lib/(.*)/\d+(?:.\d+)*/libgcc.*$!$1!s;
-&warn(sprintf(_g("Specified GNU system type %s does not match gcc system type %s."), $deb_host_gnu_type, $gcc)) if !($req_is_arch or $req_eq_arch) && ($gcc ne '') && ($gcc ne $deb_host_gnu_type);
+warning(sprintf(_g("Specified GNU system type %s does not match gcc system type %s."), $deb_host_gnu_type, $gcc)) if !($req_is_arch or $req_eq_arch) && ($gcc ne '') && ($gcc ne $deb_host_gnu_type);
# Split the Debian and GNU names
($deb_host_arch_os, $deb_host_arch_cpu) = &split_debian($deb_host_arch);
while(<FL>) {
if (m/^(([-+.0-9a-z]+)_([^_]+)_([-\w]+)\.u?deb) (\S+) (\S+)$/) {
defined($p2f{"$2 $4"}) &&
- &warn(sprintf(_g("duplicate files list entry for package %s (line %d)"), $2, $.));
+ warning(sprintf(_g("duplicate files list entry for package %s (line %d)"), $2, $.));
$f2p{$1}= $2;
$p2f{"$2 $4"}= $1;
$p2f{$2}= $1;
$p2ver{$2}= $3;
defined($f2sec{$1}) &&
- &warn(sprintf(_g("duplicate files list entry for file %s (line %d)"), $1, $.));
+ warning(sprintf(_g("duplicate files list entry for file %s (line %d)"), $1, $.));
$f2sec{$1}= $5;
$f2pri{$1}= $6;
push(@fileslistfiles,$1);
push(@fileslistfiles,$1);
} elsif (m/^([-+.,_0-9a-zA-Z]+) (\S+) (\S+)$/) {
defined($f2sec{$1}) &&
- &warn(sprintf(_g("duplicate files list entry for file %s (line %d)"), $1, $.));
+ warning(sprintf(_g("duplicate files list entry for file %s (line %d)"), $1, $.));
$f2sec{$1}= $2;
$f2pri{$1}= $3;
push(@fileslistfiles,$1);
if ((debian_arch_eq('all', $a) && !$archspecific) ||
debian_arch_is($arch, $a) ||
grep(debian_arch_is($arch, $_), split(/\s+/, $a))) {
- &warn(sprintf(_g("package %s in control file but not in files list"), $p));
+ warning(sprintf(_g("package %s in control file but not in files list"), $p));
next;
}
} else {
for $p (keys %p2f) {
my ($pp, $aa) = (split / /, $p);
defined($p2i{"C $pp"}) ||
- &warn(sprintf(_g("package %s listed in files list but not in control info"), $pp));
+ warning(sprintf(_g("package %s listed in files list but not in control info"), $pp));
}
for $p (keys %p2f) {
$sec = $sourcedefault{'Section'} if !defined($sec);
if (!defined($sec)) {
$sec = '-';
- &warn(sprintf(_g("missing Section for binary package %s; using '-'"), $p));
+ warning(sprintf(_g("missing Section for binary package %s; using '-'"), $p));
}
$sec eq $f2sec{$f} || &error(sprintf(_g("package %s has section %s in ".
"control file but %s in files list"),
$pri = $sourcedefault{'Priority'} if !defined($pri);
if (!defined($pri)) {
$pri = '-';
- &warn("missing Priority for binary package $p; using '-'");
+ warning("missing Priority for binary package $p; using '-'");
}
$pri eq $f2pri{$f} || &error(sprintf(_g("package %s has priority %s in ".
"control file but %s in files list"),
$sec= $sourcedefault{'Section'};
if (!defined($sec)) {
$sec = '-';
- &warn(_g("missing Section for source files"));
+ warning(_g("missing Section for source files"));
}
$pri= $sourcedefault{'Priority'};
if (!defined($pri)) {
$pri = '-';
- &warn(_g("missing Priority for source files"));
+ warning(_g("missing Priority for source files"));
}
($sversion = $substvar{'source:Version'}) =~ s/^\d+://;
@sourcefiles= grep(!m/\.orig\.tar\.gz$/,@sourcefiles);
} else {
if ($sourcestyle =~ m/d/ && !grep(m/\.diff\.gz$/,@sourcefiles)) {
- &warn(_g("Ignoring -sd option for native Debian package"));
+ warning(_g("ignoring -sd option for native Debian package"));
}
$origsrcmsg= _g("including full source code in upload");
}
$uf= "$uploadfilesdir/$f";
open(STDIN,"< $uf") || &syserr(sprintf(_g("cannot open upload file %s for reading"), $uf));
(@s=stat(STDIN)) || &syserr(sprintf(_g("cannot fstat upload file %s"), $uf));
- $size= $s[7]; $size || &warn(sprintf(_g("upload file %s is empty"), $uf));
+ $size= $s[7]; $size || warning(sprintf(_g("upload file %s is empty"), $uf));
$md5sum=`md5sum`; $? && subprocerr(sprintf(_g("md5sum upload file %s"), $uf));
$md5sum =~ m/^([0-9a-f]{32})\s*-?\s*$/i ||
&failure(sprintf(_g("md5sum upload file %s gave strange output \`%s'"), $uf, $md5sum));
}
for $f (qw(Urgency)) {
- defined($f{$f}) || &warn(sprintf(_g("missing information for output field %s"), $f));
+ defined($f{$f}) || warning(sprintf(_g("missing information for output field %s"), $f));
}
for $f (keys %override) { $f{&capit($f)}= $override{$f}; }
} else {
@archlist= split(/\s+/,$v);
my @invalid_archs = grep m/[^\w-]/, @archlist;
- &warn(sprintf(ngettext(
+ warning(sprintf(ngettext(
"`%s' is not a legal architecture string.",
"`%s' are not legal architecture strings.",
scalar(@invalid_archs)),
defined($f{$f}) || &error(sprintf(_g("missing information for output field %s"), $f));
}
for $f (qw(Maintainer Description Architecture)) {
- defined($f{$f}) || &warn(sprintf(_g("missing information for output field %s"), $f));
+ defined($f{$f}) || warning(sprintf(_g("missing information for output field %s"), $f));
}
$oppackage= $f{'Package'};
if (!stat("$pa")) {
$! == ENOENT || &syserr(sprintf(_g("failed to check for format parser %s"), $pa));
} elsif (!-x _) {
- &warn(sprintf(_g("format parser %s not executable"), $pa));
+ warning(sprintf(_g("format parser %s not executable"), $pa));
} else {
$pf= $pa;
last;
} elsif (m/^-d/) {
$dependencyfield= capit($POSTMATCH);
defined($depstrength{$dependencyfield}) ||
- &warn(sprintf(_g("unrecognised dependency field \`%s'"), $dependencyfield));
+ warning(sprintf(_g("unrecognised dependency field '%s'"), $dependencyfield));
} elsif (m/^-e/) {
push(@exec,$POSTMATCH); push(@execfield,$dependencyfield);
} elsif (m/^-t/) {
}
open CONF, '</etc/ld.so.conf' or
- warn( sprintf(_g("couldn't open /etc/ld.so.conf: %s" ), $!));
+ warning(sprintf(_g("couldn't open /etc/ld.so.conf: %s"), $!));
while( <CONF> ) {
next if /^\s*$/;
chomp;
push(@libexec,$exec[$i]);
} else {
m,^\s*NEEDED\s+(\S+)$,;
- &warn(sprintf(_g("format of \`NEEDED %s' not recognized"), $1));
+ warning(sprintf(_g("format of 'NEEDED %s' not recognized"), $1));
}
} elsif (/^\s*RPATH\s+(\S+)\s*$/) {
push @{$rpaths{$exec[$i]}}, $1;
while (<P>) {
chomp;
if (m/^local diversion |^diversion by/) {
- &warn(_g("diversions involved - output may be incorrect"));
+ warning(_g("diversions involved - output may be incorrect"));
print(STDERR " $_\n") || syserr(_g("write diversion info to stderr"));
} elsif (m=^(\S+(, \S+)*): (\S+)$=) {
push @{$pathpackages{$LAST_PAREN_MATCH}}, split(/, /, $1);
} else {
- &warn(sprintf(_g("unknown output from dpkg --search: \`%s'"), $_));
+ warning(sprintf(_g("unknown output from dpkg --search: '%s'"), $_));
}
}
close(P);
}
}
if (!@packages) {
- &warn(sprintf(_g("could not find any packages for %s"), $libfiles[$i]));
+ warning(sprintf(_g("could not find any packages for %s"), $libfiles[$i]));
} else {
for my $p (@packages) {
scanshlibsfile("$shlibsppdir/$p$shlibsppext",
}
scanshlibsfile($shlibsdefault,$libname[$i],$libsoname[$i],$libfield[$i])
&& next;
- &warn(sprintf(_g("unable to find dependency information for ".
- "shared library %s (soname %s, ".
- "path %s, dependency field %s)"),
- $libname[$i], $libsoname[$i],
- $libfiles[$i], $libfield[$i]));
+ warning(sprintf(_g("unable to find dependency information for ".
+ "shared library %s (soname %s, ".
+ "path %s, dependency field %s)"),
+ $libname[$i], $libsoname[$i],
+ $libfiles[$i], $libfield[$i]));
}
sub format_matches {
while (<SLF>) {
s/\s*\n$//; next if m/^\#/;
if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)/) {
- &warn(sprintf(_g("shared libs info file \`%s' line %d: bad line \`%s'"), $fn, $., $_));
+ warning(sprintf(_g("shared libs info file '%s' line %d: bad line '%s'"), $fn, $., $_));
next;
}
next if defined $1 && $1 ne $packagetype;
} elsif (m/^-x$/) {
&setopmode('extract');
} elsif (m/^-s([akpursnAKPUR])$/) {
- &warn( sprintf(_g("-s%s option overrides earlier -s%s option" ), $1, $sourcestyle))
+ warning(sprintf(_g("-s%s option overrides earlier -s%s option"), $1, $sourcestyle))
if $sourcestyle ne 'X';
$sourcestyle= $1;
} elsif (m/^-c/) {
defined($f{$f}) || &error(sprintf(_g("missing information for critical output field %s"), $f));
}
for $f (qw(Maintainer Architecture Standards-Version)) {
- defined($f{$f}) || &warn(sprintf(_g("missing information for output field %s"), $f));
+ defined($f{$f}) ||
+ warning(sprintf(_g("missing information for output field %s"), $f));
}
defined($sourcepackage) || &error(_g("unable to determine source package name !"));
$f{'Source'}= $sourcepackage;
}
}
$dirbase= $dir; $dirbase =~ s,/?$,,; $dirbase =~ s,[^/]+$,,; $dirname= $&;
- $dirname eq $basedirname || &warn(sprintf(_g("source directory `%s' is not <sourcepackage>".
- "-<upstreamversion> `%s'"), $dir, $basedirname));
-
+ $dirname eq $basedirname ||
+ warning(sprintf(_g("source directory '%s' is not <sourcepackage>" .
+ "-<upstreamversion> '%s'"), $dir, $basedirname));
+
if ($sourcestyle ne 'n') {
$origdirbase= $origdir; $origdirbase =~ s,/?$,,;
$origdirbase =~ s,[^/]+$,,; $origdirname= $&;
$origdirname eq "$basedirname.orig" ||
- &warn(sprintf(_g(".orig directory name %s is not <package>".
- "-<upstreamversion> (wanted %s)"),
- $origdirname, "$basedirname.orig"));
+ warning(sprintf(_g(".orig directory name %s is not <package>" .
+ "-<upstreamversion> (wanted %s)"),
+ $origdirname, "$basedirname.orig"));
$tardirbase= $origdirbase; $tardirname= $origdirname;
$tarname= $origtargz;
$tarname eq "$basename.orig.tar.gz" ||
- &warn(sprintf(_g(".orig.tar.gz name %s is not <package>_<upstreamversion>".
- ".orig.tar.gz (wanted %s)"), $tarname, "$basename.orig.tar.gz"));
+ warning(sprintf(_g(".orig.tar.gz name %s is not <package>_<upstreamversion>" .
+ ".orig.tar.gz (wanted %s)"), $tarname, "$basename.orig.tar.gz"));
} else {
$tardirbase= $dirbase; $tardirname= $dirname;
$tarname= "$basenamerev.tar.gz";
$! == ENOENT || &syserr(sprintf(_g("cannot stat orig file %s"), "$origdir/$fn"));
$ofnread= '/dev/null';
if( $mode & ( S_IXUSR | S_IXGRP | S_IXOTH ) ) {
- &warn( sprintf( _g("executable mode %04o of `%s' will not be represented in diff"), $mode, $fn ) )
+ warning(sprintf(_g("executable mode %04o of '%s' will not be represented in diff"), $mode, $fn))
unless $fn eq 'debian/rules';
}
if( $mode & ( S_ISUID | S_ISGID | S_ISVTX ) ) {
- &warn( sprintf( _g("special mode %04o of `%s' will not be represented in diff"), $mode, $fn ) );
+ warning(sprintf(_g("special mode %04o of '%s' will not be represented in diff"), $mode, $fn));
}
} elsif (-f _) {
$ofnread= "$origdir/$fn";
} elsif (m/^[-+\@ ]/) {
$difflinefound=1;
} elsif (m/^\\ No newline at end of file$/) {
- &warn(sprintf(_g("file %s has no final newline ".
- "(either original or modified version)"), $fn));
+ warning(sprintf(_g("file %s has no final newline " .
+ "(either original or modified version)"), $fn));
} else {
s/\n$//;
&internerr(sprintf(_g("unknown line from diff -u on %s: `%s'"), $fn, $_));
next if defined($type{$fn});
lstat("$origdir/$fn") || &syserr(sprintf(_g("cannot check orig file %s"), "$origdir/$fn"));
if (-f _) {
- &warn(sprintf(_g("ignoring deletion of file %s"), $fn));
+ warning(sprintf(_g("ignoring deletion of file %s"), $fn));
} elsif (-d _) {
- &warn(sprintf(_g("ignoring deletion of directory %s"), $fn));
+ warning(sprintf(_g("ignoring deletion of directory %s"), $fn));
} elsif (-l _) {
- &warn(sprintf(_g("ignoring deletion of symlink %s"), $fn));
+ warning(sprintf(_g("ignoring deletion of symlink %s"), $fn));
} else {
&unrepdiff2(_g('not a file, directory or link'),
_g('nonexistent'));
if ($gpg_status == 1);
}
} else {
- &warn(sprintf(_g("could not verify signature on %s since gpg isn't installed"), $dsc));
+ warning(sprintf(_g("could not verify signature on %s since gpg isn't installed"), $dsc));
}
} else {
- &warn(sprintf(_g("extracting unsigned source package (%s)"), $dsc));
+ warning(sprintf(_g("extracting unsigned source package (%s)"), $dsc));
}
open(CDATA,"< $dsc") || &error(sprintf(_g("cannot open .dsc file %s: %s"), $dsc, $!));
&error(_g("no tarfile in Files field")) unless @tarfiles;
my $native = !($difffile || $debianfile);
if ($native) {
- &warn(_g("multiple tarfiles in native package")) if @tarfiles > 1;
- &warn(_g("native package with .orig.tar"))
+ warning(_g("multiple tarfiles in native package")) if @tarfiles > 1;
+ warning(_g("native package with .orig.tar"))
unless $seen{'.tar'} or $seen{"-$revision.tar"};
} else {
- &warn(_g("no upstream tarfile in Files field")) unless $seen{'.orig.tar'};
+ warning(_g("no upstream tarfile in Files field")) unless $seen{'.orig.tar'};
if ($dscformat =~ /^1\./) {
- &warn(sprintf(_g("multiple upstream tarballs in %s format dsc"), $dscformat)) if @tarfiles > 1;
- &warn(sprintf(_g("debian.tar in %s format dsc"), $dscformat)) if $debianfile;
+ warning(sprintf(_g("multiple upstream tarballs in %s format dsc"), $dscformat)) if @tarfiles > 1;
+ warning(sprintf(_g("debian.tar in %s format dsc"), $dscformat)) if $debianfile;
}
}
if (!(@s= lstat("$newdirectory/debian/rules"))) {
$! == ENOENT || &syserr(sprintf(_g("cannot stat %s"), "$newdirectory/debian/rules"));
- &warn(sprintf(_g("%s does not exist"), "$newdirectory/debian/rules"));
+ warning(sprintf(_g("%s does not exist"), "$newdirectory/debian/rules"));
} elsif (-f _) {
chmod($s[2] | 0111, "$newdirectory/debian/rules") ||
&syserr(sprintf(_g("cannot make %s executable"), "$newdirectory/debian/rules"));
} else {
- &warn(sprintf(_g("%s is not a plain file"), "$newdirectory/debian/rules"));
+ warning(sprintf(_g("%s is not a plain file"), "$newdirectory/debian/rules"));
}
$execmode= 0777 & ~umask;
&& (substr ($fn, 0, 99) eq substr ($tarfn, 0, 99))) {
# this file doesn't match because cpio truncated the name
# to the first 100 characters. let it slide for now.
- &warn (sprintf(_g("filename `%s' was truncated by cpio;" .
- " unable to check full pathname"), $pname));
+ warning(sprintf(_g("filename '%s' was truncated by cpio;" .
+ " unable to check full pathname"), $pname));
# Since it didn't match, later checks will not be able
# to stat this file, so we replace it with the filename
# fetched from tar.