1 |
On Mon, 4 Aug 2014 23:15:59 +0200 |
2 |
Michał Górny <mgorny@g.o> wrote: |
3 |
|
4 |
The idea if that a particular dependency atom matches more than one slot |
5 |
of a package, you are supposed to either use := or :* operator |
6 |
(or a specific :slot dependency), whichever is appropriate. |
7 |
|
8 |
This will help catching mistakes (when packages become slotted) and make |
9 |
cross-slot behavior clear (it is undefined with no slot operator). I |
10 |
will estimate the amount of new warnings later. |
11 |
--- |
12 |
bin/repoman | 28 +++++++++++++++++++++++----- |
13 |
1 file changed, 23 insertions(+), 5 deletions(-) |
14 |
|
15 |
diff --git a/bin/repoman b/bin/repoman |
16 |
index 71fc7f0..4809f52 100755 |
17 |
--- a/bin/repoman |
18 |
+++ b/bin/repoman |
19 |
@@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile, StyleWriter |
20 |
from portage.util import writemsg_level |
21 |
from portage.util._argparse import ArgumentParser |
22 |
from portage.package.ebuild.digestgen import digestgen |
23 |
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use |
24 |
+from portage.eapi import (eapi_has_iuse_defaults, eapi_has_required_use, |
25 |
+ eapi_has_slot_operator) |
26 |
|
27 |
if sys.hexversion >= 0x3000000: |
28 |
basestring = str |
29 |
@@ -299,6 +300,7 @@ qahelp = { |
30 |
"dependency.badindev": "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in developing arch", |
31 |
"dependency.badmaskedindev": "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in developing arch", |
32 |
"dependency.badtilde": "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)", |
33 |
+ "dependency.missingslot": "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator", |
34 |
"dependency.perlcore": "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead.", |
35 |
"dependency.syntax": "Syntax error in dependency string (usually an extra/missing space/parenthesis)", |
36 |
"dependency.unknown": "Ebuild has a dependency that refers to an unknown package (which may be valid if it is a blocker for a renamed/removed package, or is an alternative choice provided by an overlay)", |
37 |
@@ -387,6 +389,7 @@ qawarnings = set(( |
38 |
"dependency.badindev", |
39 |
"dependency.badmaskedindev", |
40 |
"dependency.badtilde", |
41 |
+"dependency.missingslot", |
42 |
"dependency.perlcore", |
43 |
"DESCRIPTION.punctuation", |
44 |
"DESCRIPTION.toolong", |
45 |
@@ -2047,10 +2050,25 @@ for x in effective_scanlist: |
46 |
# Skip dependency.unknown for blockers, so that we |
47 |
# don't encourage people to remove necessary blockers, |
48 |
# as discussed in bug #382407. |
49 |
|
50 |
|
51 |
********** This line is at line #563 in the repoman rewrite branch. |
52 |
|
53 |
The next few lines look like they have your other patch applied... |
54 |
But, to be honest, this is too big a code block to be adding to an already Wwwwwwaaaaaaaaayyyyyyy overloaded |
55 |
code block. This area of the code has already been split up in the rewrite. |
56 |
Please make this check an independent check in it's own file like is being done in the rewrite. |
57 |
It can later be easily moved to the new file structure. I should also only involve adding 1 or 2 lines of code |
58 |
to this code block. |
59 |
|
60 |
- if not is_blocker and \ |
61 |
- not portdb.xmatch("match-all", atom) and \ |
62 |
- not atom.cp.startswith("virtual/"): |
63 |
- unknown_pkgs.add((mytype, atom.unevaluated_atom)) |
64 |
+ # Also skip it for slot operator checks. |
65 |
+ if not is_blocker: |
66 |
+ atom_matches = portdb.xmatch("match-all", atom) |
67 |
+ if not atom_matches and not atom.cp.startswith("virtual/"): |
68 |
+ unknown_pkgs.add((mytype, atom.unevaluated_atom)) |
69 |
+ |
70 |
+ # If no slot or slot operator is specified in RDEP... |
71 |
+ if (not atom.slot and not atom.slot_operator |
72 |
+ and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)): |
73 |
+ # Check whether it doesn't match more than one. |
74 |
+ dep_slots = frozenset( |
75 |
+ [portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0] |
76 |
+ for cpv in atom_matches]) |
77 |
+ if len(dep_slots) > 1: |
78 |
+ stats["dependency.missingslot"] += 1 |
79 |
+ fails["dependency.missingslot"].append( |
80 |
+ relative_path + |
81 |
+ ": %s: '%s' matches more than one slot, please specify an explicit slot and/or use the := or :* slot operator" % |
82 |
+ (mytype, atom)) |
83 |
|
84 |
if catdir != "virtual": |
85 |
if not is_blocker and \ |
86 |
-- |
87 |
2.0.4 |
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
-- |
94 |
Brian Dolbec <dolsen> |