[SCM] Debian package checker branch, master, updated. 2.5.10-194-gcee76e0
The following commit has been merged in the master branch:
commit cee76e0fcde08ecd87d7dee4be0c232050c4fbce
Author: Niels Thykier <niels@thykier.net>
Date: Sat Oct 13 08:50:00 2012 +0200
L::L::Entry: Fix _init croaking on existing entries
In some cases, _init would croak on loading an entry that exists but
where the "package symlink" (i.e. the one pointing the underlying
package) is broken. This happens whenever the Laboratory outlives the
package itself (e.g. on lintian.d.o).
Secondly, as both constructors now (almost) always have a path the
package, there is no need to do the "resolve symlink" trick to find
the "correct path".
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/lib/Lintian/Lab/Entry.pm b/lib/Lintian/Lab/Entry.pm
index ea3aa45..01acf69 100644
--- a/lib/Lintian/Lab/Entry.pm
+++ b/lib/Lintian/Lab/Entry.pm
@@ -110,7 +110,8 @@ sub new_from_metadata {
$self->{info} = undef; # load on demand.
$self->{coll} = {};
$self->{base_dir} = $base_dir;
- $self->_init ($pkg_path);
+ $self->{pkg_path} = $pkg_path; # Could be undef, _init will fix that
+ $self->_init ();
return $self;
}
@@ -126,6 +127,7 @@ sub _new_from_proc {
$self->{pkg_type} = $proc->pkg_type;
$self->{pkg_src} = $proc->pkg_src;
$self->{pkg_src_version} = $proc->pkg_src_version;
+ $self->{pkg_path} = $proc->pkg_path;
$self->{lab} = $lab;
$self->{info} = undef; # load on demand.
$self->{coll} = {};
@@ -137,7 +139,7 @@ sub _new_from_proc {
$self->{base_dir} = $base_dir;
- $self->_init ($pkg_path);
+ $self->_init (1);
$self->_make_identifier;
if ($proc->isa ('Lintian::Processable::Package')) {
@@ -423,14 +425,15 @@ sub update_status_file {
}
sub _init {
- my ($self, $pkg_path) = @_;
+ my ($self, $newentry) = @_;
my $base_dir = $self->base_dir;
my @data;
my $head;
my $coll;
my $exists = $self->exists;
- if (defined $pkg_path) {
+ if ($newentry) {
+ my $pkg_path = $self->pkg_path;
croak "$pkg_path does not exist." unless -e $pkg_path;
} else {
# This error should not happen unless someone (read: me) breaks
@@ -444,14 +447,16 @@ sub _init {
$link = 'changes' if $pkg_type eq 'changes';
croak "Unknown package type $pkg_type" unless $link;
- # Resolve the link if possible, but else just fall back to the link
- # - this is not safe in case of a "delete and create", but if
- # abs_path fails odds are the package cannot be read anyway.
- $pkg_path = Cwd::abs_path("$base_dir/$link") // "$base_dir/$link";
+ if (not $self->pkg_path) {
+ # This case shouldn't happen unless the entry is missing from the metadata.
+ my $linkp = "$base_dir/$link";
+ # Resolve the link if possible, but else just fall back to the link
+ # - this is not safe in case of a "delete and create", but if
+ # abs_path fails odds are the package cannot be read anyway.
+ $self->{pkg_path} = Cwd::abs_path ("$base_dir/$link") // "$base_dir/$link";
+ }
}
- $self->{pkg_path} = $pkg_path;
-
return unless $exists;
return unless -e "$base_dir/.lintian-status";
@data = read_dpkg_control ("$base_dir/.lintian-status");
--
Debian package checker
Reply to: