* [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/
@ 2016-06-18 17:01 Sergei Trofimovich
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline Sergei Trofimovich
` (3 more replies)
0 siblings, 4 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 17:01 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich
From: Sergei Trofimovich <siarheit@google.com>
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
repoman/pym/repoman/modules/scan/depend/profile.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py b/repoman/pym/repoman/modules/scan/depend/profile.py
index a714a93..cf3d9a8 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -51,7 +51,7 @@ class ProfileDependsChecks(ScanBase):
self.repo_metadata = kwargs.get('repo_metadata')
def check(self, **kwargs):
- '''Perform profile dependant dependancy checks
+ '''Perform profile dependant dependency checks
@param arches:
@param pkg: Package in which we check (object).
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline
2016-06-18 17:01 [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/ Sergei Trofimovich
@ 2016-06-18 17:01 ` Sergei Trofimovich
2016-06-18 18:06 ` Brian Dolbec
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative Sergei Trofimovich
` (2 subsequent siblings)
3 siblings, 1 reply; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 17:01 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich
From: Sergei Trofimovich <siarheit@google.com>
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
pym/portage/dep/dep_check.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 9af4e65..76e5d82 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -688,8 +688,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
else:
try:
mysplit = use_reduce(depstring, uselist=myusesplit,
- masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
- opconvert=True, token_class=Atom, eapi=eapi)
+ masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
+ opconvert=True, token_class=Atom, eapi=eapi)
except InvalidDependString as e:
return [0, "%s" % (e,)]
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative
2016-06-18 17:01 [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/ Sergei Trofimovich
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline Sergei Trofimovich
@ 2016-06-18 17:01 ` Sergei Trofimovich
2016-06-18 18:02 ` Brian Dolbec
2016-06-18 18:29 ` [gentoo-portage-dev] Re: [PATCH] repoman: typo in docstring s/dependancy/dependency/ Zac Medico
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] repoman/modules/.../profile.py: " Sergei Trofimovich
3 siblings, 1 reply; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 17:01 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich, qa, mgorny
From: Sergei Trofimovich <siarheit@google.com>
A few links discussing what can go wrong with slot operator under '||':
https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
The main problem here is how vdb gets updated when you have a dependency of style:
RDEPEND="|| ( foo:= bar:= )"
depending on what you have installed in system: only 'foo'/'bar' or both 'foo' and 'bar'.
I'm about to add actual test for some examples to gen-b0rk.
New repoman complains on them as follows:
RDEPEND="|| ( =not-broken/pkg1-subslot-0:= =not-broken/pkg1-subslot-1:0= )"
Yields:
dependency.badslotop [fatal] 2
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under '||' dep clause.
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator under '||' dep clause.
CC: qa@gentoo.org
CC: mgorny@gentoo.org
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
repoman/pym/repoman/check_slotop.py | 32 ++++++++++++++++++++++
.../repoman/modules/scan/depend/_depend_checks.py | 17 ++++++++++++
repoman/pym/repoman/qa_data.py | 2 ++
3 files changed, 51 insertions(+)
create mode 100644 repoman/pym/repoman/check_slotop.py
diff --git a/repoman/pym/repoman/check_slotop.py b/repoman/pym/repoman/check_slotop.py
new file mode 100644
index 0000000..3c3aec1
--- /dev/null
+++ b/repoman/pym/repoman/check_slotop.py
@@ -0,0 +1,32 @@
+# -*- coding:utf-8 -*-
+# repoman: missing slot check
+# Copyright 2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+"""This module contains the check used to find ':=' slot operator
+uses in '||' style dependencies."""
+
+from portage.dep import Atom
+
+def check_slotop(dep_tree, mytype, qatracker, relative_path):
+ def _traverse_tree(dep_tree, is_under_any_of):
+ # leaf
+ if isinstance(dep_tree, Atom):
+ atom = dep_tree
+ if is_under_any_of and atom.slot_operator:
+ qatracker.add_error("dependency.badslotop", relative_path +
+ ": %s: '%s' uses ':=' slot operator under '||' dep clause." %
+ (mytype, atom))
+
+ # branches
+ if isinstance(dep_tree, list):
+ if len(dep_tree) == 0:
+ return
+ # any-of
+ if dep_tree[0] == '||':
+ _traverse_tree(dep_tree[1:], True)
+ else:
+ for branch in dep_tree:
+ _traverse_tree(branch, is_under_any_of)
+
+ _traverse_tree(dep_tree, False)
diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 4e1d216..1fd69d4 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -4,6 +4,7 @@
from _emerge.Package import Package
from repoman.check_missingslot import check_missingslot
+from repoman.check_slotop import check_slotop
# import our initialized portage instance
from repoman._portage import portage
from repoman.qa_data import suspect_virtual, suspect_rdepend
@@ -117,6 +118,22 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+ if runtime:
+ try:
+ # to find use of ':=' in '||' we preserve
+ # tree structure of dependencies
+ hier_atoms = portage.dep.use_reduce(
+ mydepstr,
+ flat=False,
+ matchall=1,
+ is_valid_flag=pkg.iuse.is_valid_flag,
+ opconvert=True,
+ token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ hier_atoms = None
+ badsyntax.append(str(e))
+ check_slotop(hier_atoms, mytype, qatracker, ebuild.relative_path)
+
for m, b in zip(type_list, badsyntax):
if m.endswith("DEPEND"):
qacat = "dependency.syntax"
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index b9475e8..48ab389 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -58,6 +58,8 @@ qahelp = {
"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)"),
+ "dependency.badslotop": (
+ "RDEPEND contains ':=' slot operator under '||' dependency."),
"file.executable": (
"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need"
" the executable bit"),
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative Sergei Trofimovich
@ 2016-06-18 18:02 ` Brian Dolbec
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] " Sergei Trofimovich
[not found] ` <20160618203706.3fd97cb6@sf>
0 siblings, 2 replies; 19+ messages in thread
From: Brian Dolbec @ 2016-06-18 18:02 UTC (permalink / raw
To: gentoo-portage-dev
On Sat, 18 Jun 2016 18:01:11 +0100
Sergei Trofimovich <slyfox@gentoo.org> wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> A few links discussing what can go wrong with slot operator under
> '||':
> https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
> https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
>
> The main problem here is how vdb gets updated when you have a
> dependency of style: RDEPEND="|| ( foo:= bar:= )"
> depending on what you have installed in system: only 'foo'/'bar' or
> both 'foo' and 'bar'.
>
> I'm about to add actual test for some examples to gen-b0rk.
>
> New repoman complains on them as follows:
>
> RDEPEND="|| ( =not-broken/pkg1-subslot-0:=
> =not-broken/pkg1-subslot-1:0= )"
>
> Yields:
>
> dependency.badslotop [fatal] 2
> ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild:
> RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under
> '||' dep clause.
> ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild:
> RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator
> under '||' dep clause.
>
> CC: qa@gentoo.org
> CC: mgorny@gentoo.org
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> repoman/pym/repoman/check_slotop.py | 32
> ++++++++++++++++++++++ .../repoman/modules/scan/depend/_depend_checks.py
> | 17 ++++++++++++ repoman/pym/repoman/qa_data.py
> | 2 ++ 3 files changed, 51 insertions(+)
> create mode 100644 repoman/pym/repoman/check_slotop.py
>
Hmm, this file should be in the module namespace, not in the base
repoman namespace. It is not used anywhere else, so should be in the
module like _depend_checks.py
Another alternative is just add it to _depend_checks.py, it isn't a
very large file and is the only place this code is used.
> diff --git a/repoman/pym/repoman/check_slotop.py
> b/repoman/pym/repoman/check_slotop.py new file mode 100644
> index 0000000..3c3aec1
> --- /dev/null
> +++ b/repoman/pym/repoman/check_slotop.py
> @@ -0,0 +1,32 @@
> +# -*- coding:utf-8 -*-
> +# repoman: missing slot check
> +# Copyright 2016 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +
> +"""This module contains the check used to find ':=' slot operator
> +uses in '||' style dependencies."""
> +
> +from portage.dep import Atom
> +
> +def check_slotop(dep_tree, mytype, qatracker, relative_path):
> + def _traverse_tree(dep_tree, is_under_any_of):
> + # leaf
> + if isinstance(dep_tree, Atom):
> + atom = dep_tree
> + if is_under_any_of and atom.slot_operator:
> +
> qatracker.add_error("dependency.badslotop", relative_path +
> + ": %s: '%s' uses ':=' slot
> operator under '||' dep clause." %
> + (mytype, atom))
> +
> + # branches
> + if isinstance(dep_tree, list):
> + if len(dep_tree) == 0:
> + return
> + # any-of
> + if dep_tree[0] == '||':
> + _traverse_tree(dep_tree[1:], True)
> + else:
> + for branch in dep_tree:
> + _traverse_tree(branch,
> is_under_any_of) +
> + _traverse_tree(dep_tree, False)
> diff --git
> a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
> b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py index
> 4e1d216..1fd69d4 100644 ---
> a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py +++
> b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py @@ -4,6
> +4,7 @@ from _emerge.Package import Package
> from repoman.check_missingslot import check_missingslot
> +from repoman.check_slotop import check_slotop
> # import our initialized portage instance
> from repoman._portage import portage
> from repoman.qa_data import suspect_virtual, suspect_rdepend
> @@ -117,6 +118,22 @@ def _depend_checks(ebuild, pkg, portdb,
> qatracker, repo_metadata):
> type_list.extend([mytype] * (len(badsyntax) -
> len(type_list)))
> + if runtime:
> + try:
> + # to find use of ':=' in '||' we
> preserve
> + # tree structure of dependencies
> + hier_atoms = portage.dep.use_reduce(
> + mydepstr,
> + flat=False,
> + matchall=1,
> +
> is_valid_flag=pkg.iuse.is_valid_flag,
> + opconvert=True,
> + token_class=token_class)
> + except portage.exception.InvalidDependString
> as e:
> + hier_atoms = None
> + badsyntax.append(str(e))
> + check_slotop(hier_atoms, mytype, qatracker,
> ebuild.relative_path)
Is there a special reason this code can not be part of the
check_slotop()? All it has is the one statement calling it's internal
recursive function. Then all this code would would be replaced here by
the one check_slotop() which adds to badsyntax.
> for m, b in zip(type_list, badsyntax):
> if m.endswith("DEPEND"):
> qacat = "dependency.syntax"
> diff --git a/repoman/pym/repoman/qa_data.py
> b/repoman/pym/repoman/qa_data.py index b9475e8..48ab389 100644
> --- a/repoman/pym/repoman/qa_data.py
> +++ b/repoman/pym/repoman/qa_data.py
> @@ -58,6 +58,8 @@ qahelp = {
> "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)"),
> + "dependency.badslotop": (
> + "RDEPEND contains ':=' slot operator under '||'
> dependency."), "file.executable": (
> "Ebuilds, digests, metadata.xml, Manifest, and
> ChangeLog do not need" " the executable bit"),
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline Sergei Trofimovich
@ 2016-06-18 18:06 ` Brian Dolbec
2016-06-18 19:26 ` [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, " Sergei Trofimovich
0 siblings, 1 reply; 19+ messages in thread
From: Brian Dolbec @ 2016-06-18 18:06 UTC (permalink / raw
To: gentoo-portage-dev
On Sat, 18 Jun 2016 18:01:10 +0100
Sergei Trofimovich <slyfox@gentoo.org> wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> pym/portage/dep/dep_check.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pym/portage/dep/dep_check.py
> b/pym/portage/dep/dep_check.py index 9af4e65..76e5d82 100644
> --- a/pym/portage/dep/dep_check.py
> +++ b/pym/portage/dep/dep_check.py
> @@ -688,8 +688,8 @@ def dep_check(depstring, mydbapi, mysettings,
> use="yes", mode=None, myuse=None, else:
> try:
> mysplit = use_reduce(depstring,
> uselist=myusesplit,
> - masklist=mymasks, matchall=(use=="all"),
> excludeall=useforce,
> - opconvert=True, token_class=Atom, eapi=eapi)
> + masklist=mymasks,
> matchall=(use=="all"), excludeall=useforce,
> + opconvert=True, token_class=Atom,
> eapi=eapi) except InvalidDependString as e:
> return [0, "%s" % (e,)]
>
Looks good other than the "repoman:" in the summary. You may have
found this via your repoman changes, but this is a portage namespace
file. Plus only one file.
so...
portage/dep/depcheck.py: Whitespace, add indentation level after newline
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] Re: [PATCH] repoman: typo in docstring s/dependancy/dependency/
2016-06-18 17:01 [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/ Sergei Trofimovich
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline Sergei Trofimovich
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative Sergei Trofimovich
@ 2016-06-18 18:29 ` Zac Medico
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] repoman/modules/.../profile.py: " Sergei Trofimovich
3 siblings, 0 replies; 19+ messages in thread
From: Zac Medico @ 2016-06-18 18:29 UTC (permalink / raw
To: Sergei Trofimovich, gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich
On 06/18/2016 10:01 AM, Sergei Trofimovich wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> repoman/pym/repoman/modules/scan/depend/profile.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py b/repoman/pym/repoman/modules/scan/depend/profile.py
> index a714a93..cf3d9a8 100644
> --- a/repoman/pym/repoman/modules/scan/depend/profile.py
> +++ b/repoman/pym/repoman/modules/scan/depend/profile.py
> @@ -51,7 +51,7 @@ class ProfileDependsChecks(ScanBase):
> self.repo_metadata = kwargs.get('repo_metadata')
>
> def check(self, **kwargs):
> - '''Perform profile dependant dependancy checks
> + '''Perform profile dependant dependency checks
>
> @param arches:
> @param pkg: Package in which we check (object).
>
Thanks, applied:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=279b51a20dc180fb10252e5250236e04a248ea67
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, add indentation level after newline
2016-06-18 18:06 ` Brian Dolbec
@ 2016-06-18 19:26 ` Sergei Trofimovich
2017-07-01 9:49 ` Sergei Trofimovich
2017-07-02 16:23 ` [gentoo-portage-dev] " Zac Medico
0 siblings, 2 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 19:26 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich, dolsen
From: Sergei Trofimovich <siarheit@google.com>
CC: dolsen@gentoo.org
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
V2: updated subject
pym/portage/dep/dep_check.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index 9af4e65..76e5d82 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -688,8 +688,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
else:
try:
mysplit = use_reduce(depstring, uselist=myusesplit,
- masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
- opconvert=True, token_class=Atom, eapi=eapi)
+ masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
+ opconvert=True, token_class=Atom, eapi=eapi)
except InvalidDependString as e:
return [0, "%s" % (e,)]
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH v2] repoman/modules/.../profile.py: typo in docstring s/dependancy/dependency/
2016-06-18 17:01 [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/ Sergei Trofimovich
` (2 preceding siblings ...)
2016-06-18 18:29 ` [gentoo-portage-dev] Re: [PATCH] repoman: typo in docstring s/dependancy/dependency/ Zac Medico
@ 2016-06-18 19:27 ` Sergei Trofimovich
2016-06-18 19:31 ` [gentoo-portage-dev] " Zac Medico
3 siblings, 1 reply; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 19:27 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich
From: Sergei Trofimovich <siarheit@google.com>
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
V2: updated subject
repoman/pym/repoman/modules/scan/depend/profile.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py b/repoman/pym/repoman/modules/scan/depend/profile.py
index a714a93..cf3d9a8 100644
--- a/repoman/pym/repoman/modules/scan/depend/profile.py
+++ b/repoman/pym/repoman/modules/scan/depend/profile.py
@@ -51,7 +51,7 @@ class ProfileDependsChecks(ScanBase):
self.repo_metadata = kwargs.get('repo_metadata')
def check(self, **kwargs):
- '''Perform profile dependant dependancy checks
+ '''Perform profile dependant dependency checks
@param arches:
@param pkg: Package in which we check (object).
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH v2] repoman: new QA error: slot operator under '||' alternative
2016-06-18 18:02 ` Brian Dolbec
@ 2016-06-18 19:27 ` Sergei Trofimovich
2016-06-18 21:15 ` [gentoo-portage-dev] " Zac Medico
[not found] ` <20160618203706.3fd97cb6@sf>
1 sibling, 1 reply; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 19:27 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich, dolsen, qa, mgorny
From: Sergei Trofimovich <siarheit@google.com>
A few links discussing what can go wrong with slot operator under '||':
https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
The main problem here is how vdb gets updated when you have a dependency of style:
RDEPEND="|| ( foo:= bar:= )"
depending on what you have installed in system: only 'foo'/'bar' or both 'foo' and 'bar'.
I'm about to add actual test for some examples to gen-b0rk.
New repoman complains on them as follows:
RDEPEND="|| ( =not-broken/pkg1-subslot-0:= =not-broken/pkg1-subslot-1:0= )"
Yields:
dependency.badslotop [fatal] 2
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under '||' dep clause.
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator under '||' dep clause.
CC: dolsen@gentoo.org
CC: qa@gentoo.org
CC: mgorny@gentoo.org
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
V2: made check_slotop function local, baked tree traversal in it
.../repoman/modules/scan/depend/_depend_checks.py | 42 ++++++++++++++++++++++
repoman/pym/repoman/qa_data.py | 2 ++
2 files changed, 44 insertions(+)
diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 4e1d216..2ee7e9c 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -3,11 +3,37 @@
from _emerge.Package import Package
+from portage.dep import Atom
+
from repoman.check_missingslot import check_missingslot
# import our initialized portage instance
from repoman._portage import portage
from repoman.qa_data import suspect_virtual, suspect_rdepend
+def check_slotop(dep_tree, mytype, qatracker, relative_path, in_any_of=False):
+ '''Checks if RDEPEND uses ':=' slot operator
+ in '||' style dependencies.'''
+
+ # leaf
+ if isinstance(dep_tree, Atom):
+ atom = dep_tree
+ if in_any_of and atom.slot_operator:
+ qatracker.add_error("dependency.badslotop", relative_path +
+ ": %s: '%s' uses ':=' slot operator under '||' dep clause." %
+ (mytype, atom))
+
+ # branches
+ if isinstance(dep_tree, list):
+ if len(dep_tree) == 0:
+ return
+ # entering any-of
+ if dep_tree[0] == '||':
+ check_slotop(dep_tree[1:], mytype, qatracker, relative_path,
+ in_any_of=True)
+ else:
+ for branch in dep_tree:
+ check_slotop(branch, mytype, qatracker, relative_path,
+ in_any_of=in_any_of)
def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
'''Checks the ebuild dependencies for errors
@@ -117,6 +143,22 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+ if runtime:
+ try:
+ # to find use of ':=' in '||' we preserve
+ # tree structure of dependencies
+ hier_atoms = portage.dep.use_reduce(
+ mydepstr,
+ flat=False,
+ matchall=1,
+ is_valid_flag=pkg.iuse.is_valid_flag,
+ opconvert=True,
+ token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ hier_atoms = None
+ badsyntax.append(str(e))
+ check_slotop(hier_atoms, mytype, qatracker, ebuild.relative_path)
+
for m, b in zip(type_list, badsyntax):
if m.endswith("DEPEND"):
qacat = "dependency.syntax"
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index b9475e8..48ab389 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -58,6 +58,8 @@ qahelp = {
"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)"),
+ "dependency.badslotop": (
+ "RDEPEND contains ':=' slot operator under '||' dependency."),
"file.executable": (
"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need"
" the executable bit"),
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] Re: [PATCH v2] repoman/modules/.../profile.py: typo in docstring s/dependancy/dependency/
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] repoman/modules/.../profile.py: " Sergei Trofimovich
@ 2016-06-18 19:31 ` Zac Medico
0 siblings, 0 replies; 19+ messages in thread
From: Zac Medico @ 2016-06-18 19:31 UTC (permalink / raw
To: Sergei Trofimovich, gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich
On 06/18/2016 12:27 PM, Sergei Trofimovich wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> V2: updated subject
> repoman/pym/repoman/modules/scan/depend/profile.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/repoman/pym/repoman/modules/scan/depend/profile.py b/repoman/pym/repoman/modules/scan/depend/profile.py
> index a714a93..cf3d9a8 100644
> --- a/repoman/pym/repoman/modules/scan/depend/profile.py
> +++ b/repoman/pym/repoman/modules/scan/depend/profile.py
> @@ -51,7 +51,7 @@ class ProfileDependsChecks(ScanBase):
> self.repo_metadata = kwargs.get('repo_metadata')
>
> def check(self, **kwargs):
> - '''Perform profile dependant dependancy checks
> + '''Perform profile dependant dependency checks
>
> @param arches:
> @param pkg: Package in which we check (object).
>
I've already pushed the first patch:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=279b51a20dc180fb10252e5250236e04a248ea67
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative
[not found] ` <20160618203706.3fd97cb6@sf>
@ 2016-06-18 20:38 ` Brian Dolbec
2016-06-18 21:25 ` Zac Medico
2016-06-18 21:54 ` Sergei Trofimovich
0 siblings, 2 replies; 19+ messages in thread
From: Brian Dolbec @ 2016-06-18 20:38 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1: Type: text/plain, Size: 2499 bytes --]
On Sat, 18 Jun 2016 20:37:06 +0100
Sergei Trofimovich <slyich@gmail.com> wrote:
> On Sat, 18 Jun 2016 11:02:53 -0700
> Brian Dolbec <dolsen@gentoo.org> wrote:
>
> > > + if runtime:
> > > + try:
> > > + # to find use of ':=' in '||' we
> > > preserve
> > > + # tree structure of dependencies
> > > + hier_atoms =
> > > portage.dep.use_reduce(
> > > + mydepstr,
> > > + flat=False,
> > > + matchall=1,
> > > +
> > > is_valid_flag=pkg.iuse.is_valid_flag,
> > > + opconvert=True,
> > > + token_class=token_class)
> > > + except
> > > portage.exception.InvalidDependString as e:
> > > + hier_atoms = None
> > > + badsyntax.append(str(e))
> > > + check_slotop(hier_atoms, mytype,
> > > qatracker, ebuild.relative_path)
> >
> >
> > Is there a special reason this code can not be part of the
> > check_slotop()? All it has is the one statement calling it's
> > internal recursive function. Then all this code would would be
> > replaced here by the one check_slotop() which adds to badsyntax.
>
> I don't have special preference. I've followed example of what a
> check few lines before does to call check_missingslot(). I've sent a
> V2 patch w/o pulling it off to a separate helper.
>
> If you think it should be better moved completely to a separate
> helper I'll move it there. As you see I have a very weak python fu.
>
> If there is examples of better ways to pass that large context of
> variables please point me to it :)
>
OK, V2 is better, but not quite what I had thought of.
The original check_sloptop() had 2 items, the _traverse_tree() and the
one staement calling it. So, yes it is better that in that it doesn't
have the needless sub function. But the _depend_checks() is getting
quite long already. The new code you add in there makes it even longer
and adds even more branching. It can lead to things being more
complicated for future changes. What I meant was to move most of that
additional code into the pretty unused check_sloptop() and have it call
the _traverse_tree() from there. That would simplify the
depends_check() and move the check_sloptop specific code to that
function. Then the _traverse_tree sub-function would be utilized with
the check_slotop() better utilized.
so:
+ if runtime:
+ check_slotop(...)
would be all that was added to _depends_check() directly.
Zac, what do you think?
--
Brian Dolbec <dolsen>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 951 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] Re: [PATCH v2] repoman: new QA error: slot operator under '||' alternative
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] " Sergei Trofimovich
@ 2016-06-18 21:15 ` Zac Medico
2016-06-18 22:00 ` [gentoo-portage-dev] [PATCH v4] " Sergei Trofimovich
2016-06-19 8:13 ` [gentoo-portage-dev] Re: [PATCH v2] " Sergei Trofimovich
0 siblings, 2 replies; 19+ messages in thread
From: Zac Medico @ 2016-06-18 21:15 UTC (permalink / raw
To: Sergei Trofimovich, gentoo-portage-dev
Cc: zmedico, Sergei Trofimovich, dolsen, qa, mgorny
On 06/18/2016 12:27 PM, Sergei Trofimovich wrote:
> + if in_any_of and atom.slot_operator:
> + qatracker.add_error("dependency.badslotop", relative_path +
> + ": %s: '%s' uses ':=' slot operator under '||' dep clause." %
> + (mytype, atom))
It should be like this:
if in_any_of and atom.slot_operator == '=':
Because the case of atom.slot_operator == '*' is not forbidden.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative
2016-06-18 20:38 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
@ 2016-06-18 21:25 ` Zac Medico
2016-06-18 21:54 ` Sergei Trofimovich
1 sibling, 0 replies; 19+ messages in thread
From: Zac Medico @ 2016-06-18 21:25 UTC (permalink / raw
To: gentoo-portage-dev
On 06/18/2016 01:38 PM, Brian Dolbec wrote:
> Zac, what do you think?
I don't see any problems except for the need to do atom.slot_operator ==
'=', as mentioned in my previous reply.
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative
2016-06-18 20:38 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
2016-06-18 21:25 ` Zac Medico
@ 2016-06-18 21:54 ` Sergei Trofimovich
1 sibling, 0 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 21:54 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich, dolsen, qa, mgorny
From: Sergei Trofimovich <siarheit@google.com>
A few links discussing what can go wrong with slot operator under '||':
https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
The main problem here is how vdb gets updated when you have a dependency of style:
RDEPEND="|| ( foo:= bar:= )"
depending on what you have installed in system: only 'foo'/'bar' or both 'foo' and 'bar'.
I'm about to add actual test for some examples to gen-b0rk.
New repoman complains on them as follows:
RDEPEND="|| ( =not-broken/pkg1-subslot-0:= =not-broken/pkg1-subslot-1:0= )"
Yields:
dependency.badslotop [fatal] 2
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under '||' dep clause.
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator under '||' dep clause.
CC: dolsen@gentoo.org
CC: qa@gentoo.org
CC: mgorny@gentoo.org
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
V3: unbaked tree traversal back to _traverse_tree, moved dependency parser out
to check_slotop() helper
V2: made check_slotop function local, baked tree traversal in it
.../repoman/modules/scan/depend/_depend_checks.py | 45 ++++++++++++++++++++++
repoman/pym/repoman/qa_data.py | 2 +
2 files changed, 47 insertions(+)
diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 4e1d216..64a35f4 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -3,11 +3,52 @@
from _emerge.Package import Package
+from portage.dep import Atom
+
from repoman.check_missingslot import check_missingslot
# import our initialized portage instance
from repoman._portage import portage
from repoman.qa_data import suspect_virtual, suspect_rdepend
+def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
+ qatracker, relative_path):
+ '''Checks if RDEPEND uses ':=' slot operator
+ in '||' style dependencies.'''
+
+ try:
+ # to find use of ':=' in '||' we preserve
+ # tree structure of dependencies
+ my_dep_tree = portage.dep.use_reduce(
+ depstr,
+ flat=False,
+ matchall=1,
+ is_valid_flag=is_valid_flag,
+ opconvert=True,
+ token_class=portage.dep.Atom)
+ except portage.exception.InvalidDependString as e:
+ my_dep_tree = None
+ badsyntax.append(str(e))
+
+ def _traverse_tree(dep_tree, in_any_of):
+ # leaf
+ if isinstance(dep_tree, Atom):
+ atom = dep_tree
+ if in_any_of and atom.slot_operator:
+ qatracker.add_error("dependency.badslotop",
+ "%s: %s: '%s' uses ':=' slot operator under '||' dep clause." %
+ (relative_path, mytype, atom))
+
+ # branches
+ if isinstance(dep_tree, list):
+ if len(dep_tree) == 0:
+ return
+ # entering any-of
+ if dep_tree[0] == '||':
+ _traverse_tree(dep_tree[1:], in_any_of=True)
+ else:
+ for branch in dep_tree:
+ _traverse_tree(branch, in_any_of=in_any_of)
+ _traverse_tree(my_dep_tree, False)
def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
'''Checks the ebuild dependencies for errors
@@ -117,6 +158,10 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+ if runtime:
+ check_slotop(mydepstr, pkg.iuse.is_valid_flag,
+ badsyntax, mytype, qatracker, ebuild.relative_path)
+
for m, b in zip(type_list, badsyntax):
if m.endswith("DEPEND"):
qacat = "dependency.syntax"
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index b9475e8..48ab389 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -58,6 +58,8 @@ qahelp = {
"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)"),
+ "dependency.badslotop": (
+ "RDEPEND contains ':=' slot operator under '||' dependency."),
"file.executable": (
"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need"
" the executable bit"),
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] [PATCH v4] repoman: new QA error: slot operator under '||' alternative
2016-06-18 21:15 ` [gentoo-portage-dev] " Zac Medico
@ 2016-06-18 22:00 ` Sergei Trofimovich
2016-06-25 17:35 ` Brian Dolbec
2016-06-19 8:13 ` [gentoo-portage-dev] Re: [PATCH v2] " Sergei Trofimovich
1 sibling, 1 reply; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-18 22:00 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: zmedico, Sergei Trofimovich, dolsen, qa, mgorny
From: Sergei Trofimovich <siarheit@google.com>
A few links discussing what can go wrong with slot operator under '||':
https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
The main problem here is how vdb gets updated when you have a dependency of style:
RDEPEND="|| ( foo:= bar:= )"
depending on what you have installed in system: only 'foo'/'bar' or both 'foo' and 'bar'.
I'm about to add actual test for some examples to gen-b0rk.
New repoman complains on them as follows:
RDEPEND="|| ( =not-broken/pkg1-subslot-0:= =not-broken/pkg1-subslot-1:0= )"
Yields:
dependency.badslotop [fatal] 2
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under '||' dep clause.
ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild: RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator under '||' dep clause.
CC: dolsen@gentoo.org
CC: qa@gentoo.org
CC: mgorny@gentoo.org
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
V4: forbid only ':=' style slot operator. Zac pointed out ':*' is fine here.
V3: unbaked tree traversal back to _traverse_tree, moved dependency parser out
to check_slotop() helper
V2: made check_slotop function local, baked tree traversal in it
.../repoman/modules/scan/depend/_depend_checks.py | 45 ++++++++++++++++++++++
repoman/pym/repoman/qa_data.py | 2 +
2 files changed, 47 insertions(+)
diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 4e1d216..3f6c93e 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -3,11 +3,52 @@
from _emerge.Package import Package
+from portage.dep import Atom
+
from repoman.check_missingslot import check_missingslot
# import our initialized portage instance
from repoman._portage import portage
from repoman.qa_data import suspect_virtual, suspect_rdepend
+def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
+ qatracker, relative_path):
+ '''Checks if RDEPEND uses ':=' slot operator
+ in '||' style dependencies.'''
+
+ try:
+ # to find use of ':=' in '||' we preserve
+ # tree structure of dependencies
+ my_dep_tree = portage.dep.use_reduce(
+ depstr,
+ flat=False,
+ matchall=1,
+ is_valid_flag=is_valid_flag,
+ opconvert=True,
+ token_class=portage.dep.Atom)
+ except portage.exception.InvalidDependString as e:
+ my_dep_tree = None
+ badsyntax.append(str(e))
+
+ def _traverse_tree(dep_tree, in_any_of):
+ # leaf
+ if isinstance(dep_tree, Atom):
+ atom = dep_tree
+ if in_any_of and atom.slot_operator == '=':
+ qatracker.add_error("dependency.badslotop",
+ "%s: %s: '%s' uses ':=' slot operator under '||' dep clause." %
+ (relative_path, mytype, atom))
+
+ # branches
+ if isinstance(dep_tree, list):
+ if len(dep_tree) == 0:
+ return
+ # entering any-of
+ if dep_tree[0] == '||':
+ _traverse_tree(dep_tree[1:], in_any_of=True)
+ else:
+ for branch in dep_tree:
+ _traverse_tree(branch, in_any_of=in_any_of)
+ _traverse_tree(my_dep_tree, False)
def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
'''Checks the ebuild dependencies for errors
@@ -117,6 +158,10 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+ if runtime:
+ check_slotop(mydepstr, pkg.iuse.is_valid_flag,
+ badsyntax, mytype, qatracker, ebuild.relative_path)
+
for m, b in zip(type_list, badsyntax):
if m.endswith("DEPEND"):
qacat = "dependency.syntax"
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index b9475e8..48ab389 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -58,6 +58,8 @@ qahelp = {
"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)"),
+ "dependency.badslotop": (
+ "RDEPEND contains ':=' slot operator under '||' dependency."),
"file.executable": (
"Ebuilds, digests, metadata.xml, Manifest, and ChangeLog do not need"
" the executable bit"),
--
2.9.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] Re: [PATCH v2] repoman: new QA error: slot operator under '||' alternative
2016-06-18 21:15 ` [gentoo-portage-dev] " Zac Medico
2016-06-18 22:00 ` [gentoo-portage-dev] [PATCH v4] " Sergei Trofimovich
@ 2016-06-19 8:13 ` Sergei Trofimovich
1 sibling, 0 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2016-06-19 8:13 UTC (permalink / raw
To: Zac Medico; +Cc: gentoo-portage-dev, Sergei Trofimovich, dolsen, qa, mgorny
[-- Attachment #1: Type: text/plain, Size: 545 bytes --]
On Sat, 18 Jun 2016 14:15:54 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> On 06/18/2016 12:27 PM, Sergei Trofimovich wrote:
> > + if in_any_of and atom.slot_operator:
> > + qatracker.add_error("dependency.badslotop", relative_path +
> > + ": %s: '%s' uses ':=' slot operator under '||' dep clause." %
> > + (mytype, atom))
>
> It should be like this:
>
> if in_any_of and atom.slot_operator == '=':
>
> Because the case of atom.slot_operator == '*' is not forbidden.
Nice catch! Sent V4.
--
Sergei
[-- Attachment #2: Цифровая подпись OpenPGP --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v4] repoman: new QA error: slot operator under '||' alternative
2016-06-18 22:00 ` [gentoo-portage-dev] [PATCH v4] " Sergei Trofimovich
@ 2016-06-25 17:35 ` Brian Dolbec
0 siblings, 0 replies; 19+ messages in thread
From: Brian Dolbec @ 2016-06-25 17:35 UTC (permalink / raw
To: gentoo-portage-dev
On Sat, 18 Jun 2016 23:00:21 +0100
Sergei Trofimovich <slyfox@gentoo.org> wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> A few links discussing what can go wrong with slot operator under
> '||':
> https://archives.gentoo.org/gentoo-dev/message/81a4e1a1f5767e20009628ecd33da8d4
> https://archives.gentoo.org/gentoo-dev/message/66ff016a055e57b6027abcd36734e0e3
>
> The main problem here is how vdb gets updated when you have a
> dependency of style: RDEPEND="|| ( foo:= bar:= )"
> depending on what you have installed in system: only 'foo'/'bar' or
> both 'foo' and 'bar'.
>
> I'm about to add actual test for some examples to gen-b0rk.
>
> New repoman complains on them as follows:
>
> RDEPEND="|| ( =not-broken/pkg1-subslot-0:=
> =not-broken/pkg1-subslot-1:0= )"
>
> Yields:
>
> dependency.badslotop [fatal] 2
> ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild:
> RDEPEND: '=not-broken/pkg1-subslot-0:=' uses ':=' slot operator under
> '||' dep clause.
> ebuild-test/RDEPEND-any-of-slotop/RDEPEND-any-of-slotop-0.ebuild:
> RDEPEND: '=not-broken/pkg1-subslot-1:0=' uses ':=' slot operator
> under '||' dep clause.
>
> CC: dolsen@gentoo.org
> CC: qa@gentoo.org
> CC: mgorny@gentoo.org
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> V4: forbid only ':=' style slot operator. Zac pointed out ':*' is
> fine here. V3: unbaked tree traversal back to _traverse_tree, moved
> dependency parser out to check_slotop() helper
> V2: made check_slotop function local, baked tree traversal in it
> .../repoman/modules/scan/depend/_depend_checks.py | 45
> ++++++++++++++++++++++
> repoman/pym/repoman/qa_data.py | 2 + 2 files
> changed, 47 insertions(+)
>
> diff --git
> a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
> b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py index
> 4e1d216..3f6c93e 100644 ---
> a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py +++
> b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py @@ -3,11
> +3,52 @@ from _emerge.Package import Package
>
> +from portage.dep import Atom
> +
> from repoman.check_missingslot import check_missingslot
> # import our initialized portage instance
> from repoman._portage import portage
> from repoman.qa_data import suspect_virtual, suspect_rdepend
>
> +def check_slotop(depstr, is_valid_flag, badsyntax, mytype,
> + qatracker, relative_path):
> + '''Checks if RDEPEND uses ':=' slot operator
> + in '||' style dependencies.'''
> +
> + try:
> + # to find use of ':=' in '||' we preserve
> + # tree structure of dependencies
> + my_dep_tree = portage.dep.use_reduce(
> + depstr,
> + flat=False,
> + matchall=1,
> + is_valid_flag=is_valid_flag,
> + opconvert=True,
> + token_class=portage.dep.Atom)
> + except portage.exception.InvalidDependString as e:
> + my_dep_tree = None
> + badsyntax.append(str(e))
> +
> + def _traverse_tree(dep_tree, in_any_of):
> + # leaf
> + if isinstance(dep_tree, Atom):
> + atom = dep_tree
> + if in_any_of and atom.slot_operator == '=':
> +
> qatracker.add_error("dependency.badslotop",
> + "%s: %s: '%s' uses ':=' slot
> operator under '||' dep clause." %
> + (relative_path, mytype,
> atom)) +
> + # branches
> + if isinstance(dep_tree, list):
> + if len(dep_tree) == 0:
> + return
> + # entering any-of
> + if dep_tree[0] == '||':
> + _traverse_tree(dep_tree[1:],
> in_any_of=True)
> + else:
> + for branch in dep_tree:
> + _traverse_tree(branch,
> in_any_of=in_any_of)
> + _traverse_tree(my_dep_tree, False)
>
> def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata):
> '''Checks the ebuild dependencies for errors
> @@ -117,6 +158,10 @@ def _depend_checks(ebuild, pkg, portdb,
> qatracker, repo_metadata):
> type_list.extend([mytype] * (len(badsyntax) -
> len(type_list)))
> + if runtime:
> + check_slotop(mydepstr,
> pkg.iuse.is_valid_flag,
> + badsyntax, mytype, qatracker,
> ebuild.relative_path) +
> for m, b in zip(type_list, badsyntax):
> if m.endswith("DEPEND"):
> qacat = "dependency.syntax"
> diff --git a/repoman/pym/repoman/qa_data.py
> b/repoman/pym/repoman/qa_data.py index b9475e8..48ab389 100644
> --- a/repoman/pym/repoman/qa_data.py
> +++ b/repoman/pym/repoman/qa_data.py
> @@ -58,6 +58,8 @@ qahelp = {
> "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)"),
> + "dependency.badslotop": (
> + "RDEPEND contains ':=' slot operator under '||'
> dependency."), "file.executable": (
> "Ebuilds, digests, metadata.xml, Manifest, and
> ChangeLog do not need" " the executable bit"),
I've merged V4 and it is in the 2.3.0 release.
Thank you
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, add indentation level after newline
2016-06-18 19:26 ` [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, " Sergei Trofimovich
@ 2017-07-01 9:49 ` Sergei Trofimovich
2017-07-02 16:23 ` [gentoo-portage-dev] " Zac Medico
1 sibling, 0 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2017-07-01 9:49 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: slyfox, zmedico, Sergei Trofimovich, dolsen
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
On Sat, 18 Jun 2016 20:26:20 +0100
Sergei Trofimovich <slyfox@gentoo.org> wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> CC: dolsen@gentoo.org
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> V2: updated subject
> pym/portage/dep/dep_check.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
> index 9af4e65..76e5d82 100644
> --- a/pym/portage/dep/dep_check.py
> +++ b/pym/portage/dep/dep_check.py
> @@ -688,8 +688,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
> else:
> try:
> mysplit = use_reduce(depstring, uselist=myusesplit,
> - masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
> - opconvert=True, token_class=Atom, eapi=eapi)
> + masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
> + opconvert=True, token_class=Atom, eapi=eapi)
> except InvalidDependString as e:
> return [0, "%s" % (e,)]
>
> --
> 2.9.0
>
>
Ping.
--
Sergei
[-- Attachment #2: Цифровая подпись OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [gentoo-portage-dev] Re: [PATCH v2] portage/dep/depcheck.py: Whitespace, add indentation level after newline
2016-06-18 19:26 ` [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, " Sergei Trofimovich
2017-07-01 9:49 ` Sergei Trofimovich
@ 2017-07-02 16:23 ` Zac Medico
1 sibling, 0 replies; 19+ messages in thread
From: Zac Medico @ 2017-07-02 16:23 UTC (permalink / raw
To: Sergei Trofimovich
Cc: gentoo-portage-dev, Sergei Trofimovich, dolsen@gentoo.org
On Sat, Jun 18, 2016 at 12:26 PM, Sergei Trofimovich <slyfox@gentoo.org> wrote:
> From: Sergei Trofimovich <siarheit@google.com>
>
> CC: dolsen@gentoo.org
> Signed-off-by: Sergei Trofimovich <siarheit@google.com>
> ---
> V2: updated subject
> pym/portage/dep/dep_check.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
> index 9af4e65..76e5d82 100644
> --- a/pym/portage/dep/dep_check.py
> +++ b/pym/portage/dep/dep_check.py
> @@ -688,8 +688,8 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None,
> else:
> try:
> mysplit = use_reduce(depstring, uselist=myusesplit,
> - masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
> - opconvert=True, token_class=Atom, eapi=eapi)
> + masklist=mymasks, matchall=(use=="all"), excludeall=useforce,
> + opconvert=True, token_class=Atom, eapi=eapi)
> except InvalidDependString as e:
> return [0, "%s" % (e,)]
>
> --
> 2.9.0
>
Thanks, pushed:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=7a5489e8b2715d48767ec7ee936736e862a8d7c1
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2017-07-02 16:23 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18 17:01 [gentoo-portage-dev] [PATCH] repoman: typo in docstring s/dependancy/dependency/ Sergei Trofimovich
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: whitespace: add indentation level after newline Sergei Trofimovich
2016-06-18 18:06 ` Brian Dolbec
2016-06-18 19:26 ` [gentoo-portage-dev] [PATCH v2] portage/dep/depcheck.py: Whitespace, " Sergei Trofimovich
2017-07-01 9:49 ` Sergei Trofimovich
2017-07-02 16:23 ` [gentoo-portage-dev] " Zac Medico
2016-06-18 17:01 ` [gentoo-portage-dev] [PATCH] repoman: new QA error: slot operator under '||' alternative Sergei Trofimovich
2016-06-18 18:02 ` Brian Dolbec
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] " Sergei Trofimovich
2016-06-18 21:15 ` [gentoo-portage-dev] " Zac Medico
2016-06-18 22:00 ` [gentoo-portage-dev] [PATCH v4] " Sergei Trofimovich
2016-06-25 17:35 ` Brian Dolbec
2016-06-19 8:13 ` [gentoo-portage-dev] Re: [PATCH v2] " Sergei Trofimovich
[not found] ` <20160618203706.3fd97cb6@sf>
2016-06-18 20:38 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
2016-06-18 21:25 ` Zac Medico
2016-06-18 21:54 ` Sergei Trofimovich
2016-06-18 18:29 ` [gentoo-portage-dev] Re: [PATCH] repoman: typo in docstring s/dependancy/dependency/ Zac Medico
2016-06-18 19:27 ` [gentoo-portage-dev] [PATCH v2] repoman/modules/.../profile.py: " Sergei Trofimovich
2016-06-18 19:31 ` [gentoo-portage-dev] " Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox