[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/, lib/portage/tests/sets/base/, /

2023-12-09 Thread Sam James
commit: ddae1007eaaf59a123de1a93324897c58605ae80
Author: Sam James  gentoo  org>
AuthorDate: Fri Dec  8 11:53:58 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Dec  9 14:14:44 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=ddae1007

sets: VariableSet: flatten dependencies

This is needed to pick up www-client/firefox's BDEPEND of "|| ( 
virtual/rust:0/a virtual/rust:0/b ...)"
for @rust-rebuild.

Signed-off-by: Sam James  gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1203
Signed-off-by: Sam James  gentoo.org>

 NEWS | 3 +++
 lib/portage/_sets/dbapi.py   | 2 +-
 lib/portage/tests/sets/base/test_variable_set.py | 8 
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9560a5ba58..1927600f15 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,9 @@ Bug fixes:
 * Set SYSROOT appropriately for best_version and has_version so that they work
   when cross-compiling and IPC is disabled.
 
+* sets: VariableSet: Flatten dependencies so that e.g. www-client/firefox
+  appears in @rust-rebuild.
+
 portage-3.0.56 (2023-12-01)
 --
 

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index b3d7c5ffba..9c5b979a97 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -172,7 +172,7 @@ class VariableSet(EverythingSet):
 for include in self._includes:
 include_atoms.append(Atom(include))
 
-for x in use_reduce(values, token_class=Atom):
+for x in use_reduce(values, token_class=Atom, flat=True):
 if not isinstance(x, Atom):
 continue
 

diff --git a/lib/portage/tests/sets/base/test_variable_set.py 
b/lib/portage/tests/sets/base/test_variable_set.py
index 5061046670..9e90ee6dd7 100644
--- a/lib/portage/tests/sets/base/test_variable_set.py
+++ b/lib/portage/tests/sets/base/test_variable_set.py
@@ -12,6 +12,9 @@ class VariableSetTestCase(TestCase):
 def testVariableSetEmerge(self):
 ebuilds = {
 "dev-go/go-pkg-1": {"BDEPEND": "dev-lang/go"},
+"www-client/firefox-1": {
+"BDEPEND": "|| ( virtual/rust:0/a virtual/rust:0/b )"
+},
 }
 installed = ebuilds
 playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)
@@ -22,6 +25,11 @@ class VariableSetTestCase(TestCase):
 mergelist=["dev-go/go-pkg-1"],
 success=True,
 ),
+ResolverPlaygroundTestCase(
+["@rust-rebuild"],
+mergelist=["www-client/firefox-1"],
+success=True,
+),
 )
 
 try:



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2023-10-23 Thread Zac Medico
commit: 92f34ea2f00ea68b2b5c8374ba6b38287adb1628
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Oct 23 17:14:21 2023 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Oct 24 01:48:56 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=92f34ea2

StaticFileSet: Fix os.walk for utf8_mode

Bug: https://bugs.gentoo.org/916182
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/files.py | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py
index 46c39b3c71..1b9cc6016f 100644
--- a/lib/portage/_sets/files.py
+++ b/lib/portage/_sets/files.py
@@ -1,10 +1,11 @@
-# Copyright 2007-2020 Gentoo Authors
+# Copyright 2007-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
 import re
 from itertools import chain
 
+import portage
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode
@@ -176,6 +177,14 @@ class StaticFileSet(EditablePackageSet):
 directory = normalize_path(directory)
 
 for parent, dirs, files in os.walk(directory):
+if portage.utf8_mode:
+dirs_orig = dirs
+omit_dir = lambda d: dirs_orig.remove(os.fsdecode(d))
+parent = os.fsencode(parent)
+dirs = [os.fsencode(value) for value in dirs]
+files = [os.fsencode(value) for value in files]
+else:
+omit_dir = lambda d: dirs.remove(d)
 try:
 parent = _unicode_decode(
 parent, encoding=_encodings["fs"], errors="strict"
@@ -184,7 +193,7 @@ class StaticFileSet(EditablePackageSet):
 continue
 for d in dirs[:]:
 if d in vcs_dirs or d.startswith(b".") or d.endswith(b"~"):
-dirs.remove(d)
+omit_dir(d)
 for filename in files:
 try:
 filename = _unicode_decode(



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2022-09-28 Thread Sam James
commit: bb09a2d4db4cd0f85f8ae8ceaddc05ae2585aba3
Author: Sam James  gentoo  org>
AuthorDate: Sat Sep 10 06:22:39 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Sep 28 23:56:08 2022 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=bb09a2d4

portage: sets: VariableSet: parse *DEPEND in includes/excludes

VariableSet takes a metadata variable and checks
its contents based on 'includes' or 'excludes'
from the set definition.

Unfortunately, until now, it didn't parse/expand the chosen variable
and would only match it literally (it'd also not check effective
metadata, just what's listed in the ebuild -- no *DEPEND
from an eclass, for example).

If variable is *DEPEND, actually parse includes/excludes
so we can effecitvely match say, includes="dev-lang/go"
against ">=dev-lang/go-1.18" in an ebuild.

Bug: https://bugs.gentoo.org/827974
Bug: https://bugs.gentoo.org/865115
Signed-off-by: Sam James  gentoo.org>

 lib/portage/_sets/dbapi.py | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 4a837522f..5e7b00e08 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -168,14 +168,31 @@ class VariableSet(EverythingSet):
 return False
 (values,) = self._metadatadb.aux_get(ebuild, [self._variable])
 values = values.split()
+
+if "DEPEND" in self._variable:
+include_atoms = []
+for include in self._includes:
+include_atoms.append(Atom(include))
+
+for x in use_reduce(values, token_class=Atom):
+if not isinstance(x, Atom):
+continue
+
+for include_atom in include_atoms:
+if include_atom.match(x):
+return True
+
+return False
+
 if self._includes and not self._includes.intersection(values):
 return False
+
 if self._excludes and self._excludes.intersection(values):
 return False
+
 return True
 
 def singleBuilder(cls, options, settings, trees):
-
 variable = options.get("variable")
 if variable is None:
 raise SetConfigError(_("missing required attribute: 'variable'"))



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2021-06-18 Thread Zac Medico
commit: 693f6bf5a54e2424e2ad49e1838b61f76bf78e40
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Jun 18 15:50:43 2021 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Jun 18 15:51:58 2021 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=693f6bf5

OwnerSet: fix inverted exclude_paths condition

Bug: https://bugs.gentoo.org/796584
Fixes: 38d3ff6abba5 ("OwnerSet: handle missing or empty exclude-files parameter 
(bug 796584)")
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/dbapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 60b26d17c..8e1f19979 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -86,7 +86,7 @@ class OwnerSet(PackageSet):
exclude_paths = expanded_exclude_paths
 
pkg_str = vardb._pkg_str
-   if exclude_paths:
+   if not exclude_paths:
for link, p in vardb._owners.iter_owners(paths):
pkg = pkg_str(link.mycpv, None)
rValue.add("%s:%s" % (pkg.cp, pkg.slot))



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2021-06-18 Thread Zac Medico
commit: 38d3ff6abba53f664e52d0bfafff5ab49d052bb8
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Jun 18 15:36:51 2021 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Jun 18 15:39:16 2021 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=38d3ff6a

OwnerSet: handle missing or empty exclude-files parameter (bug 796584)

Fixes: f55156d167a6 ("lib/portage/_sets/dbapi.py: add glob support to 
exclude-files parameter cnf/sets/portage.conf: add 
exclude-files=/usr/src/linux* in module-rebuild set")
Bug: https://bugs.gentoo.org/796584
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/dbapi.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 17776f94c..60b26d17c 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -80,13 +80,13 @@ class OwnerSet(PackageSet):
paths = expanded_paths
 
expanded_exclude_paths = []
-   for p in exclude_paths:
+   for p in (exclude_paths or ()):

expanded_exclude_paths.extend(expanded_exc_p[len(eroot)-1:] for expanded_exc_p 
in
glob.iglob(os.path.join(eroot, 
p.lstrip(os.sep
exclude_paths = expanded_exclude_paths
 
pkg_str = vardb._pkg_str
-   if exclude_paths is None:
+   if exclude_paths:
for link, p in vardb._owners.iter_owners(paths):
pkg = pkg_str(link.mycpv, None)
rValue.add("%s:%s" % (pkg.cp, pkg.slot))



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/, cnf/sets/

2021-05-23 Thread Zac Medico
commit: f55156d167a651229518b226e1e064fee47b73a2
Author: Dave Hughes  gmail  com>
AuthorDate: Fri Apr  9 00:59:07 2021 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon May 24 06:38:57 2021 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f55156d1

lib/portage/_sets/dbapi.py: add glob support to exclude-files parameter 
cnf/sets/portage.conf: add exclude-files=/usr/src/linux* in module-rebuild set

Closes: https://github.com/gentoo/portage/pull/694
Signed-off-by: Dave Hughes  gmail.com>
Signed-off-by: Zac Medico  gentoo.org>

 cnf/sets/portage.conf  | 1 +
 lib/portage/_sets/dbapi.py | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf
index 5651a9c53..c4ad2efca 100644
--- a/cnf/sets/portage.conf
+++ b/cnf/sets/portage.conf
@@ -71,6 +71,7 @@ includes = bzr cvs darcs git-2 git-r3 golang-vcs mercurial 
subversion
 [module-rebuild]
 class = portage.sets.dbapi.OwnerSet
 files = /lib/modules
+exclude-files = /usr/src/linux*
 
 # Installed packages that own files inside /usr/lib/xorg/modules,
 # excluding the package that owns /usr/bin/Xorg.

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 7a20553b5..17776f94c 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -79,6 +79,12 @@ class OwnerSet(PackageSet):
glob.iglob(os.path.join(eroot, 
p.lstrip(os.sep
paths = expanded_paths
 
+   expanded_exclude_paths = []
+   for p in exclude_paths:
+   
expanded_exclude_paths.extend(expanded_exc_p[len(eroot)-1:] for expanded_exc_p 
in
+   glob.iglob(os.path.join(eroot, 
p.lstrip(os.sep
+   exclude_paths = expanded_exclude_paths
+
pkg_str = vardb._pkg_str
if exclude_paths is None:
for link, p in vardb._owners.iter_owners(paths):



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2020-09-01 Thread Zac Medico
commit: 7d2f40b076de343fac08fe026e0c1704ef7db2c8
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Sep  1 17:12:21 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Sep  1 17:44:11 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d2f40b0

ChangedDepsSet: use strip_slots function like --changed-deps (bug 739908)

Bug: https://bugs.gentoo.org/739908
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/dbapi.py | 51 ++
 1 file changed, 15 insertions(+), 36 deletions(-)

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index d73aedb8f..52367c4a6 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -2,13 +2,13 @@
 # Distributed under the terms of the GNU General Public License v2
 
 import glob
-import re
 import time
 
 from portage import os
+from portage.exception import PortageKeyError
 from portage.versions import best, catsplit, vercmp
 from portage.dep import Atom, use_reduce
-from portage.exception import InvalidAtom
+from portage.dep._slot_operator import strip_slots
 from portage.localization import _
 from portage._sets.base import PackageSet
 from portage._sets import SetConfigError, get_boolean
@@ -484,52 +484,31 @@ class ChangedDepsSet(PackageSet):
 
def load(self):
depvars = ('RDEPEND', 'PDEPEND')
-
-   # regexp used to match atoms using subslot operator :=
-   subslot_repl_re = re.compile(r':[^[]*=')
+   ebuild_vars = depvars + ('EAPI',)
+   installed_vars = depvars + ('USE', 'EAPI')
 
atoms = []
for cpv in self._vardb.cpv_all():
# no ebuild, no update :).
-   if not self._portdb.cpv_exists(cpv):
+   try:
+   ebuild_metadata = dict(zip(ebuild_vars, 
self._portdb.aux_get(cpv, ebuild_vars)))
+   except PortageKeyError:
continue
 
# USE flags used to build the ebuild and EAPI
# (needed for Atom & use_reduce())
-   use, eapi = self._vardb.aux_get(cpv, ('USE', 'EAPI'))
-   usel = use.split()
-
-   # function used to recursively process atoms in nested 
lists.
-   def clean_subslots(depatom, usel=None):
-   if isinstance(depatom, list):
-   # process the nested list.
-   return [clean_subslots(x, usel) for x 
in depatom]
-
-   try:
-   # this can be either an atom or some 
special operator.
-   # in the latter case, we get 
InvalidAtom and pass it as-is.
-   a = Atom(depatom)
-   except InvalidAtom:
-   return depatom
-   # if we're processing portdb, we need to 
evaluate USE flag
-   # dependency conditionals to make them match 
vdb. this
-   # requires passing the list of USE flags, so we 
reuse it
-   # as conditional for the operation as well.
-   if usel is not None:
-   a = a.evaluate_conditionals(usel)
-
-   # replace slot operator := dependencies with 
plain :=
-   # since we can't properly compare expanded slots
-   # in vardb to abstract slots in portdb.
-   return subslot_repl_re.sub(':=', a)
+   installed_metadata = dict(zip(installed_vars, 
self._vardb.aux_get(cpv, installed_vars)))
+   usel = frozenset(installed_metadata['USE'].split())
 
# get all *DEPEND variables from vdb & portdb and 
compare them.
# we need to do some cleaning up & expansion to make 
matching
# meaningful since vdb dependencies are 
conditional-free.
-   vdbvars = [clean_subslots(use_reduce(x, uselist=usel, 
eapi=eapi))
-   for x in self._vardb.aux_get(cpv, 
depvars)]
-   pdbvars = [clean_subslots(use_reduce(x, uselist=usel, 
eapi=eapi), usel)
-   for x in self._portdb.aux_get(cpv, 
depvars)]
+   vdbvars = [strip_slots(use_reduce(installed_metadata[k],
+   uselist=usel, eapi=installed_metadata['EAPI'], 
token_class=Atom))
+   for k in depvars]
+   pdbvars = [strip_slots(use_reduce(ebuild_metadata[k],
+   

[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2020-08-03 Thread Zac Medico
commit: b07213754d987bcc8432995cbd4ee7ff2f22e99a
Author: Aaron Bauman  gentoo  org>
AuthorDate: Mon Aug  3 22:43:09 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Aug  3 23:28:01 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b0721375

lib/portage/_sets/shell.py: fix whitespace

Signed-off-by: Aaron Bauman  gentoo.org>
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/shell.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/portage/_sets/shell.py b/lib/portage/_sets/shell.py
index 2c95845c8..8bea9fd63 100644
--- a/lib/portage/_sets/shell.py
+++ b/lib/portage/_sets/shell.py
@@ -1,4 +1,4 @@
-# Copyright 2007 Gentoo Foundation
+# Copyright 2007-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import subprocess
@@ -30,7 +30,7 @@ class CommandOutputSet(PackageSet):
super(CommandOutputSet, self).__init__()
self._command = command
self.description = "Package set generated from output of '%s'" 
% self._command
-   
+
def load(self):
pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, 
shell=True)
stdout, stderr = pipe.communicate()



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2020-08-03 Thread Zac Medico
commit: a27c18a7eb26e889486e4822a21ba1ff8f9baad7
Author: Aaron Bauman  gentoo  org>
AuthorDate: Mon Aug  3 22:43:10 2020 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Aug  3 23:28:01 2020 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a27c18a7

lib/portage/_sets/files.py: fix whitespace

Signed-off-by: Aaron Bauman  gentoo.org>
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/files.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py
index 57e5aa34f..6a7eb828b 100644
--- a/lib/portage/_sets/files.py
+++ b/lib/portage/_sets/files.py
@@ -174,7 +174,7 @@ class StaticFileSet(EditablePackageSet):
greedy=greedy, 
dbapi=trees["vartree"].dbapi)
return rValue
multiBuilder = classmethod(multiBuilder)
-   
+
 class ConfigFileSet(PackageSet):
def __init__(self, filename):
super(ConfigFileSet, self).__init__()



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/, cnf/sets/

2019-09-11 Thread Zac Medico
commit: b1342ac2c83b4a1b0415eb5fcc4dd1d6c65561d8
Author: Zac Medico  gentoo  org>
AuthorDate: Wed Sep 11 01:52:35 2019 +
Commit: Zac Medico  gentoo  org>
CommitDate: Thu Sep 12 01:53:13 2019 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b1342ac2

x11-module-rebuild: support SYMLINK_LIB=no (bug 693980)

Use a lib* glob to support SYMLINK_LIB=no.

Bug: https://bugs.gentoo.org/693980
Signed-off-by: Zac Medico  gentoo.org>

 cnf/sets/portage.conf |  2 +-
 lib/portage/_sets/__init__.py |  2 +-
 lib/portage/_sets/dbapi.py| 15 ---
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf
index 38c50a647..0d11d7891 100644
--- a/cnf/sets/portage.conf
+++ b/cnf/sets/portage.conf
@@ -76,7 +76,7 @@ files = /lib/modules
 # excluding the package that owns /usr/bin/Xorg.
 [x11-module-rebuild]
 class = portage.sets.dbapi.OwnerSet
-files = /usr/lib/xorg/modules
+files = /usr/lib*/xorg/modules
 exclude-files = /usr/bin/Xorg
 
 # Binary packages that have a different build time from a currently

diff --git a/lib/portage/_sets/__init__.py b/lib/portage/_sets/__init__.py
index 7b81c55e2..a569b273b 100644
--- a/lib/portage/_sets/__init__.py
+++ b/lib/portage/_sets/__init__.py
@@ -142,7 +142,7 @@ class SetConfig(object):
parser.remove_section("x11-module-rebuild")
parser.add_section("x11-module-rebuild")
parser.set("x11-module-rebuild", "class", 
"portage.sets.dbapi.OwnerSet")
-   parser.set("x11-module-rebuild", "files", 
"/usr/lib/xorg/modules")
+   parser.set("x11-module-rebuild", "files", 
"/usr/lib*/xorg/modules")
parser.set("x11-module-rebuild", "exclude-files", 
"/usr/bin/Xorg")
 
def update(self, setname, options):

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 5d78fd1d3..5c600ec9e 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -1,8 +1,9 @@
-# Copyright 2007-2014 Gentoo Foundation
+# Copyright 2007-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import division
 
+import glob
 import re
 import time
 
@@ -67,11 +68,19 @@ class OwnerSet(PackageSet):
 
def mapPathsToAtoms(self, paths, exclude_paths=None):
"""
-   All paths must begin with a slash, must include EPREFIX, and
-   must not include ROOT.
+   All paths must begin with a slash, and must not include EROOT.
+   Supports globs.
"""
rValue = set()
vardb = self._db
+
+   eroot = vardb.settings['EROOT']
+   expanded_paths = []
+   for p in paths:
+   expanded_paths.extend(expanded_p[len(eroot)-1:] for 
expanded_p in
+   glob.iglob(os.path.join(eroot, 
p.lstrip(os.sep
+   paths = expanded_paths
+
pkg_str = vardb._pkg_str
if exclude_paths is None:
for link, p in vardb._owners.iter_owners(paths):



[gentoo-commits] proj/portage:master commit in: lib/portage/_sets/

2019-09-10 Thread Zac Medico
commit: 0509af099b1eb69951936527b73bf0968653e16b
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Sep 10 19:53:49 2019 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Sep 10 19:58:40 2019 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0509af09

OwnerSet: fix exclude-files support (bug 694000)

Paths returned from iter_owners do not include a leading slash
since commit 5ace188b4499, therefore it's necessary to prepend
a leading slash for comparisons with exclude-files values.

Fixes: 5ace188b4499 ("FEATURES=case-insensitive-fs for bug #524236")
Bug: https://bugs.gentoo.org/694000
Signed-off-by: Zac Medico  gentoo.org>

 lib/portage/_sets/dbapi.py | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py
index 299cb8157..5d78fd1d3 100644
--- a/lib/portage/_sets/dbapi.py
+++ b/lib/portage/_sets/dbapi.py
@@ -67,7 +67,8 @@ class OwnerSet(PackageSet):
 
def mapPathsToAtoms(self, paths, exclude_paths=None):
"""
-   All paths must have $EROOT stripped from the left side.
+   All paths must begin with a slash, must include EPREFIX, and
+   must not include ROOT.
"""
rValue = set()
vardb = self._db
@@ -85,7 +86,9 @@ class OwnerSet(PackageSet):
pkg = pkg_str(link.mycpv, None)
atom = "%s:%s" % (pkg.cp, pkg.slot)
rValue.add(atom)
-   if p in exclude_paths:
+   # Returned paths are relative to ROOT and do 
not have
+   # a leading slash.
+   if '/' + p in exclude_paths:
exclude_atoms.add(atom)
rValue.difference_update(exclude_atoms)