From: Zac Medico Date: Tue, 27 May 2008 06:12:43 +0000 (-0000) Subject: Use new Package.use and iuse attributes to avoid extra split() calls. X-Git-Tag: v2.1.5.3~39 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c9373c751774767171f294370697da2144178e97;p=portage.git Use new Package.use and iuse attributes to avoid extra split() calls. (trunk r10448) svn path=/main/branches/2.1.2/; revision=10449 --- diff --git a/bin/emerge b/bin/emerge index 8385c0af0..439498a2f 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1750,14 +1750,13 @@ class BlockerDB(object): if cached_blockers is not None: blocker_atoms = cached_blockers.atoms else: - myuse = inst_pkg.metadata["USE"].split() # Use aux_get() to trigger FakeVartree global # updates on *DEPEND when appropriate. depstr = " ".join(vardb.aux_get(inst_pkg.cpv, dep_keys)) try: portage_dep._dep_check_strict = False success, atoms = portage.dep_check(depstr, - vardb, settings, myuse=myuse, + vardb, settings, myuse=pkg.use.enabled, trees=dep_check_trees, myroot=inst_pkg.root) finally: portage_dep._dep_check_strict = True @@ -1792,12 +1791,11 @@ class BlockerDB(object): blocking_pkgs.update(blocker_parents.parent_nodes(atom)) # Check for blockers in the other direction. - myuse = new_pkg.metadata["USE"].split() depstr = " ".join(new_pkg.metadata[k] for k in dep_keys) try: portage_dep._dep_check_strict = False success, atoms = portage.dep_check(depstr, - vardb, settings, myuse=myuse, + vardb, settings, myuse=new_pkg.use.enabled, trees=dep_check_trees, myroot=new_pkg.root) finally: portage_dep._dep_check_strict = True @@ -2466,7 +2464,7 @@ class depgraph(object): myroot = pkg.root mykey = pkg.cpv metadata = pkg.metadata - myuse = metadata["USE"].split() + myuse = pkg.use.enabled jbigkey = pkg depth = pkg.depth + 1 @@ -3287,8 +3285,7 @@ class depgraph(object): if built and not installed and \ ("--newuse" in self.myopts or \ "--reinstall" in self.myopts): - iuses = set(filter_iuse_defaults( - pkg.metadata["IUSE"].split())) + iuses = pkg.iuse.all old_use = pkg.use.enabled if myeb: pkgsettings.setcpv(myeb) @@ -3300,8 +3297,7 @@ class depgraph(object): forced_flags.update(pkgsettings.usemask) cur_iuse = iuses if myeb and not usepkgonly: - cur_iuse = set(filter_iuse_defaults( - myeb.metadata["IUSE"].split())) + cur_iuse = myeb.iuse.all if self._reinstall_for_flags(forced_flags, old_use, iuses, now_use, cur_iuse): @@ -3320,8 +3316,7 @@ class depgraph(object): old_iuse = set(filter_iuse_defaults( vardb.aux_get(cpv, ["IUSE"])[0].split())) cur_use = pkgsettings["PORTAGE_USE"].split() - cur_iuse = set(filter_iuse_defaults( - pkg.metadata["IUSE"].split())) + cur_iuse = pkg.iuse.all reinstall_for_flags = \ self._reinstall_for_flags( forced_flags, old_use, old_iuse, @@ -3555,7 +3550,6 @@ class depgraph(object): if blocker_data: blocker_atoms = blocker_data.atoms else: - myuse = pkg.metadata["USE"].split() # Use aux_get() to trigger FakeVartree global # updates on *DEPEND when appropriate. depstr = " ".join(vardb.aux_get(pkg.cpv, dep_keys)) @@ -3566,7 +3560,7 @@ class depgraph(object): portage_dep._dep_check_strict = False try: success, atoms = portage.dep_check(depstr, - final_db, pkgsettings, myuse=myuse, + final_db, pkgsettings, myuse=pkg.use.enabled, trees=self._graph_trees, myroot=myroot) except Exception, e: if isinstance(e, SystemExit): @@ -3868,7 +3862,7 @@ class depgraph(object): try: portage_rdepend = self._select_atoms_highest_available( running_root, running_portage.metadata["RDEPEND"], - myuse=running_portage.metadata["USE"].split(), + myuse=running_portage.use.enabled, parent=running_portage, strict=False) except portage_exception.InvalidDependString, e: portage.writemsg("!!! Invalid RDEPEND in " + \ @@ -4675,7 +4669,7 @@ class depgraph(object): os.path.dirname(ebuild_path))) else: repo_path_real = portdb.getRepositoryPath(repo_name) - pkg_use = metadata["USE"].split() + pkg_use = list(pkg.use.enabled) try: restrict = flatten(use_reduce(paren_reduce( pkg.metadata["RESTRICT"]), uselist=pkg_use)) @@ -4755,18 +4749,15 @@ class depgraph(object): if True: # USE flag display - cur_iuse = list(filter_iuse_defaults( - pkg.metadata["IUSE"].split())) - forced_flags = set() - pkgsettings.setcpv(pkg.cpv, mydb=pkg.metadata) # for package.use.{mask,force} + pkgsettings.setcpv(pkg) # for package.use.{mask,force} forced_flags.update(pkgsettings.useforce) forced_flags.update(pkgsettings.usemask) - cur_iuse = portage.unique_array(cur_iuse) + cur_iuse = list(pkg.iuse.all) cur_iuse.sort() - cur_use = pkg_use - cur_use = [flag for flag in cur_use if flag in cur_iuse] + cur_use = [flag for flag in pkg.use.enabled \ + if flag in cur_iuse] if myoldbest and myinslotlist: previous_cpv = myoldbest[0]