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

[lintian] 03/04: c/src-cpy: Migrate to L::Path API



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 34cca6d03e0b52297a59f9d7877b77073cca5d2f
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Sep 27 18:41:20 2014 +0200

    c/src-cpy: Migrate to L::Path API
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/source-copyright.desc |  2 +-
 checks/source-copyright.pm   | 29 ++++++++++++-----------------
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/checks/source-copyright.desc b/checks/source-copyright.desc
index ba7581f..d010f6d 100644
--- a/checks/source-copyright.desc
+++ b/checks/source-copyright.desc
@@ -2,7 +2,7 @@ Check-Script: source-copyright
 Author: Jakub Wilk <jwilk@debian.org>
 Abbrev: scpy
 Type: source
-Needs-Info: debfiles, unpacked
+Needs-Info: unpacked
 Info: This script checks if a source package conforms to policy
  with regard to copyright files.
  .
diff --git a/checks/source-copyright.pm b/checks/source-copyright.pm
index f3c42a4..d51bf7a 100644
--- a/checks/source-copyright.pm
+++ b/checks/source-copyright.pm
@@ -54,32 +54,27 @@ my %dep5_renamed_fields        = (
 
 sub run {
     my (undef, undef, $info) = @_;
-    my $copyright_filename = $info->debfiles('copyright');
+    my $debian_dir = $info->index_resolved_path('debian/');
+    return if not $debian_dir;
+    my $copyright_path = $debian_dir->child('copyright');
 
-    if (-l $copyright_filename) {
-        tag 'debian-copyright-is-symlink';
-        return;
-    }
-
-    if (not -f $copyright_filename) {
+    if (not $copyright_path) {
         my @pkgs = $info->binaries;
         tag 'no-debian-copyright';
-        $copyright_filename = undef;
         if (scalar @pkgs == 1) {
-
             # If debian/copyright doesn't exist, and the only a single
             # binary package is built, there's a good chance that the
             # copyright file is available as
             # debian/<pkgname>.copyright.
-            $copyright_filename = $info->debfiles($pkgs[0] . '.copyright');
-            if (not -f $copyright_filename or -l $copyright_filename) {
-                $copyright_filename = undef;
-            }
+            $copyright_path = $debian_dir->child($pkgs[0] . '.copyright');
         }
+        return if not $copyright_path;
+    } elsif ($copyright_path->is_symlink) {
+        tag 'debian-copyright-is-symlink';
     }
 
-    if (defined($copyright_filename)) {
-        _check_dep5_copyright($info, $copyright_filename);
+    if ($copyright_path->is_open_ok) {
+        _check_dep5_copyright($info, $copyright_path);
     }
     return;
 }
@@ -148,8 +143,8 @@ sub _find_dep5_version {
 }
 
 sub _check_dep5_copyright {
-    my ($info, $copyright_filename) = @_;
-    my $contents = slurp_entire_file($copyright_filename);
+    my ($info, $copyright_path) = @_;
+    my $contents = $copyright_path->file_contents;
     my (@dep5, @lines);
 
     if (

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: