diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-08-04 18:57:01 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-08-04 18:57:01 +0000 |
commit | 667d6c76bed30d1f9ffe55001e65ee7508b946da (patch) | |
tree | 38cefe4676d7b741133f63c905856deaf7e233d4 | |
parent | 15c3f994e75859017a8deba60f084d41d2a7ee9c (diff) | |
download | portage-667d6c76bed30d1f9ffe55001e65ee7508b946da.tar.gz portage-667d6c76bed30d1f9ffe55001e65ee7508b946da.tar.bz2 portage-667d6c76bed30d1f9ffe55001e65ee7508b946da.zip |
Add support for package.use.mask in the profile. It should behave exactly as use.mask currently does except that it allows USE flags to be masked for specific packages rather than for all packages. See bug #96368.
svn path=/main/trunk/; revision=4151
-rwxr-xr-x | bin/emerge | 8 | ||||
-rw-r--r-- | pym/portage.py | 23 |
2 files changed, 27 insertions, 4 deletions
diff --git a/bin/emerge b/bin/emerge index ee5669b0b..29710f11f 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1363,12 +1363,12 @@ class depgraph: bindb = self.trees[myroot]["bintree"].dbapi vartree = self.trees[myroot]["vartree"] pkgsettings = self.pkgsettings[myroot] + pkgsettings.setcpv(pkg_key) if pkg_key not in self.applied_useflags: if "binary" == pkg_type: self.applied_useflags[pkg_key] = bindb.aux_get( pkg_key, ["USE"])[0].split() elif "ebuild" == pkg_type: - pkgsettings.setcpv(pkg_key) self.applied_useflags[pkg_key] = pkgsettings["USE"].split() fetch=" " @@ -1448,7 +1448,8 @@ class depgraph: cur_iuse = portage.unique_array(cur_iuse) cur_iuse = [flag for flag in cur_iuse - if flag not in pkgsettings.usemask] + if flag not in pkgsettings.usemask \ + and flag not in pkgsettings.pusemask] cur_iuse.sort() cur_use = self.applied_useflags[x[2]] cur_use = [flag for flag in cur_use if flag in cur_iuse] @@ -1470,7 +1471,8 @@ class depgraph: old_use = [] is_new = True old_iuse = [flag for flag in old_iuse - if flag not in pkgsettings.usemask] + if flag not in pkgsettings.usemask \ + and flag not in pkgsettings.pusemask] old_use = [flag for flag in old_use if flag in old_iuse] use_expand = pkgsettings["USE_EXPAND"].lower().split() diff --git a/pym/portage.py b/pym/portage.py index a348cdd4f..c3818310b 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -766,6 +766,7 @@ class config: self.locked = 0 self.mycpv = None self.puse = [] + self.pusemask = [] self.modifiedkeys = [] self.uvlist = [] @@ -802,6 +803,8 @@ class config: self.use_defs = copy.deepcopy(clone.use_defs) self.usemask = copy.deepcopy(clone.usemask) + self.pusemaskdict = copy.deepcopy(clone.pusemaskdict) + self.pusemask = copy.deepcopy(clone.pusemask) self.configlist = copy.deepcopy(clone.configlist) self.lookuplist = self.configlist[:] @@ -938,6 +941,17 @@ class config: self.use_defs = stack_dictlist(use_defs_lists, incremental=True) del use_defs_lists + self.pusemaskdict = {} + rawpusemask = [grabdict_package( + os.path.join(x, "package.use.mask")) \ + for x in self.profiles] + rawpusemask = stack_dictlist(rawpusemask, incremental=True) + for k, v in rawpusemask.iteritems(): + cp = dep_getkey(k) + self.pusemaskdict.setdefault(cp, {}) + self.pusemaskdict[cp][k] = v + del rawpusemask + try: mygcfg_dlists = [getconfig(os.path.join(x, "make.globals")) \ for x in self.profiles + [os.path.join(config_root, "etc")]] @@ -1317,6 +1331,7 @@ class config: if not keeping_pkg: self.mycpv = None self.puse = "" + self.pusemask = [] self.configdict["pkg"].clear() self.regenerate(use_cache=use_cache) @@ -1371,6 +1386,12 @@ class config: self.pusekey = best_match_to_list(self.mycpv, self.pusedict[cp].keys()) if self.pusekey: self.puse = " ".join(self.pusedict[cp][self.pusekey]) + self.pusemask = [] + if cp in self.pusemaskdict: + pusemaskkey = best_match_to_list(self.mycpv, + self.pusemaskdict[cp].keys()) + if pusemaskkey: + self.pusemask = set(self.pusemaskdict[cp][pusemaskkey]) self.configdict["pkg"]["PKGUSE"] = self.puse[:] # For saving to PUSE file self.configdict["pkg"]["USE"] = self.puse[:] # this gets appended to USE # CATEGORY is essential for doebuild calls @@ -1510,7 +1531,7 @@ class config: usesplit=[] for x in string.split(self.configlist[-1]["USE"]): - if x not in self.usemask: + if x not in self.usemask and x not in self.pusemask: usesplit.append(x) # Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch. |