* [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages.
@ 2014-08-04 9:11 Michał Górny
2014-08-04 13:20 ` Brian Dolbec
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Michał Górny @ 2014-08-04 9:11 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
The idea if that a particular dependency atom matches more than one slot
of a package, you are supposed to either use := or :* operator
(or a specific :slot dependency), whichever is appropriate.
This will help catching mistakes (when packages become slotted) and make
cross-slot behavior clear (it is undefined with no slot operator). I
will estimate the amount of new warnings later.
---
bin/repoman | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/bin/repoman b/bin/repoman
index 71fc7f0..b169393 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile, StyleWriter
from portage.util import writemsg_level
from portage.util._argparse import ArgumentParser
from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use, \
+ eapi_has_slot_operator
if sys.hexversion >= 0x3000000:
basestring = str
@@ -351,6 +352,7 @@ qahelp = {
"LICENSE.deprecated": "This ebuild is listing a deprecated license.",
"KEYWORDS.invalid": "This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found",
"RDEPEND.implicit": "RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4)",
+ "RDEPEND.slotop": "RDEPEND matches more than one SLOT but does not use := or :* slot operator",
"RDEPEND.suspect": "RDEPEND contains a package that usually only belongs in DEPEND.",
"RESTRICT.invalid": "This ebuild contains invalid RESTRICT values.",
"digest.assumed": "Existing digest must be assumed correct (Package level only)",
@@ -399,6 +401,7 @@ qawarnings = set((
"KEYWORDS.missing",
"PDEPEND.suspect",
"RDEPEND.implicit",
+"RDEPEND.slotop",
"RDEPEND.suspect",
"virtual.suspect",
"RESTRICT.invalid",
@@ -2047,10 +2050,25 @@ for x in effective_scanlist:
# Skip dependency.unknown for blockers, so that we
# don't encourage people to remove necessary blockers,
# as discussed in bug #382407.
- if not is_blocker and \
- not portdb.xmatch("match-all", atom) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
+ # Also skip it for slot operator checks.
+ if not is_blocker:
+ atom_matches = portdb.xmatch("match-all", atom)
+ if not atom_matches and not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ # If no slot or slot operator is specified in RDEP...
+ if (not atom.slot and not atom.slot_operator
+ and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)):
+ # Check whether it doesn't match more than one.
+ dep_slots = frozenset(
+ [portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0]
+ for cpv in atom_matches])
+ if len(dep_slots) > 1:
+ stats[mytype + ".slotop"] += 1
+ fails[mytype + ".slotop"].append(
+ relative_path +
+ ": %s: '%s' matches more than one slot, please use := or :* slot operator" %
+ (mytype, atom))
if catdir != "virtual":
if not is_blocker and \
--
2.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages.
2014-08-04 9:11 [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
@ 2014-08-04 13:20 ` Brian Dolbec
2014-08-04 21:15 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2014-08-13 19:39 ` [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
2 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-08-04 13:20 UTC (permalink / raw
To: gentoo-portage-dev
On Mon, 4 Aug 2014 11:11:25 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> The idea if that a particular dependency atom matches more than one
> slot of a package, you are supposed to either use := or :* operator
> (or a specific :slot dependency), whichever is appropriate.
>
> This will help catching mistakes (when packages become slotted) and
> make cross-slot behavior clear (it is undefined with no slot
> operator). I will estimate the amount of new warnings later.
> ---
> bin/repoman | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/bin/repoman b/bin/repoman
> index 71fc7f0..b169393 100755
> --- a/bin/repoman
> +++ b/bin/repoman
> @@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile,
> StyleWriter from portage.util import writemsg_level
> from portage.util._argparse import ArgumentParser
> from portage.package.ebuild.digestgen import digestgen
> -from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
> +from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use, \
> + eapi_has_slot_operator
>
+from portage.eapi import (eapi_has_iuse_defaults, eapi_has_required_use,
+ eapi_has_slot_operator)
Please use brackets for long imports instead of using line continuation backslashes
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gentoo-portage-dev] [PATCH v2] repoman: check for ebuilds not using slot operator against multi-slot packages.
2014-08-04 9:11 [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
2014-08-04 13:20 ` Brian Dolbec
@ 2014-08-04 21:15 ` Michał Górny
2014-08-04 21:56 ` Michał Górny
2014-08-06 21:53 ` Brian Dolbec
2014-08-13 19:39 ` [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
2 siblings, 2 replies; 7+ messages in thread
From: Michał Górny @ 2014-08-04 21:15 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
The idea if that a particular dependency atom matches more than one slot
of a package, you are supposed to either use := or :* operator
(or a specific :slot dependency), whichever is appropriate.
This will help catching mistakes (when packages become slotted) and make
cross-slot behavior clear (it is undefined with no slot operator). I
will estimate the amount of new warnings later.
---
bin/repoman | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/bin/repoman b/bin/repoman
index 71fc7f0..4809f52 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile, StyleWriter
from portage.util import writemsg_level
from portage.util._argparse import ArgumentParser
from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.eapi import (eapi_has_iuse_defaults, eapi_has_required_use,
+ eapi_has_slot_operator)
if sys.hexversion >= 0x3000000:
basestring = str
@@ -299,6 +300,7 @@ qahelp = {
"dependency.badindev": "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in developing arch",
"dependency.badmaskedindev": "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in developing arch",
"dependency.badtilde": "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)",
+ "dependency.missingslot": "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator",
"dependency.perlcore": "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead.",
"dependency.syntax": "Syntax error in dependency string (usually an extra/missing space/parenthesis)",
"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)",
@@ -387,6 +389,7 @@ qawarnings = set((
"dependency.badindev",
"dependency.badmaskedindev",
"dependency.badtilde",
+"dependency.missingslot",
"dependency.perlcore",
"DESCRIPTION.punctuation",
"DESCRIPTION.toolong",
@@ -2047,10 +2050,25 @@ for x in effective_scanlist:
# Skip dependency.unknown for blockers, so that we
# don't encourage people to remove necessary blockers,
# as discussed in bug #382407.
- if not is_blocker and \
- not portdb.xmatch("match-all", atom) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
+ # Also skip it for slot operator checks.
+ if not is_blocker:
+ atom_matches = portdb.xmatch("match-all", atom)
+ if not atom_matches and not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ # If no slot or slot operator is specified in RDEP...
+ if (not atom.slot and not atom.slot_operator
+ and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)):
+ # Check whether it doesn't match more than one.
+ dep_slots = frozenset(
+ [portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0]
+ for cpv in atom_matches])
+ if len(dep_slots) > 1:
+ stats["dependency.missingslot"] += 1
+ fails["dependency.missingslot"].append(
+ relative_path +
+ ": %s: '%s' matches more than one slot, please specify an explicit slot and/or use the := or :* slot operator" %
+ (mytype, atom))
if catdir != "virtual":
if not is_blocker and \
--
2.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v2] repoman: check for ebuilds not using slot operator against multi-slot packages.
2014-08-04 21:15 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
@ 2014-08-04 21:56 ` Michał Górny
2014-08-06 21:53 ` Brian Dolbec
1 sibling, 0 replies; 7+ messages in thread
From: Michał Górny @ 2014-08-04 21:56 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]
Dnia 2014-08-04, o godz. 23:15:59
Michał Górny <mgorny@gentoo.org> napisał(a):
> The idea if that a particular dependency atom matches more than one slot
> of a package, you are supposed to either use := or :* operator
> (or a specific :slot dependency), whichever is appropriate.
>
> This will help catching mistakes (when packages become slotted) and make
> cross-slot behavior clear (it is undefined with no slot operator). I
> will estimate the amount of new warnings later.
So, I don't know if this patch affects repoman speed really. It reuses
the result of xmatch() that is done for 'dependency.unknown' but calls
aux_get() to obtain SLOT additionally.
As for the result, it gives 3941 new repoman warnings. Most of them are
packages that had compatibility slots introduced without updating
rev-deps, e.g.:
app-admin/apache-tools/apache-tools-2.4.10.ebuild: RDEPEND: 'dev-libs/openssl'
app-admin/augeas/augeas-0.10.0-r1.ebuild: RDEPEND: 'sys-libs/readline'
app-admin/logstalgia/logstalgia-1.0.3-r1.ebuild: RDEPEND: 'virtual/jpeg'
Some of them clearly ask for missing :=
app-arch/rpm/rpm-4.11.2.ebuild: RDEPEND: '>=sys-libs/db-4.5'
and some likely for eclass or some kind of :*
app-accessibility/brltty/brltty-5.0-r3.ebuild: RDEPEND: '>=virtual/jre-1.4'
app-text/docbook-xsl-stylesheets/docbook-xsl-stylesheets-1.78.0.ebuild: RDEPEND: 'dev-lang/ruby'
(of course, the check works only for EAPI=5 packages)
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v2] repoman: check for ebuilds not using slot operator against multi-slot packages.
2014-08-04 21:15 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2014-08-04 21:56 ` Michał Górny
@ 2014-08-06 21:53 ` Brian Dolbec
2014-08-07 12:56 ` [gentoo-portage-dev] [PATCH v3] repoman: add check for missing slot values/slot operators Michał Górny
1 sibling, 1 reply; 7+ messages in thread
From: Brian Dolbec @ 2014-08-06 21:53 UTC (permalink / raw
To: gentoo-portage-dev
On Mon, 4 Aug 2014 23:15:59 +0200
Michał Górny <mgorny@gentoo.org> wrote:
The idea if that a particular dependency atom matches more than one slot
of a package, you are supposed to either use := or :* operator
(or a specific :slot dependency), whichever is appropriate.
This will help catching mistakes (when packages become slotted) and make
cross-slot behavior clear (it is undefined with no slot operator). I
will estimate the amount of new warnings later.
---
bin/repoman | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/bin/repoman b/bin/repoman
index 71fc7f0..4809f52 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,8 @@ from portage.output import ConsoleStyleFile, StyleWriter
from portage.util import writemsg_level
from portage.util._argparse import ArgumentParser
from portage.package.ebuild.digestgen import digestgen
-from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.eapi import (eapi_has_iuse_defaults, eapi_has_required_use,
+ eapi_has_slot_operator)
if sys.hexversion >= 0x3000000:
basestring = str
@@ -299,6 +300,7 @@ qahelp = {
"dependency.badindev": "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in developing arch",
"dependency.badmaskedindev": "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in developing arch",
"dependency.badtilde": "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)",
+ "dependency.missingslot": "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator",
"dependency.perlcore": "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead.",
"dependency.syntax": "Syntax error in dependency string (usually an extra/missing space/parenthesis)",
"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)",
@@ -387,6 +389,7 @@ qawarnings = set((
"dependency.badindev",
"dependency.badmaskedindev",
"dependency.badtilde",
+"dependency.missingslot",
"dependency.perlcore",
"DESCRIPTION.punctuation",
"DESCRIPTION.toolong",
@@ -2047,10 +2050,25 @@ for x in effective_scanlist:
# Skip dependency.unknown for blockers, so that we
# don't encourage people to remove necessary blockers,
# as discussed in bug #382407.
********** This line is at line #563 in the repoman rewrite branch.
The next few lines look like they have your other patch applied...
But, to be honest, this is too big a code block to be adding to an already Wwwwwwaaaaaaaaayyyyyyy overloaded
code block. This area of the code has already been split up in the rewrite.
Please make this check an independent check in it's own file like is being done in the rewrite.
It can later be easily moved to the new file structure. I should also only involve adding 1 or 2 lines of code
to this code block.
- if not is_blocker and \
- not portdb.xmatch("match-all", atom) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
+ # Also skip it for slot operator checks.
+ if not is_blocker:
+ atom_matches = portdb.xmatch("match-all", atom)
+ if not atom_matches and not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ # If no slot or slot operator is specified in RDEP...
+ if (not atom.slot and not atom.slot_operator
+ and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)):
+ # Check whether it doesn't match more than one.
+ dep_slots = frozenset(
+ [portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0]
+ for cpv in atom_matches])
+ if len(dep_slots) > 1:
+ stats["dependency.missingslot"] += 1
+ fails["dependency.missingslot"].append(
+ relative_path +
+ ": %s: '%s' matches more than one slot, please specify an explicit slot and/or use the := or :* slot operator" %
+ (mytype, atom))
if catdir != "virtual":
if not is_blocker and \
--
2.0.4
--
Brian Dolbec <dolsen>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-portage-dev] [PATCH v3] repoman: add check for missing slot values/slot operators.
2014-08-06 21:53 ` Brian Dolbec
@ 2014-08-07 12:56 ` Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2014-08-07 12:56 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
The idea if that a particular dependency atom matches more than one slot
of a package, you are supposed to either use := or :* operator
(or a specific :slot dependency), whichever is appropriate.
This will help catching mistakes (when packages become slotted) and make
cross-slot behavior clear (it is undefined with no slot operator). I
will estimate the amount of new warnings later.
---
bin/repoman | 6 ++++++
pym/repoman/check_missingslot.py | 25 +++++++++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 pym/repoman/check_missingslot.py
diff --git a/bin/repoman b/bin/repoman
index 71fc7f0..251012e 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -58,6 +58,7 @@ from portage import _encodings
from portage import _unicode_encode
import repoman.checks
from repoman.checks import run_checks
+from repoman.check_missingslot import check_missingslot
from repoman import utilities
from repoman.herdbase import make_herd_base
from _emerge.Package import Package
@@ -299,6 +300,7 @@ qahelp = {
"dependency.badindev": "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in developing arch",
"dependency.badmaskedindev": "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in developing arch",
"dependency.badtilde": "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)",
+ "dependency.missingslot": "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator",
"dependency.perlcore": "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead.",
"dependency.syntax": "Syntax error in dependency string (usually an extra/missing space/parenthesis)",
"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)",
@@ -387,6 +389,7 @@ qawarnings = set((
"dependency.badindev",
"dependency.badmaskedindev",
"dependency.badtilde",
+"dependency.missingslot",
"dependency.perlcore",
"DESCRIPTION.punctuation",
"DESCRIPTION.toolong",
@@ -2098,6 +2101,9 @@ for x in effective_scanlist:
" with a non-zero revision:" + \
" '%s'") % (mytype, atom))
+ check_missingslot(atom, mytype, eapi, portdb, stats, fails,
+ relative_path)
+
type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
for m, b in zip(type_list, badsyntax):
diff --git a/pym/repoman/check_missingslot.py b/pym/repoman/check_missingslot.py
new file mode 100644
index 0000000..1da2ac1
--- /dev/null
+++ b/pym/repoman/check_missingslot.py
@@ -0,0 +1,25 @@
+# repoman: missing slot check
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""This module contains the check used to find missing slot values
+in dependencies."""
+
+from portage.eapi import eapi_has_slot_operator
+
+def check_missingslot(atom, mytype, eapi, portdb, stats, fails, relative_path):
+ # If no slot or slot operator is specified in RDEP...
+ if (not atom.blocker and not atom.slot and not atom.slot_operator
+ and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)):
+ # Check whether it doesn't match more than one.
+ atom_matches = portdb.xmatch("match-all", atom)
+ dep_slots = frozenset(
+ portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0]
+ for cpv in atom_matches)
+
+ if len(dep_slots) > 1:
+ stats["dependency.missingslot"] += 1
+ fails["dependency.missingslot"].append(
+ relative_path +
+ ": %s: '%s' matches more than one slot, please specify an explicit slot and/or use the := or :* slot operator" %
+ (mytype, atom))
--
2.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages.
2014-08-04 9:11 [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
2014-08-04 13:20 ` Brian Dolbec
2014-08-04 21:15 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
@ 2014-08-13 19:39 ` Michał Górny
2 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2014-08-13 19:39 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
Dnia 2014-08-04, o godz. 11:11:25
Michał Górny <mgorny@gentoo.org> napisał(a):
> The idea if that a particular dependency atom matches more than one slot
> of a package, you are supposed to either use := or :* operator
> (or a specific :slot dependency), whichever is appropriate.
>
> This will help catching mistakes (when packages become slotted) and make
> cross-slot behavior clear (it is undefined with no slot operator). I
> will estimate the amount of new warnings later.
The patch has been resent in a new thread [1].
[1]:http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4411
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-13 19:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 9:11 [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
2014-08-04 13:20 ` Brian Dolbec
2014-08-04 21:15 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2014-08-04 21:56 ` Michał Górny
2014-08-06 21:53 ` Brian Dolbec
2014-08-07 12:56 ` [gentoo-portage-dev] [PATCH v3] repoman: add check for missing slot values/slot operators Michał Górny
2014-08-13 19:39 ` [gentoo-portage-dev] [PATCH] repoman: check for ebuilds not using slot operator against multi-slot packages Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox