summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-01-10 08:40:35 +0000
committerZac Medico <zmedico@gentoo.org>2009-01-10 08:40:35 +0000
commitb6a0989c5983cebdb644a5f62446c508c2689eeb (patch)
tree7614b7a984aeb8d7ff1eb68d8a45b2461e8c6886
parent* Enable the recursive option in profile package.use parsing. (diff)
downloadportage-multirepo-b6a0989c5983cebdb644a5f62446c508c2689eeb.tar.gz
portage-multirepo-b6a0989c5983cebdb644a5f62446c508c2689eeb.tar.bz2
portage-multirepo-b6a0989c5983cebdb644a5f62446c508c2689eeb.zip
Bug #55321 - Add support for package.keywords in profiles. In profiles,
package.keywords modifies effective KEYWORDS values for a given ebuild. This behavior is notably different from /etc/portage/package.keywords, which instead modifies effective ACCEPT_KEYWORDS. svn path=/main/trunk/; revision=12410
-rw-r--r--man/portage.521
-rw-r--r--pym/portage/__init__.py35
2 files changed, 53 insertions, 3 deletions
diff --git a/man/portage.5 b/man/portage.5
index 3e8eb7af..fac8c90e 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -29,6 +29,7 @@ eapi
make.defaults
packages
packages.build
+package.keywords
package.mask
package.provided
package.unmask
@@ -585,6 +586,26 @@ A list of all the packages which will be displayed when you run `emerge info`.
.BR info_vars
A list of all the variables which will be displayed when you run `emerge info`.
.TP
+.BR package.keywords
+Per\-profile KEYWORDS. Useful for cases in which the effective KEYWORDS of a
+given package should vary depending on which profile the user has selected.
+
+.I Format:
+.nf
+\- comment lines begin with # (no inline comments)
+\- one DEPEND atom per line followed by additional KEYWORDS
+.fi
+
+.I Example:
+.nf
+# add stable keyword to libgd
+media\-libs/libgd x86
+# remove stable keyword from mplayer and add unstable keyword
+media\-video/mplayer \-x86 ~x86
+# remove all keywords from netcat
+net-analyzer/netcat -*
+.fi
+.TP
.BR package.mask
This contains a list of DEPEND atoms for packages that should not be installed
in any profile. Useful for adding the latest KDE betas and making sure no
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index bd5425d4..ff577af0 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1132,6 +1132,7 @@ class config(object):
self.pusedict = copy.deepcopy(clone.pusedict)
self.categories = copy.deepcopy(clone.categories)
self.pkeywordsdict = copy.deepcopy(clone.pkeywordsdict)
+ self._pkeywords_list = copy.deepcopy(clone._pkeywords_list)
self.pmaskdict = copy.deepcopy(clone.pmaskdict)
self.punmaskdict = copy.deepcopy(clone.punmaskdict)
self.prevmaskdict = copy.deepcopy(clone.prevmaskdict)
@@ -1261,6 +1262,16 @@ class config(object):
else:
self.prevmaskdict[mycatpkg].append(x)
+ self._pkeywords_list = []
+ rawpkeywords = [grabdict_package(
+ os.path.join(x, "package.keywords")) \
+ for x in self.profiles]
+ for i in xrange(len(self.profiles)):
+ cpdict = {}
+ for k, v in rawpkeywords[i].iteritems():
+ cpdict.setdefault(dep_getkey(k), {})[k] = v
+ self._pkeywords_list.append(cpdict)
+
# get profile-masked use flags -- INCREMENTAL Child over parent
self.usemask_list = [grabfile(os.path.join(x, "use.mask")) \
for x in self.profiles]
@@ -2240,6 +2251,25 @@ class config(object):
return x
return None
+ def _getKeywords(self, cpv, metadata):
+ cp = dep_getkey(cpv)
+ pkg = "%s:%s" % (cpv, metadata["SLOT"])
+ keywords = metadata["KEYWORDS"].split()
+ pos = len(keywords)
+ for i in xrange(len(self.profiles)):
+ cpdict = self._pkeywords_list[i].get(cp, None)
+ if cpdict:
+ keys = list(cpdict)
+ while keys:
+ best_match = best_match_to_list(pkg, keys)
+ if best_match:
+ keys.remove(best_match)
+ keywords.insert(pos, cpdict[best_match])
+ else:
+ break
+ pos = len(keywords)
+ return stack_lists(keywords, incremental=True)
+
def _getMissingKeywords(self, cpv, metadata):
"""
Take a package and return a list of any KEYWORDS that the user may
@@ -2261,7 +2291,7 @@ class config(object):
# object (bug #139600)
egroups = self.configdict["backupenv"].get(
"ACCEPT_KEYWORDS", "").split()
- mygroups = metadata["KEYWORDS"].split()
+ mygroups = self._getKeywords(cpv, metadata)
# Repoman may modify this attribute as necessary.
pgroups = self["ACCEPT_KEYWORDS"].split()
match=0
@@ -6963,7 +6993,7 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
# keywords checking
eapi = metadata["EAPI"]
- mygroups = metadata["KEYWORDS"]
+ mygroups = settings._getKeywords(mycpv, metadata)
licenses = metadata["LICENSE"]
slot = metadata["SLOT"]
if eapi.startswith("-"):
@@ -6974,7 +7004,6 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
return ["EAPI %s" % eapi]
egroups = settings.configdict["backupenv"].get(
"ACCEPT_KEYWORDS", "").split()
- mygroups = mygroups.split()
pgroups = settings["ACCEPT_KEYWORDS"].split()
myarch = settings["ARCH"]
if pgroups and myarch not in pgroups: