public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     757d61c4041b11b124ee8baf9c2d482e15c89cb9
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Sun Jan 30 20:39:39 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Sun Jan 30 22:37:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=757d61c4

split up the getMissingKeywords code to eliminate code duplication and increase flexibility. Do some pyflakes and pylint cleanup

---
 .../package/ebuild/_config/KeywordsManager.py      |  224 +++++++++++--------
 1 files changed, 130 insertions(+), 94 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index bff7afa..8a6b4bd 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -13,11 +13,14 @@ from portage.util import grabdict_package, stack_lists, writemsg
 from portage.versions import cpv_getkey
 
 class KeywordsManager(object):
+	"""Manager class to handle keywords processing and validation"""
 
-	def __init__(self, profiles, abs_user_config, user_config=True, global_accept_keywords=""):
+	def __init__(self, profiles, abs_user_config, user_config=True,
+				global_accept_keywords=""):
 		self._pkeywords_list = []
 		rawpkeywords = [grabdict_package(
-			os.path.join(x, "package.keywords"), recursive=1, verify_eapi=True) \
+			os.path.join(x, "package.keywords"), recursive=1,
+			verify_eapi=True) \
 			for x in profiles]
 		for pkeyworddict in rawpkeywords:
 			if not pkeyworddict:
@@ -31,7 +34,8 @@ class KeywordsManager(object):
 
 		self._p_accept_keywords = []
 		raw_p_accept_keywords = [grabdict_package(
-			os.path.join(x, "package.accept_keywords"), recursive=1, verify_eapi=True) \
+			os.path.join(x, "package.accept_keywords"), recursive=1,
+			verify_eapi=True) \
 			for x in profiles]
 		for d in raw_p_accept_keywords:
 			if not d:
@@ -48,11 +52,13 @@ class KeywordsManager(object):
 		if user_config:
 			pkgdict = grabdict_package(
 				os.path.join(abs_user_config, "package.keywords"),
-				recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False)
+				recursive=1, allow_wildcard=True, allow_repo=True,
+				verify_eapi=False)
 
 			for k, v in grabdict_package(
 				os.path.join(abs_user_config, "package.accept_keywords"),
-				recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False).items():
+				recursive=1, allow_wildcard=True, allow_repo=True,
+				verify_eapi=False).items():
 				pkgdict.setdefault(k, []).extend(v)
 
 			accept_keywords_defaults = global_accept_keywords.split()
@@ -66,6 +72,7 @@ class KeywordsManager(object):
 					v = tuple(v)
 				self.pkeywordsdict.setdefault(k.cp, {})[k] = v
 
+
 	def getKeywords(self, cpv, slot, keywords, repo):
 		cp = cpv_getkey(cpv)
 		pkg = "".join((cpv, _slot_separator, slot))
@@ -80,7 +87,14 @@ class KeywordsManager(object):
 					keywords.extend(pkg_keywords)
 		return stack_lists(keywords, incremental=True)
 
-	def getMissingKeywords(self, cpv, slot, keywords, repo, global_accept_keywords, backuped_accept_keywords):
+
+	def getMissingKeywords(self,
+							cpv,
+							slot,
+							keywords,
+							repo,
+							global_accept_keywords,
+							backuped_accept_keywords):
 		"""
 		Take a package and return a list of any KEYWORDS that the user may
 		need to accept for the given package. If the KEYWORDS are empty
@@ -102,88 +116,30 @@ class KeywordsManager(object):
 		@return: A list of KEYWORDS that have not been accepted.
 		"""
 
-		# Hack: Need to check the env directly here as otherwise stacking
-		# doesn't work properly as negative values are lost in the config
-		# object (bug #139600)
-		egroups = backuped_accept_keywords.split()
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
 		pgroups = global_accept_keywords.split()
-		matches = False
-		cp = cpv_getkey(cpv)
 
-		if self._p_accept_keywords:
-			cpv_slot = "%s:%s" % (cpv, slot)
-			accept_keywords_defaults = tuple('~' + keyword for keyword in \
-				pgroups if keyword[:1] not in "~-")
-			for d in self._p_accept_keywords:
-				cpdict = d.get(cp)
-				if cpdict:
-					pkg_accept_keywords = \
-						ordered_by_atom_specificity(cpdict, cpv_slot)
-					if pkg_accept_keywords:
-						for x in pkg_accept_keywords:
-							if not x:
-								x = accept_keywords_defaults
-							pgroups.extend(x)
-						matches = True
+		unmaskgroups = self.getPKeywords(cpv, slot, repo,
+				global_accept_keywords)
+		pgroups.extend(unmaskgroups)
 
-		pkgdict = self.pkeywordsdict.get(cp)
-		if pkgdict:
-			cpv_slot = "%s:%s" % (cpv, slot)
-			pkg_accept_keywords = \
-				ordered_by_atom_specificity(pkgdict, cpv_slot, repo=repo)
-			if pkg_accept_keywords:
-				for x in pkg_accept_keywords:
-					pgroups.extend(x)
-				matches = True
+		# Hack: Need to check the env directly here as otherwise stacking
+		# doesn't work properly as negative values are lost in the config
+		# object (bug #139600)
+		egroups = self._getEgroups(backuped_accept_keywords)
+		pgroups.extend(egroups)
 
-		if matches or egroups:
-			pgroups.extend(egroups)
-			inc_pgroups = set()
-			for x in pgroups:
-				if x.startswith("-"):
-					if x == "-*":
-						inc_pgroups.clear()
-					else:
-						inc_pgroups.discard(x[1:])
-				else:
-					inc_pgroups.add(x)
-			pgroups = inc_pgroups
-			del inc_pgroups
+		return self._getMissingKeywords(cpv, pgroups, mygroups)
 
-		match = False
-		hasstable = False
-		hastesting = False
-		for gp in mygroups:
-			if gp == "*" or (gp == "-*" and len(mygroups) == 1):
-				writemsg(_("--- WARNING: Package '%(cpv)s' uses"
-					" '%(keyword)s' keyword.\n") % {"cpv": cpv, "keyword": gp}, noiselevel=-1)
-				if gp == "*":
-					match = 1
-					break
-			elif gp in pgroups:
-				match=1
-				break
-			elif gp.startswith("~"):
-				hastesting = True
-			elif not gp.startswith("-"):
-				hasstable = True
-		if not match and \
-			((hastesting and "~*" in pgroups) or \
-			(hasstable and "*" in pgroups) or "**" in pgroups):
-			match=1
-		if match:
-			missing = []
-		else:
-			if not mygroups:
-				# If KEYWORDS is empty then we still have to return something
-				# in order to distinguish from the case of "none missing".
-				mygroups.append("**")
-			missing = mygroups
-		return missing
 
-	def getRawMissingKeywords(self, cpv, slot, keywords, repo, global_accept_keywords, backuped_accept_keywords):
+	def getRawMissingKeywords(self,
+							cpv,
+							slot,
+							keywords,
+							repo,
+							global_accept_keywords,
+							backuped_accept_keywords):
 		"""
 		Take a package and return a list of any KEYWORDS that the user may
 		need to accept for the given package. If the KEYWORDS are empty,
@@ -206,18 +162,37 @@ class KeywordsManager(object):
 		and the keywords it looked for.
 		"""
 
-		# Hack: Need to check the env directly here as otherwise stacking
-		# doesn't work properly as negative values are lost in the config
-		# object (bug #139600)
-		egroups = backuped_accept_keywords.split()
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
 		pgroups = global_accept_keywords.split()
-		matches = False
 
-		## we want to use the environment keywords here,
-		## but stripped to it's base arch
-		## we want the raw keywords needed to be accepted from the ebuild
+		# Hack: Need to check the env directly here as otherwise stacking
+		# doesn't work properly as negative values are lost in the config
+		# object (bug #139600)
+		# we want to use the environment keywords here,
+		# but stripped to it's base arch
+		# we want the raw keywords needed to be accepted from the ebuild
+		egroups = self._getEgroups(backuped_accept_keywords)
+		egroups = [x.lstrip('~') for x in egroups]
+
+		pgroups.extend(egroups)
+
+		missing = self._getMissingKeywords(cpv, pgroups, mygroups)
+
+		return missing, pgroups
+
+
+	@staticmethod
+	def _getEgroups(backuped_accept_keywords):
+		"""gets any keywords defined in the environment
+
+		@param backuped_accept_keywords: ACCEPT_KEYWORDS from the backup env
+		@type backuped_accept_keywords: String
+		@rtype: List
+		@return: list of KEYWORDS that have been accepted
+		"""
+		egroups = backuped_accept_keywords.split()
+		pgroups = []
 		if egroups:
 			pgroups.extend(egroups)
 			inc_pgroups = set()
@@ -228,22 +203,34 @@ class KeywordsManager(object):
 					else:
 						inc_pgroups.discard(x[1:])
 				else:
-					inc_pgroups.add(x.lstrip('~'))
+					inc_pgroups.add(x)
 			pgroups = inc_pgroups
 			del inc_pgroups
+		return pgroups
+
 
+	@staticmethod
+	def _getMissingKeywords(cpv, pgroups, mygroups):
+		"""Determines the missing keywords
+
+		@param pgroups: The pkg keywords accepted
+		@type pgroups: list
+		@param mygroups: The ebuild keywords
+		@type mygroups: list
+		"""
 		match = False
 		hasstable = False
 		hastesting = False
 		for gp in mygroups:
 			if gp == "*" or (gp == "-*" and len(mygroups) == 1):
 				writemsg(_("--- WARNING: Package '%(cpv)s' uses"
-					" '%(keyword)s' keyword.\n") % {"cpv": cpv, "keyword": gp}, noiselevel=-1)
+					" '%(keyword)s' keyword.\n") % {"cpv": cpv, "keyword": gp},
+					 noiselevel=-1)
 				if gp == "*":
-					match = 1
+					match = True
 					break
 			elif gp in pgroups:
-				match=1
+				match = True
 				break
 			elif gp.startswith("~"):
 				hastesting = True
@@ -252,7 +239,7 @@ class KeywordsManager(object):
 		if not match and \
 			((hastesting and "~*" in pgroups) or \
 			(hasstable and "*" in pgroups) or "**" in pgroups):
-			match=1
+			match = True
 		if match:
 			missing = []
 		else:
@@ -261,4 +248,53 @@ class KeywordsManager(object):
 				# in order to distinguish from the case of "none missing".
 				mygroups.append("**")
 			missing = mygroups
-		return missing, pgroups
+		return missing
+
+
+	def getPKeywords(self, cpv, slot, repo, global_accept_keywords):
+		"""Gets any package.keywords settings for cp for the given
+		cpv, slot and repo
+
+		@param cpv: The package name (for package.keywords support)
+		@type cpv: String
+		@param slot: The 'SLOT' key from the raw package metadata
+		@type slot: String
+		@param keywords: The 'KEYWORDS' key from the raw package metadata
+		@type keywords: String
+		@param global_accept_keywords: The current value of ACCEPT_KEYWORDS
+		@type global_accept_keywords: String
+		@param backuped_accept_keywords: ACCEPT_KEYWORDS from the backup env
+		@type backuped_accept_keywords: String
+		@rtype: List
+		@return: list of KEYWORDS that have been accepted
+		"""
+
+		pgroups = global_accept_keywords.split()
+		cp = cpv_getkey(cpv)
+
+		unmaskgroups = []
+		if self._p_accept_keywords:
+			cpv_slot = "%s:%s" % (cpv, slot)
+			accept_keywords_defaults = tuple('~' + keyword for keyword in \
+				pgroups if keyword[:1] not in "~-")
+			for d in self._p_accept_keywords:
+				cpdict = d.get(cp)
+				if cpdict:
+					pkg_accept_keywords = \
+						ordered_by_atom_specificity(cpdict, cpv_slot)
+					if pkg_accept_keywords:
+						for x in pkg_accept_keywords:
+							if not x:
+								x = accept_keywords_defaults
+							unmaskgroups.extend(x)
+
+		pkgdict = self.pkeywordsdict.get(cp)
+		if pkgdict:
+			cpv_slot = "%s:%s" % (cpv, slot)
+			pkg_accept_keywords = \
+				ordered_by_atom_specificity(pkgdict, cpv_slot, repo=repo)
+			if pkg_accept_keywords:
+				for x in pkg_accept_keywords:
+					unmaskgroups.extend(x)
+		return unmaskgroups
+



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     42d9f2ffd47101f279299df026d27026e816f8c7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 01:54:16 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 01:54:16 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=42d9f2ff

getRawMaskAtom: handle user negative incrementals

---
 pym/portage/package/ebuild/_config/MaskManager.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py
index 66278ec..be7a212 100644
--- a/pym/portage/package/ebuild/_config/MaskManager.py
+++ b/pym/portage/package/ebuild/_config/MaskManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 __all__ = (
@@ -16,6 +16,9 @@ class MaskManager(object):
 		user_config=True, strict_umatched_removal=False):
 		self._punmaskdict = ExtendedAtomDict(list)
 		self._pmaskdict = ExtendedAtomDict(list)
+		# Preserves atoms that are eliminated by negative
+		# incrementals in user_pkgmasklines.
+		self._pmaskdict_raw = ExtendedAtomDict(list)
 
 		#Read profile/package.mask from every repo.
 		#Repositories inherit masks from their parent profiles and
@@ -89,18 +92,23 @@ class MaskManager(object):
 
 		#Stack everything together. At this point, only user_pkgmasklines may contain -atoms.
 		#Don't warn for unmatched -atoms here, since we don't do it for any other user config file.
+		raw_pkgmasklines = stack_lists([repo_pkgmasklines, profile_pkgmasklines], \
+			incremental=1, remember_source_file=True, warn_for_unmatched_removal=False, ignore_repo=True)
 		pkgmasklines = stack_lists([repo_pkgmasklines, profile_pkgmasklines, user_pkgmasklines], \
 			incremental=1, remember_source_file=True, warn_for_unmatched_removal=False, ignore_repo=True)
 		pkgunmasklines = stack_lists([repo_pkgunmasklines, profile_pkgunmasklines, user_pkgunmasklines], \
 			incremental=1, remember_source_file=True, warn_for_unmatched_removal=False, ignore_repo=True)
 
+		for x, source_file in raw_pkgmasklines:
+			self._pmaskdict_raw.setdefault(x.cp, []).append(x)
+
 		for x, source_file in pkgmasklines:
 			self._pmaskdict.setdefault(x.cp, []).append(x)
 
 		for x, source_file in pkgunmasklines:
 			self._punmaskdict.setdefault(x.cp, []).append(x)
 
-		for d in (self._pmaskdict, self._punmaskdict):
+		for d in (self._pmaskdict_raw, self._pmaskdict, self._punmaskdict):
 			for k, v in d.items():
 				d[k] = tuple(v)
 
@@ -152,7 +160,7 @@ class MaskManager(object):
 		"""
 
 		cp = cpv_getkey(cpv)
-		mask_atoms = self._pmaskdict.get(cp)
+		mask_atoms = self._pmaskdict_raw.get(cp)
 		if mask_atoms:
 			pkg = "".join((cpv, _slot_separator, slot))
 			if repo:



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     60ffb9adc463f62663095a5d7588f9ae7edd097f
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Jan 31 04:36:45 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 05:38:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60ffb9ad

Properly fix my earlier breakage

---
 .../package/ebuild/_config/KeywordsManager.py      |   59 +++++++-------------
 1 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index b01604e..d153e95 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -118,31 +118,19 @@ class KeywordsManager(object):
 
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
-		pgroups = global_accept_keywords.split()
+		pgroups = set(global_accept_keywords.split())
 
 		unmaskgroups = self.getPKeywords(cpv, slot, repo,
 				global_accept_keywords)
-		pgroups.extend(unmaskgroups)
+		pgroups.update(unmaskgroups)
 
 		# Hack: Need to check the env directly here as otherwise stacking
 		# doesn't work properly as negative values are lost in the config
 		# object (bug #139600)
-		egroups = self._getEgroups(backuped_accept_keywords)
-		pgroups.extend(egroups)
+		egroups = backuped_accept_keywords.split()
 
 		if unmaskgroups or egroups:
-			inc_pgroups = set()
-			for x in pgroups:
-				if x[:1] == "-":
-					if x == "-*":
-						inc_pgroups.clear()
-					else:
-						inc_pgroups.discard(x[1:])
-				else:
-					inc_pgroups.add(x)
-			pgroups = inc_pgroups
-		else:
-			pgroups = set(pgroups)
+			pgroups = self._getEgroups(egroups, pgroups.copy())
 
 		return self._getMissingKeywords(cpv, pgroups, mygroups)
 
@@ -178,7 +166,7 @@ class KeywordsManager(object):
 
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
-		pgroups = global_accept_keywords.split()
+		pgroups = set(global_accept_keywords.split())
 
 		# Hack: Need to check the env directly here as otherwise stacking
 		# doesn't work properly as negative values are lost in the config
@@ -186,18 +174,18 @@ class KeywordsManager(object):
 		# we want to use the environment keywords here,
 		# but stripped to it's base arch
 		# we want the raw keywords needed to be accepted from the ebuild
-		egroups = self._getEgroups(backuped_accept_keywords)
-		egroups = [x.lstrip('~') for x in egroups]
-
-		pgroups.extend(egroups)
+		if backuped_accept_keywords:
+			egroups = self._getEgroups(backuped_accept_keywords.split(),
+					pgroups.copy())
+			pgroups = set([x.lstrip('~') for x in egroups])
 
 		missing = self._getMissingKeywords(cpv, pgroups, mygroups)
 
-		return missing, pgroups
+		return missing, list(pgroups)
 
 
 	@staticmethod
-	def _getEgroups(backuped_accept_keywords):
+	def _getEgroups(egroups, mygroups):
 		"""gets any keywords defined in the environment
 
 		@param backuped_accept_keywords: ACCEPT_KEYWORDS from the backup env
@@ -205,22 +193,17 @@ class KeywordsManager(object):
 		@rtype: List
 		@return: list of KEYWORDS that have been accepted
 		"""
-		egroups = backuped_accept_keywords.split()
-		pgroups = []
-		if egroups:
-			pgroups.extend(egroups)
-			inc_pgroups = set()
-			for x in pgroups:
-				if x.startswith("-"):
-					if x == "-*":
-						inc_pgroups.clear()
-					else:
-						inc_pgroups.discard(x[1:])
+		mygroups.update(egroups)
+		inc_pgroups = set()
+		for x in mygroups:
+			if x.startswith("-"):
+				if x == "-*":
+					inc_pgroups.clear()
 				else:
-					inc_pgroups.add(x)
-			pgroups = inc_pgroups
-			del inc_pgroups
-		return pgroups
+					inc_pgroups.discard(x[1:])
+			else:
+				inc_pgroups.add(x)
+		return inc_pgroups
 
 
 	@staticmethod



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     c5d64577c61c1e8b17353f1c1e6e063f5148012f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 06:07:38 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 06:07:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c5d64577

KeywordsManager: use lists where order matters

Also remove x.lstrip('~') code from from getRawMissingKeywords() since
I don't understand it (was only recently added, and we can add back
later if appropriate).

---
 .../package/ebuild/_config/KeywordsManager.py      |   23 ++++++++++---------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index d153e95..247dcb4 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -118,11 +118,11 @@ class KeywordsManager(object):
 
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
-		pgroups = set(global_accept_keywords.split())
+		pgroups = global_accept_keywords.split()
 
 		unmaskgroups = self.getPKeywords(cpv, slot, repo,
 				global_accept_keywords)
-		pgroups.update(unmaskgroups)
+		pgroups.extend(unmaskgroups)
 
 		# Hack: Need to check the env directly here as otherwise stacking
 		# doesn't work properly as negative values are lost in the config
@@ -130,7 +130,9 @@ class KeywordsManager(object):
 		egroups = backuped_accept_keywords.split()
 
 		if unmaskgroups or egroups:
-			pgroups = self._getEgroups(egroups, pgroups.copy())
+			pgroups = self._getEgroups(egroups, pgroups)
+		else:
+			pgroups = set(pgroups)
 
 		return self._getMissingKeywords(cpv, pgroups, mygroups)
 
@@ -166,18 +168,16 @@ class KeywordsManager(object):
 
 		mygroups = self.getKeywords(cpv, slot, keywords, repo)
 		# Repoman may modify this attribute as necessary.
-		pgroups = set(global_accept_keywords.split())
+		pgroups = global_accept_keywords.split()
 
 		# Hack: Need to check the env directly here as otherwise stacking
 		# doesn't work properly as negative values are lost in the config
 		# object (bug #139600)
-		# we want to use the environment keywords here,
-		# but stripped to it's base arch
-		# we want the raw keywords needed to be accepted from the ebuild
 		if backuped_accept_keywords:
 			egroups = self._getEgroups(backuped_accept_keywords.split(),
-					pgroups.copy())
-			pgroups = set([x.lstrip('~') for x in egroups])
+					pgroups)
+		else:
+			pgroups = set(pgroups)
 
 		missing = self._getMissingKeywords(cpv, pgroups, mygroups)
 
@@ -193,10 +193,11 @@ class KeywordsManager(object):
 		@rtype: List
 		@return: list of KEYWORDS that have been accepted
 		"""
-		mygroups.update(egroups)
+		mygroups = list(mygroups)
+		mygroups.extend(egroups)
 		inc_pgroups = set()
 		for x in mygroups:
-			if x.startswith("-"):
+			if x[:1] == "-":
 				if x == "-*":
 					inc_pgroups.clear()
 				else:



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     2380b23e756caf6b91de8bea333508b46dda8ed7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 08:07:29 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 08:07:29 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2380b23e

getRawMissingKeywords: fix getEgroups breakage

---
 .../package/ebuild/_config/KeywordsManager.py      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index 247dcb4..0b593f6 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -174,7 +174,7 @@ class KeywordsManager(object):
 		# doesn't work properly as negative values are lost in the config
 		# object (bug #139600)
 		if backuped_accept_keywords:
-			egroups = self._getEgroups(backuped_accept_keywords.split(),
+			pgroups = self._getEgroups(backuped_accept_keywords.split(),
 					pgroups)
 		else:
 			pgroups = set(pgroups)



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/
@ 2011-02-06 13:09 Thomas Sachau
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Sachau @ 2011-02-06 13:09 UTC (permalink / raw
  To: gentoo-commits

commit:     1989cc809b67b8f847d58c096fb70fe89a961a3e
Author:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Tue Feb  1 00:12:40 2011 +0000
Commit:     Thomas Sachau <tommy <AT> gentoo <DOT> org>
CommitDate: Tue Feb  1 00:17:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1989cc80

put main code in a private func() to remove near duplicated code

---
 pym/portage/package/ebuild/_config/MaskManager.py |   43 ++++++++++++++-------
 1 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py
index be7a212..c438eb7 100644
--- a/pym/portage/package/ebuild/_config/MaskManager.py
+++ b/pym/portage/package/ebuild/_config/MaskManager.py
@@ -112,7 +112,7 @@ class MaskManager(object):
 			for k, v in d.items():
 				d[k] = tuple(v)
 
-	def getMaskAtom(self, cpv, slot, repo):
+	def _getMaskAtom(self, cpv, slot, repo, unmask_atoms=None):
 		"""
 		Take a package and return a matching package.mask atom, or None if no
 		such atom exists or it has been cancelled by package.unmask. PROVIDE
@@ -122,6 +122,10 @@ class MaskManager(object):
 		@type cpv: String
 		@param slot: The package's slot
 		@type slot: String
+		@param repo: The package's repository [optional]
+		@type repo: String
+		@param unmask_atoms: if desired pass in self._punmaskdict.get(cp)
+		@type unmask_atoms: list
 		@rtype: String
 		@return: A matching atom string or None if one is not found.
 		"""
@@ -133,7 +137,6 @@ class MaskManager(object):
 			if repo:
 				pkg = "".join((pkg, _repo_separator, repo))
 			pkg_list = [pkg]
-			unmask_atoms = self._punmaskdict.get(cp)
 			for x in mask_atoms:
 				if not match_from_list(x, pkg_list):
 					continue
@@ -144,6 +147,27 @@ class MaskManager(object):
 				return x
 		return None
 
+
+	def getMaskAtom(self, cpv, slot, repo):
+		"""
+		Take a package and return a matching package.mask atom, or None if no
+		such atom exists or it has been cancelled by package.unmask. PROVIDE
+		is not checked, so atoms will not be found for old-style virtuals.
+
+		@param cpv: The package name
+		@type cpv: String
+		@param slot: The package's slot
+		@type slot: String
+		@param repo: The package's repository [optional]
+		@type repo: String
+		@rtype: String
+		@return: A matching atom string or None if one is not found.
+		"""
+
+		cp = cpv_getkey(cpv)
+		return self._getMaskAtom(cpv, slot, repo, self._punmaskdict.get(cp))
+
+
 	def getRawMaskAtom(self, cpv, slot, repo):
 		"""
 		Take a package and return a matching package.mask atom, or None if no
@@ -155,19 +179,10 @@ class MaskManager(object):
 		@type cpv: String
 		@param slot: The package's slot
 		@type slot: String
+		@param repo: The package's repository [optional]
+		@type repo: String
 		@rtype: String
 		@return: A matching atom string or None if one is not found.
 		"""
 
-		cp = cpv_getkey(cpv)
-		mask_atoms = self._pmaskdict_raw.get(cp)
-		if mask_atoms:
-			pkg = "".join((cpv, _slot_separator, slot))
-			if repo:
-				pkg = "".join((pkg, _repo_separator, repo))
-			pkg_list = [pkg]
-			for x in mask_atoms:
-				if not match_from_list(x, pkg_list):
-					continue
-				return x
-		return None
+		return self._getMaskAtom(cpv, slot, repo)



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

end of thread, other threads:[~2011-02-06 13:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-06 13:09 [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/ Thomas Sachau
  -- strict thread matches above, loose matches on Subject: below --
2011-02-06 13:09 Thomas Sachau
2011-02-06 13:09 Thomas Sachau
2011-02-06 13:09 Thomas Sachau
2011-02-06 13:09 Thomas Sachau
2011-02-06 13:09 Thomas Sachau

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