[lintian] 01/01: L::Util: Rename "fail" to "internal_error"
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit b4e5c926b4b37fc05a6cef498ffc7ea94fa43d25
Author: Niels Thykier <niels@thykier.net>
Date: Sun Oct 1 19:53:43 2017 +0000
L::Util: Rename "fail" to "internal_error"
While going through the code, I noted the following gem:
fail("Internal error: ...");
If triggered, this would cause an error message saying:
"internal error: Internal error: ..."
With the rename, this (kind of) mistake gets easier to spot. Plus, it
is a more accurate name for the function.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
.perlcriticrc | 2 +-
checks/apache2.pm | 5 +++--
checks/binaries.pm | 9 +++++----
checks/cruft.pm | 31 ++++++++++++++++---------------
checks/files.pm | 6 +++---
checks/manpages.pm | 8 ++++----
checks/patch-systems.pm | 4 ++--
checks/scripts.pm | 21 +++++++++++++--------
checks/shared-libs.pm | 4 ++--
checks/standards-version.pm | 7 ++++---
checks/systemd.pm | 5 +++--
checks/triggers.pm | 4 ++--
collection/bin-pkg-control | 5 +++--
collection/changelog-file | 4 ++--
collection/copyright-file | 5 +++--
collection/diffstat | 5 +++--
collection/java-info | 4 ++--
collection/override-file | 5 +++--
collection/src-orig-index | 14 ++++++++------
collection/strings | 4 ++--
collection/unpacked | 6 +++---
commands/lintian.pm | 10 ++++++----
debian/changelog | 4 ++++
lib/Lintian/CollScript.pm | 6 +++---
lib/Lintian/Collect/Binary.pm | 5 +++--
lib/Lintian/Collect/Package.pm | 7 ++++---
lib/Lintian/DepMap.pm | 17 +++++++++++------
lib/Lintian/ProcessableGroup.pm | 16 +++++++++-------
lib/Lintian/Tag/TextUtil.pm | 4 ++--
lib/Lintian/Unpacker.pm | 4 ++--
lib/Lintian/Util.pm | 17 ++++++++++++++---
lib/Test/Lintian/Harness.pm | 29 ++++++++++++++++-------------
private/generate-profiles.pl | 6 +++---
t/runtests | 22 +++++++++++-----------
34 files changed, 175 insertions(+), 130 deletions(-)
diff --git a/.perlcriticrc b/.perlcriticrc
index 8d3feb5..696fbff 100644
--- a/.perlcriticrc
+++ b/.perlcriticrc
@@ -41,7 +41,7 @@ functions = open opendir chdir read readdir readline closedir sysopen sysread sy
[-Modules::ProhibitExcessMainComplexity]
[Subroutines::RequireFinalReturn]
-terminal_funcs = CORE::exec fatal_error fail Lintian::Util::fail Die error
+terminal_funcs = CORE::exec fatal_error internal_error Lintian::Util::internal_error Die error
[ValuesAndExpressions::ProhibitInterpolationOfLiterals]
diff --git a/checks/apache2.pm b/checks/apache2.pm
index 135cb1f..f7410a7 100644
--- a/checks/apache2.pm
+++ b/checks/apache2.pm
@@ -27,7 +27,7 @@ use autodie;
use File::Basename;
use Lintian::Tags qw(tag);
use Lintian::Relation qw(:constants);
-use Lintian::Util qw(fail);
+use Lintian::Util qw(internal_error);
sub run {
my ($pkg, $type, $info) = @_;
@@ -178,7 +178,8 @@ sub check_maintainer_scripts {
open(my $fd, '<', $info->lab_data_path('control-scripts'));
while (<$fd>){
- m/^(\S*) (.*)$/ or fail("bad line in control-scripts file: $_");
+ m/^(\S*) (.*)$/
+ or internal_error("bad line in control-scripts file: $_");
my $interpreter = $1;
my $file = $2;
my $path = $info->control_index_resolved_path($file);
diff --git a/checks/binaries.pm b/checks/binaries.pm
index 36cfce8..3b12b5f 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -42,7 +42,7 @@ use Lintian::Check qw(check_spelling spelling_tag_emitter);
use Lintian::Data;
use Lintian::Relation qw(:constants);
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail slurp_entire_file strip);
+use Lintian::Util qw(internal_error slurp_entire_file strip);
my $ARCH_REGEX = Lintian::Data->new('binaries/arch-regex', qr/\s*\~\~/o,
sub { return qr/$_[1]/ });
@@ -65,14 +65,14 @@ sub _embedded_libs {
} elsif ($opt eq 'source-regex') {
$result->{$opt} = qr/$val/;
} else {
- fail( "Unknown option $opt used for $key"
+ internal_error("Unknown option $opt used for $key"
. ' (in binaries/embedded-libs)');
}
}
}
if (defined $result->{'source'} and $result->{'source-regex'}) {
- fail( "Both source and source-regex used for $key"
+ internal_error("Both source and source-regex used for $key"
. ' (in binaries/embedded-libs)');
} else {
$result->{'source'} = $key unless defined $result->{'source'};
@@ -325,7 +325,8 @@ sub run {
foreach my $obj (@{ $objdump->{'objects'} }) {
my $libobj = $info->objdump_info->{"${file}(${obj})"};
# Shouldn't happen, but...
- fail("object ($file $obj) in static lib is missing!?")
+ internal_error(
+ "object ($file $obj) in static lib is missing!?")
unless defined $libobj;
if (any { exists($libobj->{'SH'}{$_}) } DEBUG_SECTIONS) {
diff --git a/checks/cruft.pm b/checks/cruft.pm
index d509e40..b49a52d 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -42,7 +42,7 @@ use constant SAFE_LINE_LENGTH => 256;
use Lintian::Data;
use Lintian::Relation ();
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail normalize_pkg_path strip);
+use Lintian::Util qw(internal_error normalize_pkg_path strip);
use Lintian::SlidingWindow;
our $LIBTOOL = Lintian::Relation->new('libtool | dh-autoreconf');
@@ -56,7 +56,7 @@ sub _md5sum_based_lintian_data {
sub {
my @sliptline = split(/\s*\~\~\s*/, $_[1], 5);
if (scalar(@sliptline) != 5) {
- fail "Syntax error in $filename", $.;
+ internal_error("Syntax error in $filename", $.);
}
my ($sha1, $sha256, $name, $reason, $link) = @sliptline;
return {
@@ -83,7 +83,7 @@ my $WARN_FILE_TYPE = Lintian::Data->new(
sub {
my @sliptline = split(/\s*\~\~\s*/, $_[1], 4);
if (scalar(@sliptline) < 1 or scalar(@sliptline) > 4) {
- fail 'Syntax error in cruft/warn-file-type', $.;
+ internal_error('Syntax error in cruft/warn-file-type', $.);
}
my ($regtype, $regname, $transformlist) = @sliptline;
@@ -107,28 +107,29 @@ my $WARN_FILE_TYPE = Lintian::Data->new(
if($transform =~ m'^s/') {
$transform =~ m'^s/([^/]*?)/([^/]*?)/$';
unless(defined($1) and defined($2)) {
- fail $syntaxerror, 'in transform regex',$.
-
+ internal_error($syntaxerror, 'in transform regex',
+ $.);
}
push(@transformpairs,[$1,$2]);
} elsif ($transform =~ m'^map\s*{') {
$transform
=~ m#^map \s* { \s* 's/([^/]*?)/\'.\$_.'/' \s* } \s* qw\(([^\)]*)\)#x;
unless(defined($1) and defined($2)) {
- fail $syntaxerror,'in map transform regex',$.;
+ internal_error($syntaxerror,
+ 'in map transform regex', $.);
}
my $words = $2;
my $match = $1;
my @wordarray = split(/\s+/,$words);
if(scalar(@wordarray) == 0) {
- fail $syntaxerror,
- 'in map transform regex : no qw arg',$.;
+ internal_error($syntaxerror,
+ 'in map transform regex : no qw arg', $.);
}
foreach my $word (@wordarray) {
push(@transformpairs,[$match, $word]);
}
} else {
- fail $syntaxerror,'in last field',$.;
+ internal_error($syntaxerror, 'in last field', $.);
}
}
}
@@ -186,7 +187,7 @@ sub _get_license_check_file {
my @splitline = split(/\s*\~\~\s*/, $_[1], 5);
my $syntaxerror = 'Syntax error in '.$filename;
if(scalar(@splitline) > 5 or scalar(@splitline) <2) {
- fail $syntaxerror, $.;
+ internal_error($syntaxerror, $.);
}
my ($keywords, $sentence, $regex, $firstregex, $callsub)
= @splitline;
@@ -198,11 +199,11 @@ sub _get_license_check_file {
my @keywordlist = split(/\s*\&\&\s*/, $keywords);
if(scalar(@keywordlist) < 1) {
- fail $syntaxerror, 'No keywords on line', $.;
+ internal_error($syntaxerror, 'No keywords on line', $.);
}
my @sentencelist = split(/\s*\|\|\s*/, $sentence);
if(scalar(@sentencelist) < 1) {
- fail $syntaxerror, 'No sentence on line', $.;
+ internal_error($syntaxerror, 'No sentence on line', $.);
}
if($regex eq '') {
@@ -220,8 +221,8 @@ sub _get_license_check_file {
unless($callsub eq '') {
if(defined($LICENSE_CHECK_DISPATCH_TABLE{$callsub})) {
$ret{'callsub'} = $LICENSE_CHECK_DISPATCH_TABLE{$callsub};
- }else {
- fail $syntaxerror, 'Unknown sub', $.;
+ } else {
+ internal_error($syntaxerror, 'Unknown sub', $.);
}
}
return \%ret;
@@ -425,7 +426,7 @@ sub check_diffstat {
local $_;
while (<$fd>) {
my ($file) = (m,^\s+(.*?)\s+\|,)
- or fail("syntax error in diffstat file: $_");
+ or internal_error("syntax error in diffstat file: $_");
$saw_file = 1;
# Check for CMake cache files. These embed the source path and hence
diff --git a/checks/files.pm b/checks/files.pm
index 97b8dc2..b695eaf 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -25,7 +25,7 @@ use autodie;
use Lintian::Data;
use Lintian::Tags qw(tag);
-use Lintian::Util qw(drain_pipe fail is_string_utf8_encoded open_gz
+use Lintian::Util qw(drain_pipe internal_error is_string_utf8_encoded open_gz
signal_number2name strip normalize_pkg_path);
use Lintian::SlidingWindow;
@@ -270,7 +270,7 @@ my $OBSOLETE_PATHS = Lintian::Data->new(
sub {
my @sliptline = split(/\s*\~\~\s*/, $_[1], 2);
if (scalar(@sliptline) != 2) {
- fail 'Syntax error in files/obsolete-paths', $.;
+ internal_error('Syntax error in files/obsolete-paths', $.);
}
my ($newdir, $moreinfo) = @sliptline;
return {
@@ -1569,7 +1569,7 @@ sub run {
# __ __ __ __, $mtime - variables
(undef, $mtime) = unpack('NN', $buff);
} else {
- fail "reading $file: $!";
+ internal_error("reading $file failed: $!");
}
close($fd);
if ($mtime != 0) {
diff --git a/checks/manpages.pm b/checks/manpages.pm
index 1b8c087..5795d6e 100644
--- a/checks/manpages.pm
+++ b/checks/manpages.pm
@@ -31,7 +31,7 @@ use Text::ParseWords ();
use Lintian::Check qw(check_spelling spelling_tag_emitter);
use Lintian::Tags qw(tag);
-use Lintian::Util qw(clean_env do_fork drain_pipe fail open_gz);
+use Lintian::Util qw(clean_env do_fork drain_pipe internal_error open_gz);
sub run {
my (undef, undef, $info, $proc, $group) = @_;
@@ -212,7 +212,7 @@ sub run {
clean_env;
open(STDERR, '>&', \*STDOUT);
exec('lexgrog', $fs_path)
- or fail "exec lexgrog failed: $!";
+ or internal_error("exec lexgrog failed: $!");
}
if (@running_lexgrog > 2) {
process_lexgrog_output(\@running_lexgrog);
@@ -250,7 +250,7 @@ sub run {
$ENV{MANROFFSEQ} = '';
$ENV{MANWIDTH} = 80;
exec { $cmd[0] } @cmd
- or fail("cannot run man -E UTF-8 -l: $!");
+ or internal_error("cannot run man -E UTF-8 -l: $!");
} else {
# parent - close write end
close $write;
@@ -345,7 +345,7 @@ sub process_lexgrog_output {
eval {close($lexgrog_fd);};
if (my $err = $@) {
# Problem closing the pipe?
- fail "close pipe: $err" if $err->errno;
+ internal_error("close pipe: $err") if $err->errno;
# No, then lexgrog returned with a non-zero exit code.
tag 'manpage-has-bad-whatis-entry', $file;
}
diff --git a/checks/patch-systems.pm b/checks/patch-systems.pm
index 0433d76..24cc2b6 100644
--- a/checks/patch-systems.pm
+++ b/checks/patch-systems.pm
@@ -28,7 +28,7 @@ use constant PATCH_DESC_TEMPLATE => 'TODO: Put a short summary on'
. ' the line above and replace this paragraph';
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail strip);
+use Lintian::Util qw(internal_error strip);
sub run {
my (undef, undef, $info) = @_;
@@ -229,7 +229,7 @@ sub run {
open(my $fd, '<', $info->diffstat);
while (<$fd>) {
my ($file) = (m,^\s+(.*?)\s+\|,)
- or fail("syntax error in diffstat file: $_");
+ or internal_error("syntax error in diffstat file: $_");
push(@direct, $file) if ($file !~ m,^debian/,);
}
close($fd);
diff --git a/checks/scripts.pm b/checks/scripts.pm
index a9d8727..287409a 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -33,7 +33,7 @@ use Lintian::Check qw($known_shells_regex);
use Lintian::Data;
use Lintian::Relation;
use Lintian::Tags qw(tag);
-use Lintian::Util qw(do_fork fail strip);
+use Lintian::Util qw(do_fork internal_error strip);
# This is a map of all known interpreters. The key is the interpreter
# name (the binary invoked on the #! line). The value is an anonymous
@@ -95,7 +95,8 @@ my $BAD_MAINT_CMD = Lintian::Data->new(
sub {
my @sliptline = split(/\s*\~\~/, $_[1], 4);
if(scalar(@sliptline) != 4) {
- fail 'Syntax error in scripts/maintainer-script-bad-command:', $.;
+ internal_error(
+ 'Syntax error in scripts/maintainer-script-bad-command:', $.);
}
my ($incat,$exceptinpackage,$inscript,$regexp) = @sliptline;
$regexp =~ s/\$[{]LEADIN[}]/$LEADINSTR/;
@@ -534,7 +535,8 @@ sub run {
while (<$ctrl_fd>) {
chop;
- m/^(\S*) (.*)$/ or fail("bad line in control-scripts file: $_");
+ m/^(\S*) (.*)$/
+ or internal_error("bad line in control-scripts file: $_");
my $interpreter = $1;
my $file = $2;
my $path = $info->control_index_resolved_path($file);
@@ -1005,7 +1007,7 @@ sub run {
push @{$removed_diversions{$divert}},
{'script' => $file, 'line' => $.};
} else {
- fail "Internal error: \$mode has unknown value: $mode";
+ internal_error("\$mode has unknown value: $mode");
}
}
}
@@ -1269,7 +1271,7 @@ sub check_script_syntax {
open(STDOUT, '>', '/dev/null');
open(STDERR, '>&', \*STDOUT);
exec $interpreter, '-n', $fs_path
- or fail("cannot exec $interpreter: $!");
+ or internal_error("cannot exec $interpreter: $!");
} else {
waitpid $pid, 0;
}
@@ -1333,7 +1335,8 @@ sub _parse_interpreters {
if ($dep eq '@NODEPS@') {
$dep = '';
} elsif ($dep =~ m/@/) {
- fail "Unknown magic value $dep for versioned interpreter $interpreter";
+ internal_error(
+ "Unknown magic value $dep for versioned interpreter $interpreter");
}
return [$path, $dep];
}
@@ -1348,8 +1351,10 @@ sub _parse_versioned_interpreters {
} elsif ($deprel eq '@SKIP_UNVERSIONED@') {
$deprel = undef;
} elsif ($deprel =~ m/@/) {
- fail
- "Unknown magic value $deprel for versioned interpreter $interpreter";
+ internal_error(
+ join(q{ },
+ "Unknown magic value $deprel",
+ "for versioned interpreter $interpreter"));
}
return [$path, $deprel, qr/^$regex$/, $deptmp, \@versions];
}
diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
index 8122aa5..51561f9 100644
--- a/checks/shared-libs.pm
+++ b/checks/shared-libs.pm
@@ -29,7 +29,7 @@ use List::MoreUtils qw(any none uniq);
use Lintian::Data;
use Lintian::Relation;
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail strip);
+use Lintian::Util qw(internal_error strip);
# Libraries that should only be used in the presence of certain capabilities
# may be located in subdirectories of the standard ldconfig search path with
@@ -195,7 +195,7 @@ sub run {
for my $shlib_file (keys %SONAME) {
# file found?
if (not $info->index($shlib_file)) {
- fail(
+ internal_error(
"shlib $shlib_file not found in package (should not happen!)");
}
diff --git a/checks/standards-version.pm b/checks/standards-version.pm
index 7e5ee80..bf4fda7 100644
--- a/checks/standards-version.pm
+++ b/checks/standards-version.pm
@@ -31,19 +31,20 @@ use Date::Parse qw(str2time);
use Lintian::Data;
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail);
+use Lintian::Util qw(internal_error);
# Any Standards Version released before this day is "ancient"
my $ANCIENT_DATE_DATA = Lintian::Data->new(
'standards-version/ancient-date',
qr{\s*<\s*},
sub {
- my $date = str2time($_[1]) or fail "Cannot parse ANCIENT_DATE: $!";
+ my $date = str2time($_[1])
+ or internal_error("Cannot parse ANCIENT_DATE: $!");
return $date;
});
my $ANCIENT_DATE = $ANCIENT_DATE_DATA->value('ANCIENT')
- or fail 'Cannot get ANCIENT_DATE';
+ or internal_error('Cannot get ANCIENT_DATE');
my $STANDARDS= Lintian::Data->new('standards-version/release-dates', qr/\s+/o);
diff --git a/checks/systemd.pm b/checks/systemd.pm
index 5b991ce..50841a0 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -32,7 +32,7 @@ use List::MoreUtils qw(any first_index);
use Text::ParseWords qw(shellwords);
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail lstrip rstrip);
+use Lintian::Util qw(internal_error lstrip rstrip);
use Lintian::Data;
@@ -315,7 +315,8 @@ sub check_maintainer_scripts {
open(my $fd, '<', $info->lab_data_path('control-scripts'));
while (<$fd>) {
- m/^(\S*) (.*)$/ or fail("bad line in control-scripts file: $_");
+ m/^(\S*) (.*)$/
+ or internal_error("bad line in control-scripts file: $_");
my $interpreter = $1;
my $file = $2;
my $path = $info->control_index_resolved_path($file);
diff --git a/checks/triggers.pm b/checks/triggers.pm
index 5382b10..30abebf 100644
--- a/checks/triggers.pm
+++ b/checks/triggers.pm
@@ -25,7 +25,7 @@ use warnings;
use Lintian::Data;
use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail strip);
+use Lintian::Util qw(internal_error strip);
sub _parse_trigger_types {
my ($key, $val) = @_;
@@ -35,7 +35,7 @@ sub _parse_trigger_types {
$values{$k} = $v;
}
if (exists($values{'implicit-await'})) {
- fail(
+ internal_error(
join(q{ },
'Invalid trigger-types data file:',
"$key is defined as implicit-await trigger,",
diff --git a/collection/bin-pkg-control b/collection/bin-pkg-control
index 11cdd93..5195e80 100755
--- a/collection/bin-pkg-control
+++ b/collection/bin-pkg-control
@@ -31,14 +31,15 @@ use constant ERROR_FILES => qw(control-index-errors control-errors);
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Command qw(spawn reap);
-use Lintian::Util qw(delete_dir fail pipe_tee run_cmd);
+use Lintian::Util qw(delete_dir internal_error pipe_tee run_cmd);
sub collect {
my ($pkg, $type, $dir) = @_;
my (@jobs, $job, $in_fd, @out_fds, $err);
if (-e "$dir/control"){
- delete_dir("$dir/control") or fail 'Cannot remove old control dir';
+ delete_dir("$dir/control")
+ or internal_error('Cannot remove old control dir');
}
for my $file ('control-index.gz', ERROR_FILES) {
diff --git a/collection/changelog-file b/collection/changelog-file
index 89aecb9..a986c38 100755
--- a/collection/changelog-file
+++ b/collection/changelog-file
@@ -30,7 +30,7 @@ use autodie;
use File::Copy qw(copy);
use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file is_ancestor_of);
+use Lintian::Util qw(internal_error gunzip_file is_ancestor_of);
sub collect {
my ($pkg, $type, $dir) = @_;
@@ -99,7 +99,7 @@ sub collect {
} elsif ($chl =~ /\.gz$/) {
gunzip_file($chl, "$dir/changelog");
} elsif (-f $chl && -l $chl) {
- copy($chl, "$dir/changelog") or fail "cannot copy $chl: $!";
+ copy($chl, "$dir/changelog") or internal_error("cannot copy $chl: $!");
} else {
link($chl, "$dir/changelog");
}
diff --git a/collection/copyright-file b/collection/copyright-file
index 2ba7dd6..cc1a85c 100755
--- a/collection/copyright-file
+++ b/collection/copyright-file
@@ -28,7 +28,7 @@ use warnings;
use autodie;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file is_ancestor_of touch_file);
+use Lintian::Util qw(internal_error gunzip_file is_ancestor_of touch_file);
use File::Copy qw(copy);
@@ -57,7 +57,8 @@ sub collect {
my $link = readlink($file);
unless ($link =~ /\.\./
|| ($link =~ m%/% && $link !~ m%^[^/]+(?:/+[^/]+)*\z%)) {
- copy($file, "$dir/copyright") or fail "cannot copy $file: $!";
+ copy($file, "$dir/copyright")
+ or internal_error("cannot copy $file: $!");
}
} elsif (-f $file) {
link($file, "$dir/copyright");
diff --git a/collection/diffstat b/collection/diffstat
index a4b570b..00da782 100755
--- a/collection/diffstat
+++ b/collection/diffstat
@@ -34,14 +34,15 @@ use warnings;
use autodie;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail get_dsc_info gunzip_file);
+use Lintian::Util qw(internal_error get_dsc_info gunzip_file);
sub collect {
my ($pkg, undef, $dir) = @_;
my $data;
my $ver;
- -f "$dir/dsc" or fail 'diffstat invoked with wrong dir argument';
+ -f "$dir/dsc"
+ or internal_error('diffstat invoked with wrong dir argument');
$data = get_dsc_info("$dir/dsc");
$ver = $data->{'version'};
diff --git a/collection/java-info b/collection/java-info
index 1875ebb..5b00c2f 100755
--- a/collection/java-info
+++ b/collection/java-info
@@ -33,14 +33,14 @@ use FileHandle;
use lib "$ENV{'LINTIAN_ROOT'}/lib/";
use Lintian::Collect;
use Lintian::Command qw(spawn reap);
-use Lintian::Util qw(fail rstrip);
+use Lintian::Util qw(internal_error rstrip);
sub collect {
my ($pkg, $type, $dir) = @_;
my $info = Lintian::Collect->new($pkg, $type, $dir);
unless (-d "$dir/unpacked/") {
- fail 'java-info called with the wrong dir argument';
+ internal_error('java-info called with the wrong dir argument');
}
if (-f "$dir/java-info.gz") {
diff --git a/collection/override-file b/collection/override-file
index 63647e0..04c43fc 100755
--- a/collection/override-file
+++ b/collection/override-file
@@ -29,12 +29,13 @@ use warnings;
use autodie;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(fail gunzip_file is_ancestor_of);
+use Lintian::Util qw(internal_error gunzip_file is_ancestor_of);
sub collect {
my ($pkg, $type, $dir) = @_;
- -d "$dir/unpacked" or fail 'override-file invoked with wrong dir argument';
+ -d "$dir/unpacked"
+ or internal_error('override-file invoked with wrong dir argument');
if (-e "$dir/override"){
unlink("$dir/override");
diff --git a/collection/src-orig-index b/collection/src-orig-index
index 45a4bfd..7799e1a 100755
--- a/collection/src-orig-index
+++ b/collection/src-orig-index
@@ -33,7 +33,7 @@ use Cwd();
use Lintian::Collect;
use Lintian::Command qw(spawn);
use Lintian::Processable::Package;
-use Lintian::Util qw(fail);
+use Lintian::Util qw(internal_error);
sub collect {
my ($pkg, $type, $dir) = @_;
@@ -64,7 +64,8 @@ sub gather_tarballs {
my $base;
my $baserev;
my $proc;
- fail "Cannot resolve \"dsc\" link for $pkg or it does not point to a file."
+ internal_error(
+ "Cannot resolve \"dsc\" link for $pkg or it does not point to a file.")
unless $file and -e $file;
# Use Lintian::Processable::Package to determine source and
@@ -75,7 +76,7 @@ sub gather_tarballs {
$version = $proc->pkg_src_version;
if ($version =~ /:/) {
$version =~ s/^(?:\d+):(.+)/$1/
- or fail "bad version number '$version'";
+ or internal_error("bad version number \"$version\"");
}
$baserev = $proc->pkg_src . '_' . $version;
$version =~ s/(.+)-(?:.*)$/$1/;
@@ -95,7 +96,7 @@ sub gather_tarballs {
push @tarballs, [$t[2], $1//''];
}
}
- fail 'could not find the source tarball' unless @tarballs;
+ internal_error('could not find the source tarball') unless @tarballs;
return @tarballs;
}
@@ -144,8 +145,9 @@ sub index_orig {
},
['tar', @tar_options, "$dir/$tarball"]);
if ($last) {
- fail
- "tar output (for $tarball from $pkg) does not end in a newline";
+ internal_error(
+ "tar output (for $tarball from $pkg) does not end in a newline"
+ );
}
# We now need to see if all files in the tarball have a common
# prefix. If so, we're going to strip that prefix off each
diff --git a/collection/strings b/collection/strings
index 7621ad7..2666f07 100755
--- a/collection/strings
+++ b/collection/strings
@@ -32,7 +32,7 @@ use FileHandle;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Collect;
use Lintian::Command qw(spawn reap);
-use Lintian::Util qw(delete_dir fail locate_helper_tool run_cmd);
+use Lintian::Util qw(delete_dir internal_error locate_helper_tool run_cmd);
my $helper = locate_helper_tool('coll/strings-helper');
@@ -41,7 +41,7 @@ sub collect {
my ($info, @manual, %opts);
if (-d "$dir/strings") {
- delete_dir("$dir/strings") or fail "rmdir strings: $!";
+ delete_dir("$dir/strings") or internal_error("rmdir strings: $!");
}
# If we are asked to only remove the files stop right here
diff --git a/collection/unpacked b/collection/unpacked
index 3392aaf..4e7e87b 100755
--- a/collection/unpacked
+++ b/collection/unpacked
@@ -37,14 +37,14 @@ use constant READ_SIZE => 4096 * 1024 * 10;
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Lintian::Command qw(spawn reap);
-use Lintian::Util qw(check_path delete_dir fail run_cmd pipe_tee);
+use Lintian::Util qw(check_path delete_dir internal_error run_cmd pipe_tee);
sub collect {
my ($pkg, $type, $dir) = @_;
if (-d "$dir/unpacked/") {
delete_dir("$dir/unpacked/")
- or fail("failed to remove unpacked directory of $pkg");
+ or internal_error("failed to remove unpacked directory of $pkg");
}
for my $file (qw(index index.gz index-errors unpacked-errors)) {
unlink("$dir/$file") if -e "$dir/$file";
@@ -68,7 +68,7 @@ sub collect {
['dpkg-source', @args, '-x', "$dir/dsc", "$dir/unpacked"])
) {
dump_errors("$dir/unpacked-errors");
- fail('dpkg-source -x failed with status ',
+ internal_error('dpkg-source -x failed with status ',
$opts->{harness}->result);
}
} else {
diff --git a/commands/lintian.pm b/commands/lintian.pm
index b920e1d..9db64bc 100755
--- a/commands/lintian.pm
+++ b/commands/lintian.pm
@@ -50,7 +50,7 @@ use Lintian::ProcessablePool;
use Lintian::Profile;
use Lintian::Tags qw(tag);
use Lintian::Unpacker;
-use Lintian::Util qw(fail parse_boolean strip);
+use Lintian::Util qw(internal_error parse_boolean strip);
sanitize_environment();
@@ -763,7 +763,8 @@ sub main {
# earlier.
if (waitpid(-1, WNOHANG) != -1) {
$exit_code = 2;
- fail('Unreaped processes after running checks!?');
+ internal_error(
+ 'Unreaped processes after running checks!?');
}
} else {
# If we are interrupted in (e.g.) checks/manpages, it
@@ -1594,7 +1595,8 @@ sub load_and_select_collections {
}
if (@missing) {
my $str = join(', ', @missing);
- fail("The check \"$c\" depends unknown collection(s): $str");
+ internal_error(
+ "The check \"$c\" depends unknown collection(s): $str");
}
$map->addp('check-' . $c, 'coll-', @deps);
}
@@ -1603,7 +1605,7 @@ sub load_and_select_collections {
# Make sure the resolver is in a sane state
# - This can happen if we break collections (inter)dependencies.
if ($map->missing) {
- fail('There are missing nodes in the resolver: '
+ internal_error('There are missing nodes in the resolver: '
. join(', ', $map->missing));
}
diff --git a/debian/changelog b/debian/changelog
index c91e846..76e7261 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,10 @@ lintian (2.5.55) UNRELEASED; urgency=medium
* commands/lintian.pm:
+ [NT] Simplify handling of uncaught exceptions.
+ * lib/Lintian/Util.pm:
+ + [NT] Rename the "fail" subroutine to "internal_error" to better
+ reflect its purpose.
+
* t/tests/python-new-python2-package/*:
+ [CL] Correct Depends of python2.7 → python3 in Python 3 test
package.
diff --git a/lib/Lintian/CollScript.pm b/lib/Lintian/CollScript.pm
index d4245ae..87e12a2 100644
--- a/lib/Lintian/CollScript.pm
+++ b/lib/Lintian/CollScript.pm
@@ -26,7 +26,7 @@ use parent 'Class::Accessor::Fast';
use Carp qw(croak);
use File::Basename qw(dirname);
-use Lintian::Util qw(fail read_dpkg_control_utf8);
+use Lintian::Util qw(internal_error read_dpkg_control_utf8);
=head1 NAME
@@ -243,7 +243,7 @@ sub collect {
system($self->script_path, $pkg_name, $task, $dir) == 0
or die 'Collection ' . $self->name . " for $pkg_name failed\n";
} else {
- fail "Unknown interface: $iface";
+ internal_error("Unknown interface: $iface");
}
return;
}
@@ -265,7 +265,7 @@ sub _load_collector {
$collector = \&{'Lintian::coll::' . $ppkg . '::collect'}
if defined &{'Lintian::coll::' . $ppkg . '::collect'};
}
- fail $self->name . ' does not have a collect function'
+ internal_error($self->name . ' does not have a collect function')
unless defined $collector;
$self->{'_collect_sub'} = $collector;
return;
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 62df829..f53d7d4 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -29,7 +29,8 @@ use Lintian::Relation;
use Carp qw(croak);
use Parse::DebianChangelog;
-use Lintian::Util qw(fail open_gz parse_dpkg_control get_file_checksum strip);
+use Lintian::Util
+ qw(internal_error open_gz parse_dpkg_control get_file_checksum strip);
=head1 NAME
@@ -342,7 +343,7 @@ sub scripts {
chomp($line);
$line =~ m/^(env )?(\S*) (.*)$/o
- or fail("bad line in scripts file: $line");
+ or internal_error("bad line in scripts file: $line");
($file{calls_env}, $file{interpreter}, $name) = ($1, $2, $3);
$name =~ s,^\./,,o;
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index e0eaa0d..b092b8d 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -30,7 +30,8 @@ use Scalar::Util qw(blessed);
use Lintian::Path;
use Lintian::Path::FSInfo;
-use Lintian::Util qw(fail open_gz perm2oct normalize_pkg_path dequote_name);
+use Lintian::Util
+ qw(internal_error open_gz perm2oct normalize_pkg_path dequote_name);
# A cache for (probably) the 5 most common permission strings seen in
# the wild.
@@ -259,7 +260,7 @@ sub md5sums {
chop($line);
next if $line =~ m/^\s*$/o;
$line =~ m/^(\\)?(\S+)\s*(\S.*)$/o
- or fail "syntax error in $md5f info file: $line";
+ or internal_error("syntax error in $md5f info file: $line");
my ($zzescaped, $zzsum, $zzfile) = ($1, $2, $3);
if($zzescaped) {
$zzfile = dequote_name($zzfile);
@@ -537,7 +538,7 @@ sub _fetch_index_data {
}
}
if (!exists($idxh{''})) {
- fail('The root dir should be present or have been faked');
+ internal_error('The root dir should be present or have been faked');
}
if (%rhlinks) {
foreach my $file (sort keys %rhlinks) {
diff --git a/lib/Lintian/DepMap.pm b/lib/Lintian/DepMap.pm
index 161ca11..95a6e9e 100644
--- a/lib/Lintian/DepMap.pm
+++ b/lib/Lintian/DepMap.pm
@@ -22,7 +22,7 @@ use parent 'Clone';
use Carp qw(croak);
use List::MoreUtils qw(any);
-use Lintian::Util qw(fail);
+use Lintian::Util qw(internal_error);
=head1 NAME
@@ -219,11 +219,13 @@ sub satisfy {
my $node = shift;
if (any {$_ eq $node} $self->missing) {
- fail( "Attempted to mark node '$node' as satisfied but it is not "
+ internal_error(
+ "Attempted to mark node '$node' as satisfied but it is not "
.'reachable, perhaps you forgot to add() it first?');
}
if (not exists($self->{'nodes'}{$node})) {
- fail( "Attempted to mark node '$node' as satisfied but it is not "
+ internal_error(
+ "Attempted to mark node '$node' as satisfied but it is not "
.'reachable, perhaps you forgot to satisfy() its dependencies first?'
);
}
@@ -301,7 +303,8 @@ sub unlink {
my $node = shift;
if (not exists($self->{'nodes'}{$node})) {
- fail( "Attempted to unlink node '$node' but it cannot be found"
+ internal_error(
+ "Attempted to unlink node '$node' but it cannot be found"
.', perhaps it has already been satisfied?');
}
@@ -351,7 +354,8 @@ sub select {
my $node = shift;
if (not exists($self->{'pending'}{$node})) {
- fail( "Attempted to mark node '$node' as selected but it is not "
+ internal_error(
+ "Attempted to mark node '$node' as selected but it is not "
.'known, perhaps its parents are not yet satisfied?');
}
return 0 if (exists($self->{'selected'}{$node}));
@@ -446,7 +450,8 @@ sub parents {
my $node = shift;
if (not exists($self->{'nodes'}{$node})) {
- fail( "Attempted to get the parents of node '$node' but it is not"
+ internal_error(
+ "Attempted to get the parents of node '$node' but it is not"
.'known, perhaps you forgot to add() it first?');
}
diff --git a/lib/Lintian/ProcessableGroup.pm b/lib/Lintian/ProcessableGroup.pm
index 260d635..1eab039 100644
--- a/lib/Lintian/ProcessableGroup.pm
+++ b/lib/Lintian/ProcessableGroup.pm
@@ -24,7 +24,7 @@ use warnings;
use Lintian::Collect::Group;
use Lintian::Processable;
-use Lintian::Util qw(fail get_dsc_info strip);
+use Lintian::Util qw(internal_error get_dsc_info strip);
=head1 NAME
@@ -85,9 +85,9 @@ sub _lab_proc {
sub _init_group_from_changes {
my ($self, $changes) = @_;
my ($cinfo, $cdir);
- fail "$changes does not exist" unless -e $changes;
+ internal_error("$changes does not exist") unless -e $changes;
$cinfo = get_dsc_info($changes)
- or fail "$changes is not a valid changes file";
+ or internal_error("$changes is not a valid changes file");
$self->add_new_processable($changes, 'changes');
$cdir = $changes;
if ($changes =~ m,^/+[^/]++$,o){
@@ -166,15 +166,17 @@ sub add_processable{
my $pkg_type = $processable->pkg_type;
if ($pkg_type eq 'changes'){
- fail 'Cannot add another changes file' if (exists $self->{changes});
+ internal_error('Cannot add another changes file')
+ if (exists $self->{changes});
$self->{changes} = $self->_lab_proc($processable);
} elsif ($pkg_type eq 'source'){
- fail 'Cannot add another source package' if (exists $self->{source});
+ internal_error('Cannot add another source package')
+ if (exists $self->{source});
$self->{source} = $self->_lab_proc($processable);
} else {
my $phash;
my $id = $processable->identifier;
- fail "Unknown type $pkg_type"
+ internal_error("Unknown type $pkg_type")
unless ($pkg_type eq 'binary' or $pkg_type eq 'udeb');
$phash = $self->{$pkg_type};
if (!defined $phash){
@@ -214,7 +216,7 @@ sub get_processables {
return values %{$self->{$type}}
if $type eq 'binary'
or $type eq 'udeb';
- fail "Unknown type of processable: $type";
+ internal_error("Unknown type of processable: $type");
}
# We return changes, dsc, debs and udebs in that order,
# because that is the order lintian used to process a changes
diff --git a/lib/Lintian/Tag/TextUtil.pm b/lib/Lintian/Tag/TextUtil.pm
index 45b2ac1..71b71b7 100644
--- a/lib/Lintian/Tag/TextUtil.pm
+++ b/lib/Lintian/Tag/TextUtil.pm
@@ -30,7 +30,7 @@ our @EXPORT_OK= qw(split_paragraphs wrap_paragraphs dtml_to_html dtml_to_text);
# requires wrap() function
use Text::Wrap;
-use Lintian::Util qw(fail strip);
+use Lintian::Util qw(internal_error strip);
# html_wrap -- word-wrap a paragraph. The wrap() function from Text::Wrap
# is not suitable, because it chops words that are longer than the line
@@ -99,7 +99,7 @@ sub split_paragraphs {
}
# what else can happen?
else {
- fail('internal error in wrap');
+ internal_error('internal error in wrap');
}
}
#FLUSH;
diff --git a/lib/Lintian/Unpacker.pm b/lib/Lintian/Unpacker.pm
index ea9d1c8..e44d2df 100644
--- a/lib/Lintian/Unpacker.pm
+++ b/lib/Lintian/Unpacker.pm
@@ -26,7 +26,7 @@ use parent 'Class::Accessor::Fast';
use POSIX;
use Lintian::Command::Simple qw(wait_any kill_all);
-use Lintian::Util qw(do_fork fail);
+use Lintian::Util qw(do_fork internal_error);
=head1 NAME
@@ -164,7 +164,7 @@ sub new {
$ccmap->unlink($node);
}
# ccmap should not be inconsistent by this change.
- fail 'Inconsistent collmap after deletion'
+ internal_error('Inconsistent collmap after deletion')
if $ccmap->missing;
}
$self->{'extra-coll'} = $extra;
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index a99ea58..b89396c 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -65,6 +65,7 @@ BEGIN {
file_is_encoded_in_non_utf8
is_string_utf8_encoded
fail
+ internal_error
do_fork
run_cmd
strip
@@ -1183,7 +1184,7 @@ sub touch_file {
return 1;
}
-=item fail (MSG[, ...])
+=item internal_error (MSG[, ...])
Use to signal an internal error. The argument(s) will used to print a
diagnostic message to the user.
@@ -1192,9 +1193,19 @@ If multiple arguments are given, they will be merged into a single
string (by join (' ', @_)). If only one argument is given it will be
stringified and used directly.
+=item fail (MSG[, ...])
+
+Deprecated alias of "internal_error".
+
=cut
sub fail {
+ warnings::warnif('deprecated',
+ '[deprecation] fail() has been replaced by internal_error()');
+ goto \&internal_error;
+}
+
+sub internal_error {
my $str = 'internal error: ';
if (@_) {
$str .= join ' ', @_;
@@ -1228,7 +1239,7 @@ If the tool cannot be found, this sub will cause a trappable error.
sub locate_helper_tool {
my ($toolname) = @_;
if ($toolname =~ m{(?:\A|/) \.\. (?:\Z|/)}xsm) {
- fail("$toolname is not a valid tool name");
+ internal_error("$toolname is not a valid tool name");
}
return $_CACHE{$toolname} if exists $_CACHE{$toolname};
@@ -1245,7 +1256,7 @@ If the tool cannot be found, this sub will cause a trappable error.
}
}
$toolpath_str //= '<N/A>';
- fail(
+ internal_error(
sprintf(
'Cannot locate %s (search dirs: %s)',
$toolname, $toolpath_str
diff --git a/lib/Test/Lintian/Harness.pm b/lib/Test/Lintian/Harness.pm
index 861c686..d351f97 100644
--- a/lib/Test/Lintian/Harness.pm
+++ b/lib/Test/Lintian/Harness.pm
@@ -49,7 +49,8 @@ use File::Temp qw(tempfile);
use POSIX qw(ENOENT);
use Text::Template;
-use Lintian::Util qw(do_fork fail read_dpkg_control slurp_entire_file);
+use Lintian::Util
+ qw(do_fork internal_error read_dpkg_control slurp_entire_file);
our @EXPORT_OK = qw(
chdir_runcmd
@@ -115,7 +116,7 @@ Run CMD via system, but throw an error if CMD does not return 0.
sub runsystem {
system(@_) == 0
- or fail("failed: @_\n");
+ or internal_error("failed: @_\n");
return;
}
@@ -134,7 +135,7 @@ sub runsystem_ok {
my $errcode = system(@_);
$errcode == 0
or $errcode == (1 << 8)
- or fail("failed: @_\n");
+ or internal_error("failed: @_\n");
return $errcode == 0;
}
@@ -200,7 +201,7 @@ sub check_test_depends {
open(STDIN, '<', '/dev/null');
open(STDERR, '>&', \*STDOUT);
exec 'dpkg-checkbuilddeps', $test_file
- or fail "exec dpkg-checkbuilddeps: $!";
+ or internal_error("exec dpkg-checkbuilddeps: $!");
}
$missing = slurp_entire_file($fd, 1);
eval {close($fd);};
@@ -213,14 +214,15 @@ sub check_test_depends {
chomp($missing);
if ($missing =~ s{\n}{\\n}gxsm) {
# We expect exactly one line.
- fail "Unexpected output from dpkg-checkbuilddeps: $missing";
+ internal_error(
+ "Unexpected output from dpkg-checkbuilddeps: $missing");
}
return $missing;
}
if ($err) {
# Problem closing the pipe?
- fail "close pipe: $err" if $err->errno;
- fail $err;
+ internal_error("close pipe: $err") if $err->errno;
+ internal_error($err);
}
return;
}
@@ -240,7 +242,7 @@ sub read_test_desc {
my ($testdata, $expected_name);
if (scalar(@paragraphs) != 1) {
- fail("$filename does not have exactly one paragraph");
+ internal_error("$filename does not have exactly one paragraph");
}
$testdata = $paragraphs[0];
if ($filename =~ m{/desc$}) {
@@ -252,10 +254,10 @@ sub read_test_desc {
}
if (!exists $testdata->{'testname'}) {
- fail("$filename is missing Testname field");
+ internal_error("$filename is missing Testname field");
}
if ($expected_name ne $testdata->{'testname'}) {
- fail( "$filename is called $testdata->{'testname'}"
+ internal_error("$filename is called $testdata->{'testname'}"
. " instead of $expected_name");
}
$testdata->{'sequence'} //= 6000;
@@ -274,12 +276,12 @@ sub fill_in_tmpl {
my $tmpl = "$file.in";
my $template = Text::Template->new(TYPE => 'FILE', SOURCE => $tmpl);
- fail("Cannot read template $tmpl: $Text::Template::ERROR")
+ internal_error("Cannot read template $tmpl: $Text::Template::ERROR")
if not $template;
open(my $out, '>', $file);
unless ($template->fill_in(OUTPUT => $out, HASH => $data)) {
- fail("cannot create $file");
+ internal_error("cannot create $file");
}
close($out);
return;
@@ -308,7 +310,8 @@ sub chdir_runcmd {
open(STDIN, '<', '/dev/null');
open(STDOUT, '>', $log);
open(STDERR, '>&', \*STDOUT);
- exec { $cmd->[0] } @$cmd or fail 'exec ' . @$cmd . " failed: $!";
+ exec { $cmd->[0] } @$cmd
+ or internal_error('exec ' . @$cmd . " failed: $!");
}
}
diff --git a/private/generate-profiles.pl b/private/generate-profiles.pl
index 78fb6af..0b1584f 100755
--- a/private/generate-profiles.pl
+++ b/private/generate-profiles.pl
@@ -21,7 +21,7 @@ BEGIN {
}
use lib "$ENV{LINTIAN_ROOT}/lib";
-use Lintian::Util qw(fail read_dpkg_control strip);
+use Lintian::Util qw(internal_error read_dpkg_control strip);
my $root = $ENV{LINTIAN_ROOT};
my @dirs = ('profiles/debian');
@@ -30,7 +30,7 @@ my (@checks, @fatal, @nonfatal);
foreach my $check (glob("$root/checks/*.desc")){
my ($header, undef) = read_dpkg_control($check);
my $cname = $header->{'check-script'};
- fail "$check missing check-script\n" unless defined $cname;
+ internal_error("$check missing check-script\n") unless defined $cname;
push @checks, $cname;
}
@@ -38,7 +38,7 @@ foreach my $check (glob("$root/checks/*.desc")){
@nonfatal = read_tags('private/build-time-data/ftp-master-nonfatal');
foreach my $dir (@dirs) {
- mkdir $dir or fail "mkdir $dir: $!" unless -d $dir;
+ mkdir($dir) or internal_error("mkdir $dir: $!") unless -d $dir;
}
generate_profile(
diff --git a/t/runtests b/t/runtests
index 96f9210..97fda17 100755
--- a/t/runtests
+++ b/t/runtests
@@ -95,7 +95,7 @@ use lib "$LINTIAN_ROOT/lib";
use Lintian::Command qw(safe_qx);
use Lintian::Internal::FrontendUtil qw(default_parallel);
-use Lintian::Util qw(delete_dir fail parse_boolean
+use Lintian::Util qw(delete_dir internal_error parse_boolean
rstrip slurp_entire_file touch_file);
use Test::Lintian::Harness qw(chdir_runcmd check_test_depends
@@ -143,7 +143,7 @@ parse_args();
if (-d "$TESTSET/helpers/bin") {
# Add the test helpers to PATH
my $tpath = Cwd::abs_path("$TESTSET/helpers/bin");
- fail "Cannot resolve $TESTSET/helpers/bin: $!" unless $tpath;
+ internal_error("Cannot resolve $TESTSET/helpers/bin: $!") unless $tpath;
$ENV{'PATH'} = "$tpath:$ENV{'PATH'}";
}
@@ -230,15 +230,15 @@ sub parse_args {
if (-d $RUNDIR) {
my $abs = Cwd::abs_path($RUNDIR);
- fail("Cannot resolve $RUNDIR: $!")
+ internal_error("Cannot resolve $RUNDIR: $!")
if not defined($abs);
$RUNDIR = $abs;
} else {
- fail("test directory $RUNDIR does not exist");
+ internal_error("test directory $RUNDIR does not exist");
}
unless (-d $TESTSET) {
- fail("test set directory $TESTSET does not exist");
+ internal_error("test set directory $TESTSET does not exist");
}
if (defined($coverage)) {
@@ -463,7 +463,7 @@ sub _builder_tests {
my $res = chdir_runcmd($testdir, \@DPKG_BUILDPACKAGE_CMD, $log);
if ($res){
$test_state->dump_log($log) if $DUMP_LOGS;
- fail("cd $testdir && @DPKG_BUILDPACKAGE_CMD >$log 2>&1");
+ internal_error("cd $testdir && @DPKG_BUILDPACKAGE_CMD >$log 2>&1");
}
return;
@@ -485,7 +485,7 @@ sub run_lintian {
my $status = 0;
eval {close($in);};
if (my $err = $@) {
- fail("close pipe: $!") if $err->errno;
+ internal_error("close pipe: $!") if $err->errno;
$status = ($? >> 8) & 255;
}
if (defined($coverage)) {
@@ -522,7 +522,7 @@ sub run_lintian {
}
open(STDERR, '>&', \*STDOUT);
exec @cmd, @options, @LINTIAN_COMMON_OPTIONS, $file
- or fail "exec failed: $!";
+ or internal_error("exec failed: $!");
}
return 1;
}
@@ -698,7 +698,7 @@ sub find_tests_to_run {
@tests = find_tests_for_tag($tag, $globstr);
} elsif ($suites{$suite}) {
unless (-d "$TESTSET/$suite/") {
- fail("cannot find $TESTSET/$suite: $!");
+ internal_error("cannot find $TESTSET/$suite: $!");
}
@tests = map { read_test_desc($_) } glob($globstr);
}
@@ -729,7 +729,7 @@ sub run_prove_tests {
}
} elsif ($suites{'scripts'}) {
unless (-d "$TESTSET/scripts") {
- fail("cannot find $TESTSET/scripts: $!");
+ internal_error("cannot find $TESTSET/scripts: $!");
}
@do_run = ("$TESTSET/scripts");
}
@@ -1044,7 +1044,7 @@ sub check_test_is_sane {
my ($dir, $testdir, $data) = @_;
unless ($data->{testname} && exists $data->{version}) {
- fail('Name or Version missing');
+ internal_error('Name or Version missing');
}
$data->{source} ||= $data->{testname};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: