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

Bug#886479: lintian: Please detect packages that currently needs R続!=no



tags 886479 + patch
thanks

Hi,

> lintian: Please detect packages that currently needs R!=no

Draft patch attached:

  commit 5a881408f5f5dc8a2dc69f25e0e3e1f01fd413e0
  Author: Chris Lamb <lamby@debian.org>
  Date:   Sat Jan 6 23:00:35 2018 +0000
  
      Check for packages that should specify Rules-Require-Root. (Closes: #886479)
  
   checks/control-file.desc | 13 +++++++++++++
   checks/control-file.pm   | 19 ++++++++++++++++++-
   debian/changelog         |  3 +++
   3 files changed, 34 insertions(+), 1 deletion(-)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-
>From 5a881408f5f5dc8a2dc69f25e0e3e1f01fd413e0 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Sat, 6 Jan 2018 23:00:35 +0000
Subject: [PATCH] Check for packages that should specify Rules-Require-Root.
 (Closes: #886479)

---
 checks/control-file.desc | 13 +++++++++++++
 checks/control-file.pm   | 19 ++++++++++++++++++-
 debian/changelog         |  3 +++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/checks/control-file.desc b/checks/control-file.desc
index 000f148f9..a63932a7c 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -330,3 +330,16 @@ Severity: classification
 Certainty: certain
 Info: Package requires fakeroot or similar to build binary targets and explicitly declares it.
 Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
+
+Tag: should-specify-rules-requires-root
+Severity: normal
+Certainty: wishlist
+Info: This package builds at least one binary package containing at
+ least one path with a UNIX ownership other than "root:root".
+ .
+ It therefore requires <tt>fakeroot(1)</tt> or similar to build its
+ binary targets.
+ .
+ Please specify (eg.) <tt>Rules-Requires-Root: binary-targets</tt> in
+ the <tt>debian/control</tt> source stanza.
+Ref: /usr/share/doc/dpkg-dev/rootless-builds.txt.gz
diff --git a/checks/control-file.pm b/checks/control-file.pm
index 097696435..45f118a45 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -47,7 +47,7 @@ my $KNOWN_DBG_PACKAGE = Lintian::Data->new(
     });
 
 sub run {
-    my ($pkg, undef, $info) = @_;
+    my ($pkg, undef, $info, undef, $group) = @_;
     my $debian_dir = $info->index_resolved_path('debian/');
     my $dcontrol;
     $dcontrol = $debian_dir->child('control') if $debian_dir;
@@ -381,6 +381,18 @@ sub run {
         tag 'rules-requires-root-implicitly';
     }
 
+    if ($info->source_field('rules-requires-root', 'no') eq 'no') {
+      BINARY:
+        foreach my $proc ($group->get_processables('binary')) {
+            foreach my $file ($proc->info->sorted_index) {
+                my $owner = $file->owner . ':' . $file->group;
+                next if $owner eq 'root:root';
+                tag 'should-specify-rules-requires-root', $file, "($owner)";
+                last BINARY;
+            }
+        }
+    }
+
     # find binary packages that Pre-Depend on multiarch-support without going
     # via ${misc:Pre-Depends}
     if ($info->source_field('build-depends')) {
@@ -529,6 +541,11 @@ sub check_relation {
     return;
 }
 
+sub check_rules_requires_root {
+    my ($info, $group) = @_;
+
+}
+
 1;
 
 # Local Variables:
diff --git a/debian/changelog b/debian/changelog
index 36178feb8..514930601 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@ lintian (2.5.68) UNRELEASED; urgency=medium
       when matching autotools-pkg-config-macro-not-cross-compilation-safe
       by skipping comment lines.  (Closes: #886297)
     + [FL] Fix version parsing for native packages.
+  * checks/control-file.{desc.pm}:
+    + [CL] Check for packages that should specify Rules-Require-Root.
+      (Closes: #886479)
   * checks/debconf.pm:
     + [CL] Don't warn about unknown template type "entropy" when a package
       depends on cdebconf.  (Closes: #677870)
-- 
2.15.1


Reply to: