public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2021-06-18 15:53 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2021-06-18 15:53 UTC (permalink / raw
  To: gentoo-commits

commit:     693f6bf5a54e2424e2ad49e1838b61f76bf78e40
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 18 15:50:43 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun 18 15:51:58 2021 +0000
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 <zmedico <AT> 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))


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2023-10-24  1:49 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2023-10-24  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     92f34ea2f00ea68b2b5c8374ba6b38287adb1628
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 23 17:14:21 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 01:48:56 2023 +0000
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 <zmedico <AT> 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(


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2022-09-28 23:56 Sam James
  0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2022-09-28 23:56 UTC (permalink / raw
  To: gentoo-commits

commit:     bb09a2d4db4cd0f85f8ae8ceaddc05ae2585aba3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 10 06:22:39 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 28 23:56:08 2022 +0000
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 <sam <AT> 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'"))


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2021-06-18 15:44 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2021-06-18 15:44 UTC (permalink / raw
  To: gentoo-commits

commit:     38d3ff6abba53f664e52d0bfafff5ab49d052bb8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 18 15:36:51 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Jun 18 15:39:16 2021 +0000
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 <zmedico <AT> 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))


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2020-09-01 17:59 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2020-09-01 17:59 UTC (permalink / raw
  To: gentoo-commits

commit:     7d2f40b076de343fac08fe026e0c1704ef7db2c8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  1 17:12:21 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep  1 17:44:11 2020 +0000
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 <zmedico <AT> 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],
+				uselist=usel, eapi=ebuild_metadata['EAPI'], token_class=Atom))
+				for k in depvars]
 
 			# if dependencies don't match, trigger the rebuild.
 			if vdbvars != pdbvars:


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2020-08-03 23:28 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2020-08-03 23:28 UTC (permalink / raw
  To: gentoo-commits

commit:     b07213754d987bcc8432995cbd4ee7ff2f22e99a
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 22:43:09 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 23:28:01 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b0721375

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

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> 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()


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2020-08-03 23:28 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2020-08-03 23:28 UTC (permalink / raw
  To: gentoo-commits

commit:     a27c18a7eb26e889486e4822a21ba1ff8f9baad7
Author:     Aaron Bauman <bman <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  3 22:43:10 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Aug  3 23:28:01 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a27c18a7

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

Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> 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__()


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/
@ 2019-09-10 20:03 Zac Medico
  0 siblings, 0 replies; 8+ messages in thread
From: Zac Medico @ 2019-09-10 20:03 UTC (permalink / raw
  To: gentoo-commits

commit:     0509af099b1eb69951936527b73bf0968653e16b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 10 19:53:49 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 10 19:58:40 2019 +0000
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 <zmedico <AT> 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)
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-24  1:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-18 15:53 [gentoo-commits] proj/portage:master commit in: lib/portage/_sets/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2023-10-24  1:49 Zac Medico
2022-09-28 23:56 Sam James
2021-06-18 15:44 Zac Medico
2020-09-01 17:59 Zac Medico
2020-08-03 23:28 Zac Medico
2020-08-03 23:28 Zac Medico
2019-09-10 20:03 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox