[SCM] Debian package checker branch, master, updated. 2.5.9-32-g744d789
The following commit has been merged in the master branch:
commit 744d789ab061586bf0b7e727052a1df1433b0482
Author: Niels Thykier <niels@thykier.net>
Date: Sat Jun 16 13:18:07 2012 +0200
L::Util: Remove Lintian::Output dependency
This does cause a slight behavioural change to "fail()". Previously
fail would join multiple arguments with newline (and prefix each line
with "internal error: "); now it joins arugments with a space.
The multiple argument calling convention does not seem to be used
currently, so this change should not cause any issues.
The second change is that arugment-less calls to fail will now include
filename and line number of the caller. This gives slightly better
possibility for tracking down the issue - compare:
internal error: no such file or direction
- to -
internal error: no such file or direction (called from $filename:$line)
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index 0f32802..2d949fa 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -77,7 +77,6 @@ BEGIN {
use Encode ();
use FileHandle;
use Lintian::Command qw(spawn);
-use Lintian::Output qw(string);
use Digest::MD5;
use Scalar::Util qw(openhandle);
@@ -804,21 +803,29 @@ sub touch_file {
return 1;
}
-=item fail (MSG)
+=item fail (MSG[, ...])
-Use to signal an internal error. MSG will be a diagnostic printed to
-the user.
+Use to signal an internal error. The argument(s) will used to print a
+dianostic message to the user.
+
+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.
=cut
sub fail {
- my $str;
+ my $str = 'internal error: ';
if (@_) {
- $str = string('internal error', @_);
- } elsif ($!) {
- $str = string('internal error', $!);
+ $str .= join " ", @_;
} else {
- $str = string('internal error');
+ my (undef, $filename, $line) = caller;
+ if ($!) {
+ $str .= "$!";
+ } else {
+ $str .= "No context.";
+ }
+ $str .= " (called from $filename:$line)\n";
}
$! = 2; # set return code outside eval()
die $str;
--
Debian package checker
Reply to: