From 42ebc2d62ee39c0cfe1d20aad2aff2441c70bfed Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 5 Oct 2007 21:07:29 +0000 Subject: [PATCH] Merged from trunk 7961:7963 | 7962 | Document SLOT dependencies. | | zmedico | | | 7963 | include sets in emerge --search | | genone | | svn path=/main/branches/prefix/; revision=7965 --- man/ebuild.5 | 12 ++++++++++ pym/emerge/__init__.py | 50 +++++++++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/man/ebuild.5 b/man/ebuild.5 index 0eb1b32d9..e07d8f071 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -247,6 +247,18 @@ etc... and not match version '1.0', '3.0', '4.1', etc... \fI~\fR means match any revision of the base version specified. So in the above example, we would match versions '1.0.2a', '1.0.2a\-r1', '1.0.2a\-r2', etc... +.TP +.B Atom Slots +Beginning with \fBEAPI 1\fR, any atom can be constrained to match a specific +\fBSLOT\fR. This is accomplished by appending a colon followed by a +\fBSLOT\fR: + +.nf +x11\-libs/qt:3 +\fI~\fRx11\-libs/qt-3.3.8:3 +\fI>=\fRx11\-libs/qt-3.3.8:3 +\fI=\fRx11\-libs/qt-3.3*:3 +.fi .RE .TP .B Dynamic DEPENDs diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 0b550747a..839d8a17d 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -375,7 +375,7 @@ class search(object): # public interface # def __init__(self, settings, portdb, vartree, spinner, searchdesc, - verbose): + verbose, setconfig): """Searches the available and installed packages for the supplied search key. The list of available and installed packages is created at object instantiation. This makes successive searches faster.""" @@ -385,6 +385,7 @@ class search(object): self.spinner = spinner self.verbose = verbose self.searchdesc = searchdesc + self.setconfig = setconfig def execute(self,searchkey): """Performs the search for the supplied search key""" @@ -393,10 +394,10 @@ class search(object): self.packagematches = [] if self.searchdesc: self.searchdesc=1 - self.matches = {"pkg":[], "desc":[]} + self.matches = {"pkg":[], "desc":[], "set":[]} else: self.searchdesc=0 - self.matches = {"pkg":[]} + self.matches = {"pkg":[], "set":[]} print "Searching... ", regexsearch = False @@ -441,6 +442,21 @@ class search(object): continue if self.searchre.search(full_desc): self.matches["desc"].append([full_package,masked]) + + self.sdict = self.setconfig.getSets()[0] + for setname in self.sdict: + self.spinner.update() + if match_category: + match_string = setname + else: + match_string = setname.split("/")[-1] + + if self.searchre.search(match_string): + self.matches["set"].append([setname, False]) + elif self.searchdesc: + if self.searchre.search(sdict[setname].getMetadata("DESCRIPTION")): + self.matches["set"].append([setname, False]) + self.mlen=0 for mtype in self.matches: self.matches[mtype].sort() @@ -453,8 +469,9 @@ class search(object): print " " for mtype in self.matches: for match,masked in self.matches[mtype]: - if mtype=="pkg": - catpack=match + full_package = None + if mtype == "pkg": + catpack = match full_package = self.portdb.xmatch( "bestmatch-visible", match) if not full_package: @@ -462,10 +479,13 @@ class search(object): masked=1 full_package = portage.best( self.portdb.xmatch("match-all",match)) - else: + elif mtype == "desc": full_package = match match = portage.pkgsplit(match)[0] - + elif mtype == "set": + print green("*")+" "+white(match) + print " ", darkgreen("Description:")+" ", self.sdict[match].getMetadata("DESCRIPTION") + print if full_package: try: desc, homepage, license = self.portdb.aux_get( @@ -5516,13 +5536,13 @@ def action_info(settings, trees, myopts, myfiles): mydbapi=trees[settings["ROOT"]]["vartree"].dbapi, tree="vartree") -def action_search(settings, portdb, vartree, myopts, myfiles, spinner): +def action_search(settings, portdb, vartree, myopts, myfiles, spinner, setconfig): if not myfiles: print "emerge: no search terms provided." else: searchinstance = search(settings, portdb, vartree, spinner, "--searchdesc" in myopts, - "--quiet" not in myopts) + "--quiet" not in myopts, setconfig) for mysearch in myfiles: try: searchinstance.execute(mysearch) @@ -6444,12 +6464,12 @@ def emerge_main(): print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") break + setconfigpaths = ["/usr/share/portage/config/sets.conf", os.path.join(settings["PORTDIR"], "sets.conf"), \ + os.path.join(os.sep, settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "sets.conf")] + #setconfig = SetConfig(setconfigpaths, settings, trees[settings["ROOT"]]) + setconfig = make_default_config(settings, trees[settings["ROOT"]]) + del setconfigpaths if myaction not in ["search", "metadata", "sync"]: - setconfigpaths = ["/usr/share/portage/config/sets.conf", os.path.join(settings["PORTDIR"], "sets.conf"), \ - os.path.join(os.sep, settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "sets.conf")] - #setconfig = SetConfig(setconfigpaths, settings, trees[settings["ROOT"]]) - setconfig = make_default_config(settings, trees[settings["ROOT"]]) - del setconfigpaths packagesets, setconfig_errors = setconfig.getSetsWithAliases() for s in packagesets: if s in myfiles: @@ -6650,7 +6670,7 @@ def emerge_main(): elif "search"==myaction: validate_ebuild_environment(trees) action_search(settings, portdb, trees["/"]["vartree"], - myopts, myfiles, spinner) + myopts, myfiles, spinner, setconfig) elif myaction in ("clean", "unmerge") or \ (myaction == "prune" and "--nodeps" in myopts): validate_ebuild_environment(trees) -- 2.26.2