Add support for package.use.mask in the profile. It should behave exactly as use...
authorZac Medico <zmedico@gentoo.org>
Fri, 4 Aug 2006 18:57:01 +0000 (18:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 4 Aug 2006 18:57:01 +0000 (18:57 -0000)
svn path=/main/trunk/; revision=4151

bin/emerge
pym/portage.py

index ee5669b0b87069ad75bc2ac427dc4e3e27a245e7..29710f11fea5f5b7ef888a7d54cb8f5d30d22417 100755 (executable)
@@ -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()
index a348cdd4f9ae4bcc4547e3fff4d4107f762bad3c..c3818310b8a56b67167ba76a93a6de72d09a322f 100644 (file)
@@ -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.