Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages.
Date: Mon, 04 Aug 2014 09:11:02
Message-Id: 1407143485-8782-1-git-send-email-mgorny@gentoo.org
1 The idea if that a particular dependency atom matches more than one slot
2 of a package, you are supposed to either use := or :* operator
3 (or a specific :slot dependency), whichever is appropriate.
4
5 This will help catching mistakes (when packages become slotted) and make
6 cross-slot behavior clear (it is undefined with no slot operator). I
7 will estimate the amount of new warnings later.
8 ---
9 bin/repoman | 28 +++++++++++++++++++++++-----
10 1 file changed, 23 insertions(+), 5 deletions(-)
11
12 diff --git a/bin/repoman b/bin/repoman
13 index 71fc7f0..b169393 100755
14 --- a/bin/repoman
15 +++ b/bin/repoman
16 @@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile, StyleWriter
17 from portage.util import writemsg_level
18 from portage.util._argparse import ArgumentParser
19 from portage.package.ebuild.digestgen import digestgen
20 -from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
21 +from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use, \
22 + eapi_has_slot_operator
23
24 if sys.hexversion >= 0x3000000:
25 basestring = str
26 @@ -351,6 +352,7 @@ qahelp = {
27 "LICENSE.deprecated": "This ebuild is listing a deprecated license.",
28 "KEYWORDS.invalid": "This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found",
29 "RDEPEND.implicit": "RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4)",
30 + "RDEPEND.slotop": "RDEPEND matches more than one SLOT but does not use := or :* slot operator",
31 "RDEPEND.suspect": "RDEPEND contains a package that usually only belongs in DEPEND.",
32 "RESTRICT.invalid": "This ebuild contains invalid RESTRICT values.",
33 "digest.assumed": "Existing digest must be assumed correct (Package level only)",
34 @@ -399,6 +401,7 @@ qawarnings = set((
35 "KEYWORDS.missing",
36 "PDEPEND.suspect",
37 "RDEPEND.implicit",
38 +"RDEPEND.slotop",
39 "RDEPEND.suspect",
40 "virtual.suspect",
41 "RESTRICT.invalid",
42 @@ -2047,10 +2050,25 @@ for x in effective_scanlist:
43 # Skip dependency.unknown for blockers, so that we
44 # don't encourage people to remove necessary blockers,
45 # as discussed in bug #382407.
46 - if not is_blocker and \
47 - not portdb.xmatch("match-all", atom) and \
48 - not atom.cp.startswith("virtual/"):
49 - unknown_pkgs.add((mytype, atom.unevaluated_atom))
50 + # Also skip it for slot operator checks.
51 + if not is_blocker:
52 + atom_matches = portdb.xmatch("match-all", atom)
53 + if not atom_matches and not atom.cp.startswith("virtual/"):
54 + unknown_pkgs.add((mytype, atom.unevaluated_atom))
55 +
56 + # If no slot or slot operator is specified in RDEP...
57 + if (not atom.slot and not atom.slot_operator
58 + and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)):
59 + # Check whether it doesn't match more than one.
60 + dep_slots = frozenset(
61 + [portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0]
62 + for cpv in atom_matches])
63 + if len(dep_slots) > 1:
64 + stats[mytype + ".slotop"] += 1
65 + fails[mytype + ".slotop"].append(
66 + relative_path +
67 + ": %s: '%s' matches more than one slot, please use := or :* slot operator" %
68 + (mytype, atom))
69
70 if catdir != "virtual":
71 if not is_blocker and \
72 --
73 2.0.4

Replies