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

[SCM] Debian package checker branch, master, updated. 2.5.3-222-g6ae0b0f



The following commit has been merged in the master branch:
commit 6ae0b0f0c0ab0ed58493d4e4d544b02d7bc44f93
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Nov 17 18:06:57 2011 +0100

    Added check for depending on lower priority packages
    
    The check is limited to binaries built from same source and only
    strong dependencies are considered.
    
    The "circular-deps" check was renamed to "group-checks", which was
    more fitting after adding this new tag.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/circular-deps.desc b/checks/circular-deps.desc
deleted file mode 100644
index 349e406..0000000
--- a/checks/circular-deps.desc
+++ /dev/null
@@ -1,23 +0,0 @@
-Check-Script: circular-deps
-Author: Niels Thykier <niels@thykier.net>
-Abbrev: cdeps
-# This is a source check, so we only calculate the dependency
-# graphs once.
-Type: source
-Info: This script checks for circular dependencies between packages
- built from the same source.
-
-Tag: intra-source-package-circular-dependency
-Severity: normal
-Certainty: certain
-Info: The listed packages from the same source circularly depend
- (or pre-depend) on each other.  This makes it difficult for tools
- to properly handle install/upgrade sequences.  Furthermore this
- complicates automated removal of unused packages.
- .
- If possible, consider removing or reducing one of the depends.
- .
- Note: This check is limited to packages created from the same
- source package.  Full circular dependencies between binaries from
- different source packages is beyond the scope of Lintian.
-Ref: policy 7.2
diff --git a/checks/fields b/checks/fields
index e7a6e68..b3f5355 100644
--- a/checks/fields
+++ b/checks/fields
@@ -64,8 +64,7 @@ our %KNOWN_ARCHIVE_PARTS = map { $_ => 1 }
     ('non-free', 'contrib');
 
 
-our %KNOWN_PRIOS = map { $_ => 1 }
-    ('required', 'important', 'standard', 'optional', 'extra');
+my $KNOWN_PRIOS = Lintian::Data->new ('common/priorities', qr/\s*=\s*/o);
 
 our %known_obsolete_fields = map { $_ => 1 }
     ('revision', 'package-revision', 'package_revision',
@@ -461,7 +460,7 @@ if (not defined $info->field('priority')) {
 
     unfold('priority', \$priority);
 
-    tag 'unknown-priority', $priority if (! $KNOWN_PRIOS{$priority});
+    tag 'unknown-priority', $priority unless $KNOWN_PRIOS->known ($priority);
 
     if ($pkg =~ /-dbg$/) {
         tag 'debug-package-should-be-priority-extra', $pkg
diff --git a/checks/circular-deps b/checks/group-checks
similarity index 78%
rename from checks/circular-deps
rename to checks/group-checks
index eb0591d..13e0365 100644
--- a/checks/circular-deps
+++ b/checks/group-checks
@@ -1,4 +1,4 @@
-# circular-deps -- lintian check script -*- perl -*-
+# group-checks -- lintian check script -*- perl -*-
 
 # Copyright (C) 2011 Niels Thykier <niels@thykier.net>
 #
@@ -18,11 +18,14 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
-package Lintian::circular_deps;
+package Lintian::group_checks;
 use strict;
 use warnings;
 
 use Lintian::Tags qw(tag);
+use Lintian::Data;
+
+my $KNOWN_PRIOS = Lintian::Data->new ('common/priorities', qr/\s*=\s*/o);
 
 sub run {
 
@@ -53,6 +56,7 @@ foreach my $proc ($group->get_processables('binary')) {
         my $pname = $proc->pkg_name;
         push @nodes, $pname;
         $edges{$pname} = [map { $_->pkg_name } @$deps];
+        _check_priorities ($proc, $deps);
     }
 }
 
@@ -60,7 +64,7 @@ foreach my $proc ($group->get_processables('binary')) {
 # on some other package from this source.
 return if scalar @nodes < 2;
 
-$sccs = Lintian::circular_deps::Graph->new(\@nodes, \%edges)->tarjans();
+$sccs = Lintian::group_checks::Graph->new(\@nodes, \%edges)->tarjans();
 
 foreach my $comp (@$sccs) {
     # It takes two to tango... erh. make a circular dependency.
@@ -71,11 +75,32 @@ foreach my $comp (@$sccs) {
 
 }
 
+# Check that $proc has a priority that is less than or equal to that
+# of its dependencies (Policy §2.5)
+sub _check_priorities {
+    my ($proc, $deps) = @_;
+    my $priority = $proc->info->field ('priority');
+    my $pkg_name = $proc->pkg_name;
+    if ($priority) {
+        my $prival = $KNOWN_PRIOS->value ($priority);
+        foreach my $dep (@$deps) {
+            my $dpri = $dep->info->field ('priority') // '';
+            my $dprival = $KNOWN_PRIOS->value ($dpri);
+            # Ignore packages without priorities - we have a separate
+            # check for that.
+            next unless $dprival;
+            tag 'package-depends-on-lower-priority-package', "$pkg_name:$priority",
+                'depends on', $dep->pkg_name . ":$dpri"
+                    unless $prival <= $dprival;
+        }
+    }
+}
+
 ## Encapsulate Tarjan's algorithm in an class/object to keep
 ## the run sub somewhat sane.
-package Lintian::circular_deps::Graph;
+package Lintian::group_checks::Graph;
 
-sub new{
+sub new {
     my ($type, $nodes, $edges) = @_;
     my $self = { nodes => $nodes, edges => $edges};
     bless $self, $type;
diff --git a/checks/group-checks.desc b/checks/group-checks.desc
new file mode 100644
index 0000000..b31ed54
--- /dev/null
+++ b/checks/group-checks.desc
@@ -0,0 +1,35 @@
+Check-Script: group-checks
+Author: Niels Thykier <niels@thykier.net>
+Abbrev: gchck
+# This is a source check, so we only run it once per group
+Type: source
+Info: This script checks for some issues that may appear in packages
+ built from the same source.  This includes intra-source circular
+ dependencies and intra-source priority checks.
+
+Tag: intra-source-package-circular-dependency
+Severity: normal
+Certainty: certain
+Info: The listed packages from the same source circularly depend
+ (or pre-depend) on each other.  This makes it difficult for tools
+ to properly handle install/upgrade sequences.  Furthermore this
+ complicates automated removal of unused packages.
+ .
+ If possible, consider removing or reducing one of the depends.
+ .
+ Note: This check is limited to packages created from the same
+ source package.  Full circular dependencies between binaries from
+ different source packages is beyond the scope of Lintian.
+Ref: policy 7.2
+
+Tag: package-depends-on-lower-priority-package
+Severity: normal
+Certainty: certain
+Ref: policy 2.5, http://qa.debian.org/debcheck.php
+Info: The package depends on a package with lower priority than
+ itself.
+ .
+ Note: This check is limited to packages created from the same source
+ package.  A full check of all dependencies built from different
+ source packages is beyond the scope of Lintian.  The depcheck service
+ can do this.
diff --git a/data/common/priorities b/data/common/priorities
new file mode 100644
index 0000000..937b9dc
--- /dev/null
+++ b/data/common/priorities
@@ -0,0 +1,14 @@
+# Manually maintained map of priorities
+#
+# It is used by checks/fields to validate the priority fields and
+# checks/group-checks to check policy §2.5.  The numbers are used for
+# the latter (allowing a trivial <= comparison)
+#
+# Do not use a non-integer nor a false-value on the right-hand side.
+
+required  = 5
+important = 4
+standard  = 3
+optional  = 2
+extra     = 1
+
diff --git a/debian/changelog b/debian/changelog
index 4ebab6c..d506526 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,11 +2,12 @@ lintian (2.5.4) UNRELEASED; urgency=low
 
   * Summary of tag changes:
     + Added:
+      - data.tar.xz-member-without-dpkg-pre-depends
       - init.d-script-does-not-implement-optional-option
       - missing-build-dependency-for-dh-addon
+      - package-depends-on-lower-priority-package
       - python-depends-but-no-python-helper
       - python3-depends-but-no-python3-helper
-      - data.tar.xz-member-without-dpkg-pre-depends
 
   * checks/*:
     + [JW] Replace common_data.pm with Lintian::Check.
@@ -22,6 +23,12 @@ lintian (2.5.4) UNRELEASED; urgency=low
       Thanks to Loïc Minier for the patch.
     + [NT] Accept release codename in the changes file.  Thanks to
       Julien Cristau for the report.  (Closes: #637540)
+  * checks/circular-deps{,.desc}:
+    + [NT] Renamed to group-checks{,.desc}.
+  * checks/group-checks{,.desc}:
+    + [NT] Added check for depending on lower priority packages built
+      from the same source.  Only strong dependencies are considered.
+      Thanks to Neil Williams for the report.  (Closes: #387166)
   * checks/common_data.pm:
     + [JW] Merged into Lintian::Check.
   * checks/cruft{,.desc}:
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index 14a68d0..b3a39db 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -1,10 +1,10 @@
 # This profile is auto-generated
 Profile: debian/main
 Extends: debian/ftp-master-auto-reject
-Enable-Tags-From-Check: binaries, changelog-file, changes-file, circular-deps, conffiles,
- control-file, control-files, copyright-file, cruft, deb-format, debconf,
- debhelper, debian-readme, debian-source-dir, description, duplicate-files,
- fields, filename-length, files, huge-usr-share, infofiles, init.d, java,
+Enable-Tags-From-Check: binaries, changelog-file, changes-file, conffiles, control-file,
+ control-files, copyright-file, cruft, deb-format, debconf, debhelper,
+ debian-readme, debian-source-dir, description, duplicate-files, fields,
+ filename-length, files, group-checks, huge-usr-share, infofiles, init.d, java,
  lintian, manpages, md5sums, menu-format, menus, nmu, ocaml, patch-systems,
  po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
  symlinks, version-substvars, watch-file
diff --git a/t/COVERAGE b/t/COVERAGE
index b6baffd..ff4f035 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,5 +1,5 @@
 Last generated 2011-11-17
-Coverage: 764/942 (81.10%), w. legacy tests: 873/942 (92.68%)
+Coverage: 765/943 (81.12%), w. legacy tests: 874/943 (92.68%)
 
 The following tags are not tested by the test suite:
 
diff --git a/t/tests/circular-deps/tags b/t/tests/circular-deps/tags
deleted file mode 100644
index fae1932..0000000
--- a/t/tests/circular-deps/tags
+++ /dev/null
@@ -1,2 +0,0 @@
-W: circular-deps source: intra-source-package-circular-dependency c1-a c1-b c1-c
-W: circular-deps source: intra-source-package-circular-dependency c2-a c2-b c2-c
diff --git a/t/tests/circular-deps/debian/debian/control.in b/t/tests/group-checks-circular-deps/debian/debian/control.in
similarity index 100%
rename from t/tests/circular-deps/debian/debian/control.in
rename to t/tests/group-checks-circular-deps/debian/debian/control.in
diff --git a/t/tests/circular-deps/debian/debian/rules b/t/tests/group-checks-circular-deps/debian/debian/rules
similarity index 100%
copy from t/tests/circular-deps/debian/debian/rules
copy to t/tests/group-checks-circular-deps/debian/debian/rules
diff --git a/t/tests/circular-deps/debian/some-doc.txt b/t/tests/group-checks-circular-deps/debian/some-doc.txt
similarity index 100%
copy from t/tests/circular-deps/debian/some-doc.txt
copy to t/tests/group-checks-circular-deps/debian/some-doc.txt
diff --git a/t/tests/circular-deps/desc b/t/tests/group-checks-circular-deps/desc
similarity index 76%
rename from t/tests/circular-deps/desc
rename to t/tests/group-checks-circular-deps/desc
index 3a7eac7..aabdfdf 100644
--- a/t/tests/circular-deps/desc
+++ b/t/tests/group-checks-circular-deps/desc
@@ -1,4 +1,4 @@
-Testname: circular-deps
+Testname: group-checks-circular-deps
 Sequence: 6000
 Version: 1.0
 Description: Test for circular dependencies
diff --git a/t/tests/group-checks-circular-deps/tags b/t/tests/group-checks-circular-deps/tags
new file mode 100644
index 0000000..3a0e980
--- /dev/null
+++ b/t/tests/group-checks-circular-deps/tags
@@ -0,0 +1,2 @@
+W: group-checks-circular-deps source: intra-source-package-circular-dependency c1-a c1-b c1-c
+W: group-checks-circular-deps source: intra-source-package-circular-dependency c2-a c2-b c2-c
diff --git a/t/source/magic-architecture-srcpkg-ok/control.in b/t/tests/group-checks-wrong-priorities/debian/debian/control.in
similarity index 63%
copy from t/source/magic-architecture-srcpkg-ok/control.in
copy to t/tests/group-checks-wrong-priorities/debian/debian/control.in
index a0cc83f..ce480e7 100644
--- a/t/source/magic-architecture-srcpkg-ok/control.in
+++ b/t/tests/group-checks-wrong-priorities/debian/debian/control.in
@@ -1,24 +1,27 @@
 Source: {$srcpkg}
+Priority: extra
 Section: {$section}
-Priority: optional
 Maintainer: {$author}
-Build-Depends: debhelper (>= 7)
 Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
 
-Package: magic-architecture-srcpkg-ok-data
+Package: pkg-optional
 Architecture: all
-Depends: $\{misc:Depends\}
-Description: Test package for "all" plus specific arch in .dscs
+Priority: optional
+Depends: $\{misc:Depends\}, pkg-extra
+Description: {$description} - pkg-optional
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
+ .
+ optional.
 
-Package: magic-architecture-srcpkg-ok
-Architecture: amd64
+Package: pkg-extra
+Architecture: all
 Depends: $\{misc:Depends\}
-Description: Test package for "all" plus specific arch in .dscs (a)
+Description: {$description} - pkg-extra
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
  .
- Architecture specific package.
+ extra.
diff --git a/t/tests/circular-deps/debian/debian/rules b/t/tests/group-checks-wrong-priorities/debian/debian/rules
similarity index 100%
rename from t/tests/circular-deps/debian/debian/rules
rename to t/tests/group-checks-wrong-priorities/debian/debian/rules
diff --git a/t/tests/circular-deps/debian/some-doc.txt b/t/tests/group-checks-wrong-priorities/debian/some-doc.txt
similarity index 100%
rename from t/tests/circular-deps/debian/some-doc.txt
rename to t/tests/group-checks-wrong-priorities/debian/some-doc.txt
diff --git a/t/tests/group-checks-wrong-priorities/desc b/t/tests/group-checks-wrong-priorities/desc
new file mode 100644
index 0000000..0cb541a
--- /dev/null
+++ b/t/tests/group-checks-wrong-priorities/desc
@@ -0,0 +1,5 @@
+Testname: group-checks-wrong-priorities
+Sequence: 6000
+Version: 1.0
+Description: Test for circular dependencies
+Test-For: package-depends-on-lower-priority-package
diff --git a/t/tests/group-checks-wrong-priorities/tags b/t/tests/group-checks-wrong-priorities/tags
new file mode 100644
index 0000000..fc975c9
--- /dev/null
+++ b/t/tests/group-checks-wrong-priorities/tags
@@ -0,0 +1 @@
+W: group-checks-wrong-priorities source: package-depends-on-lower-priority-package pkg-optional:optional depends on pkg-extra:extra
diff --git a/testset/tags.libbaz b/testset/tags.libbaz
index 39f5131..3b0ef46 100644
--- a/testset/tags.libbaz
+++ b/testset/tags.libbaz
@@ -43,6 +43,7 @@ W: libbaz source: debhelper-but-no-misc-depends libbaz2
 W: libbaz source: debhelper-but-no-misc-depends libbaz2-dbg
 W: libbaz source: debhelper-but-no-misc-depends libbaz2-dev
 W: libbaz source: native-package-with-dash-version
+W: libbaz source: package-depends-on-lower-priority-package libbaz2-dbg:optional depends on libbaz2:extra
 W: libbaz source: source-nmu-has-incorrect-version-number 1-1
 W: libbaz source: substvar-source-version-is-deprecated libbaz2-dev
 W: libbaz1-dev: wrong-section-according-to-package-name libbaz1-dev => libdevel

-- 
Debian package checker


Reply to: