[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, lab-refactor, updated. 2.5.3-81-g650d9ec



The following commit has been merged in the lab-refactor branch:
commit 650d9ec4107e4d38ce5e4607a61ece3c3b665e33
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Sep 28 15:15:26 2011 +0200

    Use the source name as name of changes processables
    
    Previously the "name" of a changes processable was the base name
    without the ".changes" extension.  However, this "adds" the version
    and the (build host) architecture to the name[1].
    
    The consequence of this was that a changes file is stored in a
    different part of the lab than source (and binary) packages.  Example:
    
     l/lintian/             - binary and source are stored here
     l/lintian_2.5.2_amd64/ - changes file is stored here
    
    By using the source field[2], the changes are now stored next to the
    relevant source package.
    
    This also makes querying the lab for a changes file a lot easier.  Compare
    the old query:
    
      $lab->get_package ("lintian_2.5.2_amd64", '2.5.2', 'source all');
    
    to the new query:
    
      $lab->get_package ('lintian', '2.5.2', 'source all');
    
    [1] The latter being different from $proc->pkg_arch in a lot of cases.
    
    [2] In its absence, fall back to the first part of the base name
    excluding "_".
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/lib/Lintian/Processable/Package.pm b/lib/Lintian/Processable/Package.pm
index 0c510a2..17cda14 100644
--- a/lib/Lintian/Processable/Package.pm
+++ b/lib/Lintian/Processable/Package.pm
@@ -117,11 +117,16 @@ sub _init {
         $self->{pkg_src_version} = $pkg_version;
     } elsif ($pkg_type eq 'changes'){
         my $cinfo = get_dsc_info ($pkg_path) or croak "$pkg_path is not a valid changes file";
-        my ($pkg_name) = ($pkg_path =~ m,.*/([^/]+)\.changes,);
         my $pkg_version = $cinfo->{version};
+        my $pkg_name = $cinfo->{source}//'';
+        unless ($pkg_name) {
+            # No source field? Derive the name from the file name
+            # lintian_2.5.2_amd64.changes => $pkg_name = 'lintian'
+            ($pkg_name) = ($pkg_path =~ m,.*/([^_/]+)[^/]*+\.changes$,);
+        }
         $self->{pkg_name} = $pkg_name;
         $self->{pkg_version} = $pkg_version;
-        $self->{pkg_src} = $cinfo->{source}//$pkg_name;
+        $self->{pkg_src} = $pkg_name;
         $self->{pkg_src_version} = $pkg_version;
         $self->{pkg_arch} = $cinfo->{architecture};
     } else {

-- 
Debian package checker


Reply to: