Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 40644 Details for
Bug 43422
"equery files": adds a "--filter=<rules>" local option
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
equery-0.2.0_pre9--files_filter.patch
equery-0.2.0_pre9--files_filter.patch (text/plain), 5.41 KB, created by
TGL
on 2004-09-28 11:37:19 UTC
(
hide
)
Description:
equery-0.2.0_pre9--files_filter.patch
Filename:
MIME Type:
Creator:
TGL
Created:
2004-09-28 11:37:19 UTC
Size:
5.41 KB
patch
obsolete
>--- equery.orig 2004-09-28 19:09:38.000000000 +0200 >+++ equery 2004-09-28 19:53:50.966478472 +0200 >@@ -104,7 +104,8 @@ > self.default_options = { > "showType": 0, > "showTimestamp": 0, >- "showMD5": 0 >+ "showMD5": 0, >+ "filter": None > } > > def parseArgs(self,args): >@@ -120,6 +121,8 @@ > opts["showTimestamp"] = 1 > elif x in ["--type"]: > opts["showType"] = 1 >+ elif x[:9] == "--filter=": >+ opts["filter"] = string.split(x[9:],',') > else: > query = x > >@@ -128,7 +131,72 @@ > sys.exit(-1) > > return (query, opts) >- >+ >+ def filterContents(self, cnt, filter): >+ if filter in [None,[]]: >+ return cnt >+ >+ mycnt = {} >+ >+ for mytype in filter: >+ # Filter elements by type (as recorded in CONTENTS). >+ if mytype in ["dir","obj","sym","dev","fifo"]: >+ for mykey in cnt.keys(): >+ if cnt[mykey][0] == mytype: >+ mycnt[mykey] = cnt[mykey] >+ >+ if "cmd" in filter: >+ # List files that are in $PATH. >+ userpath = map(os.path.normpath,os.environ["PATH"].split(os.pathsep)) >+ for mykey in cnt.keys(): >+ if cnt[mykey][0] in ['obj','sym'] \ >+ and os.path.dirname(mykey) in userpath: >+ mycnt[mykey] = cnt[mykey] >+ >+ if "path" in filter: >+ # List only dirs where some files where actually installed, >+ # and also skip their subdirs. >+ mykeys = cnt.keys() >+ mykeys.sort() >+ while len(mykeys): >+ mykey = mykeys.pop(0) >+ if cnt[mykey][0] == 'dir': >+ i = 0 >+ while i < len(mykeys) : >+ if cnt[mykeys[i]][0] != "dir" \ >+ and os.path.dirname(mykeys[i]) == mykey: >+ mycnt[mykey] = cnt[mykey] >+ break >+ i += 1 >+ if i < len(mykeys): >+ while len(mykeys) \ >+ and len(mykey+"/") < len(mykeys[0]) \ >+ and mykey+"/" == mykeys[0][:len(mykey)+1]: >+ mykeys.pop(0) >+ >+ if "conf" in filter: >+ # List configuration files. >+ # XXX: doesn't take CONFIG_PROTECT_MASK into account. Bah... >+ conf_path = gentoolkit.settings["CONFIG_PROTECT"].split(" ") >+ conf_path = map(os.path.normpath, conf_path) >+ for mykey in cnt.keys(): >+ if cnt[mykey][0] == 'obj': >+ for conf_dir in conf_path: >+ if conf_dir+"/" == mykey[:len(conf_dir)+1]: >+ mycnt[mykey] = cnt[mykey] >+ break >+ >+ for mydoctype in ["doc","man","info"]: >+ # List only files from /usr/share/{doc,man,info} >+ mydocpath = "/usr/share/"+mydoctype+"/" >+ if mydoctype in filter: >+ for mykey in cnt.keys(): >+ if cnt[mykey][0] == 'obj' \ >+ and mykey[:len(mydocpath)] == mydocpath : >+ mycnt[mykey] = cnt[mykey] >+ >+ return mycnt >+ > def perform(self, args): > > (query, opts) = self.parseArgs(args) >@@ -144,7 +212,7 @@ > > print_info(1, pp.section("* ") + "Contents of " + pp.cpv(x.get_cpv()) + ":") > >- cnt = x.get_contents() >+ cnt = self.filterContents(x.get_contents(),opts["filter"]) > > filenames = cnt.keys() > filenames.sort() >@@ -165,9 +233,23 @@ > "Note: category and version parts are optional. \n" + \ > "\n" + \ > pp.localoption("<local-opts>") + " is either of: \n" + \ >- " " + pp.localoption("--timestamp") + " - append timestamp\n" + \ >- " " + pp.localoption("--md5sum") + " - append md5sum\n" + \ >- " " + pp.localoption("--type") + " - prepend file type" >+ " " + pp.localoption("--timestamp") + " - append timestamp\n" + \ >+ " " + pp.localoption("--md5sum") + " - append md5sum\n" + \ >+ " " + pp.localoption("--type") + " - prepend file type\n" + \ >+ " " + pp.localoption("--filter=<rules>") + " - filter output\n" + \ >+ " " + pp.localoption("<rules>") + " is a comma separated list of elements you want to see:\n" + \ >+ " " + " " + pp.localoption("dir") + \ >+ ", " + pp.localoption("obj") + \ >+ ", " + pp.localoption("sym") + \ >+ ", " + pp.localoption("dev") + \ >+ ", " + pp.localoption("fifo") + \ >+ ", " + pp.localoption("path") + \ >+ ", " + pp.localoption("conf") + \ >+ ", " + pp.localoption("cmd") + \ >+ ", " + pp.localoption("doc") + \ >+ ", " + pp.localoption("man") + \ >+ ", " + pp.localoption("info") >+ > def shortHelp(self): > return pp.localoption("<local-opts> ") + pp.pkgquery("pkgspec") + " - list files owned by " + pp.pkgquery("pkgspec") >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43422
:
26688
| 40644 |
40645