Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 124715 Details for
Bug 185122
[PATCH] Add a flag to emerge to display use flag descriptions
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to emerge to add the flags
emerge.diff (text/plain), 6.03 KB, created by
Andrei Barbu
on 2007-07-12 22:51:54 UTC
(
hide
)
Description:
Patch to emerge to add the flags
Filename:
MIME Type:
Creator:
Andrei Barbu
Created:
2007-07-12 22:51:54 UTC
Size:
6.03 KB
patch
obsolete
>--- /mnt/stuff/usr/bin/emerge 2007-07-09 11:30:29.000000000 -0400 >+++ emerge 2007-07-12 18:27:28.000000000 -0400 >@@ -4,6 +4,7 @@ > # $Id: emerge 5629 2007-01-13 08:54:35Z zmedico $ > > import sys >+import operator > # This block ensures that ^C interrupts are handled quietly. > try: > import signal >@@ -173,7 +174,7 @@ > "--fetchonly", "--fetch-all-uri", > "--getbinpkg", "--getbinpkgonly", > "--help", "--ignore-default-opts", >-"--noconfmem", >+"--longuse", "--noconfmem", > "--newuse", "--nocolor", > "--nodeps", "--noreplace", > "--nospinner", "--oneshot", >@@ -198,7 +199,7 @@ > "g":"--getbinpkg", "G":"--getbinpkgonly", > "h":"--help", > "k":"--usepkg", "K":"--usepkgonly", >-"l":"--changelog", >+"l":"--changelog", "L":"--longuse", > "n":"--noreplace", "N":"--newuse", > "o":"--onlydeps", "O":"--nodeps", > "p":"--pretend", "P":"--prune", >@@ -1077,7 +1078,8 @@ > "binary":"bintree", > "installed":"vartree"} > >- def __init__(self, settings, trees, myopts, myparams, spinner): >+ def __init__(self, settings, trees, myopts, myparams, spinner, use_descs): >+ self.use_descs = use_descs > self.settings = settings > self.target_root = settings["ROOT"] > self.myopts = myopts >@@ -2558,7 +2560,7 @@ > else: > def create_use_string(name, cur_iuse, iuse_forced, cur_use, > old_iuse, old_use, >- is_new, all_flags=(verbosity == 3 or "--quiet" in self.myopts), >+ is_new, pkg_key, all_flags=(verbosity == 3 or "--quiet" in self.myopts), > alphabetical=("--alphabetical" in self.myopts)): > enabled = [] > if alphabetical: >@@ -2573,6 +2575,10 @@ > any_iuse = cur_iuse.union(old_iuse) > any_iuse = list(any_iuse) > any_iuse.sort() >+ >+ if "--longuse" in self.myopts and name == "USE": >+ enabled += '\n' >+ > for flag in any_iuse: > flag_str = None > isEnabled = False >@@ -2590,7 +2596,11 @@ > if flag in old_use: > flag_str += "*" > flag_str = "(" + flag_str + ")" >- removed.append(flag_str) >+ if "--longuse" in self.myopts and name == "USE": >+ removed.append(flag_str.ljust(40)) >+ removed.append(flag_description(self.use_descs, pkg_key, flag)) >+ else: >+ removed.append(flag_str) > continue > else: > if is_new or flag in old_iuse and flag not in old_use and all_flags: >@@ -2605,14 +2615,27 @@ > if flag in iuse_forced: > flag_str = "(" + flag_str + ")" > if isEnabled: >- enabled.append(flag_str) >+ if "--longuse" in self.myopts and name == "USE": >+ enabled.append(flag_str.ljust(40)) >+ enabled.append(flag_description(self.use_descs, pkg_key, flag)) >+ else: >+ enabled.append(flag_str) > else: >- disabled.append(flag_str) >+ if "--longuse" in self.myopts and name == "USE": >+ disabled.append(flag_str.ljust(40)) >+ disabled.append(flag_description(self.use_descs, pkg_key, flag)) >+ else: >+ disabled.append(flag_str) > > if alphabetical: > ret = " ".join(enabled) > else: > ret = " ".join(enabled + disabled + removed) >+ >+ if "--longuse" in self.myopts and name == "USE": >+ # use flags have a newline at the end, strip it >+ ret = ret[:-1] >+ > if ret: > ret = '%s="%s" ' % (name, ret) > return ret >@@ -2911,7 +2934,7 @@ > verboseadd += create_use_string(key.upper(), > cur_iuse_map[key], iuse_forced[key], > cur_use_map[key], old_iuse_map[key], >- old_use_map[key], is_new) >+ old_use_map[key], is_new, pkg_key) > > if verbosity == 3: > # size verbose >@@ -5250,6 +5273,37 @@ > else: > print "Number removed: "+str(len(cleanlist)) > >+def use_desc_files(settings): >+ local_desc = [] >+ global_desc = [] >+ >+ for p in settings["PORTDIR"].split() + settings["PORTDIR_OVERLAY"].split(): >+ try: >+ local_desc += open(p + "/profiles/use.local.desc").readlines() >+ except IOError: >+ pass >+ try: >+ global_desc += open(p + "/profiles/use.desc").readlines() >+ except IOError: >+ pass >+ >+ >+ return global_desc, local_desc >+ >+def strip_version(pkg_key): >+ return re.compile("[^/]+/[^-]+").match(pkg_key).group() >+ >+def flag_description(use_descs, pkg_key, flag): >+ local_descs, global_descs = use_descs >+ descr = filter(lambda line: line.startswith(flag + ' '), local_descs) >+ if descr == []: >+ descr = filter(lambda line: line.startswith(strip_version(pkg_key) + ':' + >+ flag + ' '), global_descs) >+ if descr == []: >+ return "" >+ return strip_version(pkg_key) + ':' + descr[0].split(' - ',1)[1] >+ return descr[0].split(' - ',1)[1] >+ > def action_build(settings, trees, mtimedb, > myopts, myaction, myfiles, spinner): > ldpath_mtimes = mtimedb["ldpath"] >@@ -5260,6 +5314,11 @@ > if pretend or fetchonly: > # make the mtimedb readonly > mtimedb.filename = None >+ >+ use_descs = [[],[]] >+ if "--longuse" in myopts: >+ use_descs = use_desc_files(settings) >+ > if "--quiet" not in myopts and \ > ("--pretend" in myopts or "--ask" in myopts or \ > "--tree" in myopts or "--verbose" in myopts): >@@ -5307,7 +5366,7 @@ > if "--quiet" not in myopts and "--nodeps" not in myopts: > print "Calculating dependencies ", > mydepgraph = depgraph(settings, trees, >- myopts, myparams, spinner) >+ myopts, myparams, spinner, use_descs) > try: > mydepgraph.loadResumeCommand(mtimedb["resume"]) > except portage_exception.PackageNotFound: >@@ -5331,7 +5390,7 @@ > if "--quiet" not in myopts and "--nodeps" not in myopts: > print "Calculating",myaction,"dependencies ", > sys.stdout.flush() >- mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) >+ mydepgraph = depgraph(settings, trees, myopts, myparams, spinner, use_descs) > if not mydepgraph.xcreate(myaction): > print "!!! Depgraph creation failed." > return 1 >@@ -5341,7 +5400,7 @@ > if "--quiet" not in myopts and "--nodeps" not in myopts: > print "Calculating dependencies ", > sys.stdout.flush() >- mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) >+ mydepgraph = depgraph(settings, trees, myopts, myparams, spinner, use_descs) > try: > retval, favorites = mydepgraph.select_files(myfiles) > except portage_exception.PackageNotFound, e:
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 185122
:
124710
|
124711
|
124713
| 124715