1 |
Author: zmedico |
2 |
Date: 2009-07-03 19:13:59 +0000 (Fri, 03 Jul 2009) |
3 |
New Revision: 13766 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/help.py |
7 |
main/trunk/pym/_emerge/main.py |
8 |
Log: |
9 |
Make --help into an action, and move --help --sync output to the |
10 |
actions section. Thanks to Marat Radchenko <slonopotamusorama@×××××.com> |
11 |
for this patch. |
12 |
|
13 |
|
14 |
Modified: main/trunk/pym/_emerge/help.py |
15 |
=================================================================== |
16 |
--- main/trunk/pym/_emerge/help.py 2009-07-03 18:34:45 UTC (rev 13765) |
17 |
+++ main/trunk/pym/_emerge/help.py 2009-07-03 19:13:59 UTC (rev 13766) |
18 |
@@ -21,17 +21,17 @@ |
19 |
print " [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]" |
20 |
print bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]" |
21 |
|
22 |
-def help(myaction,myopts,havecolor=1): |
23 |
+def help(myopts, havecolor=1): |
24 |
# TODO: Implement a wrap() that accounts for console color escape codes. |
25 |
from textwrap import wrap |
26 |
desc_left_margin = 14 |
27 |
desc_indent = desc_left_margin * " " |
28 |
desc_width = 80 - desc_left_margin - 5 |
29 |
- if not myaction and ("--verbose" not in myopts): |
30 |
+ if "--verbose" not in myopts: |
31 |
shorthelp() |
32 |
print |
33 |
print " For more help try 'emerge --help --verbose' or consult the man page." |
34 |
- elif not myaction: |
35 |
+ else: |
36 |
shorthelp() |
37 |
print |
38 |
print turquoise("Help (this screen):") |
39 |
@@ -195,6 +195,20 @@ |
40 |
print " emerge -S applet" |
41 |
print " emerge -S 'perl.*module'" |
42 |
print |
43 |
+ print " "+green("--sync") |
44 |
+ print " Tells emerge to update the Portage tree as specified in" |
45 |
+ print " The SYNC variable found in /etc/make.conf. By default, SYNC instructs" |
46 |
+ print " emerge to perform an rsync-style update with rsync.gentoo.org." |
47 |
+ print |
48 |
+ print " 'emerge-webrsync' exists as a helper app to emerge --sync, providing a" |
49 |
+ print " method to receive the entire portage tree as a tarball that can be" |
50 |
+ print " extracted and used. First time syncs would benefit greatly from this." |
51 |
+ print |
52 |
+ print " "+turquoise("WARNING:") |
53 |
+ print " If using our rsync server, emerge will clean out all files that do not" |
54 |
+ print " exist on it, including ones that you may have created. The exceptions" |
55 |
+ print " to this are the distfiles, local and packages directories." |
56 |
+ print |
57 |
print " "+green("--unmerge")+" ("+green("-C")+" short option)" |
58 |
print " "+turquoise("WARNING: This action can remove important packages!") |
59 |
print " Removes all matching packages. This does no checking of" |
60 |
@@ -500,20 +514,3 @@ |
61 |
print " added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later" |
62 |
print " overridden via the command line." |
63 |
print |
64 |
- elif myaction == "sync": |
65 |
- print |
66 |
- print bold("Usage: ")+turquoise("emerge")+" "+turquoise("--sync") |
67 |
- print |
68 |
- print " 'emerge --sync' tells emerge to update the Portage tree as specified in" |
69 |
- print " The SYNC variable found in /etc/make.conf. By default, SYNC instructs" |
70 |
- print " emerge to perform an rsync-style update with rsync.gentoo.org." |
71 |
- print |
72 |
- print " 'emerge-webrsync' exists as a helper app to emerge --sync, providing a" |
73 |
- print " method to receive the entire portage tree as a tarball that can be" |
74 |
- print " extracted and used. First time syncs would benefit greatly from this." |
75 |
- print |
76 |
- print " "+turquoise("WARNING:") |
77 |
- print " If using our rsync server, emerge will clean out all files that do not" |
78 |
- print " exist on it, including ones that you may have created. The exceptions" |
79 |
- print " to this are the distfiles, local and packages directories." |
80 |
- print |
81 |
|
82 |
Modified: main/trunk/pym/_emerge/main.py |
83 |
=================================================================== |
84 |
--- main/trunk/pym/_emerge/main.py 2009-07-03 18:34:45 UTC (rev 13765) |
85 |
+++ main/trunk/pym/_emerge/main.py 2009-07-03 19:13:59 UTC (rev 13766) |
86 |
@@ -54,7 +54,7 @@ |
87 |
"--emptytree", |
88 |
"--fetchonly", "--fetch-all-uri", |
89 |
"--getbinpkg", "--getbinpkgonly", |
90 |
-"--help", "--ignore-default-opts", |
91 |
+"--ignore-default-opts", |
92 |
"--keep-going", |
93 |
"--noconfmem", |
94 |
"--newuse", |
95 |
@@ -203,7 +203,6 @@ |
96 |
if icount > 0: |
97 |
out.einfo("Processed %d info files." % (icount,)) |
98 |
|
99 |
- |
100 |
def display_preserved_libs(vardbapi): |
101 |
MAX_DISPLAY = 3 |
102 |
|
103 |
@@ -274,11 +273,10 @@ |
104 |
print colorize("WARN", " * ") + " used by %d other files" % (len(consumers) - MAX_DISPLAY) |
105 |
print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries" |
106 |
|
107 |
- |
108 |
def post_emerge(root_config, myopts, mtimedb, retval): |
109 |
""" |
110 |
Misc. things to run at the end of a merge session. |
111 |
- |
112 |
+ |
113 |
Update Info Files |
114 |
Update Config Files |
115 |
Update News Items |
116 |
@@ -347,14 +345,13 @@ |
117 |
portage.locks.unlockdir(vdb_lock) |
118 |
|
119 |
chk_updated_cfg_files(target_root, config_protect) |
120 |
- |
121 |
+ |
122 |
display_news_notification(root_config, myopts) |
123 |
if retval in (None, os.EX_OK) or (not "--pretend" in myopts): |
124 |
display_preserved_libs(vardbapi) |
125 |
|
126 |
sys.exit(retval) |
127 |
|
128 |
- |
129 |
def multiple_actions(action1, action2): |
130 |
sys.stderr.write("\n!!! Multiple actions requested... Please choose one only.\n") |
131 |
sys.stderr.write("!!! '%s' or '%s'\n\n" % (action1, action2)) |
132 |
@@ -439,7 +436,7 @@ |
133 |
global options, shortmapping |
134 |
|
135 |
actions = frozenset([ |
136 |
- "clean", "config", "depclean", |
137 |
+ "clean", "config", "depclean", "help", |
138 |
"info", "list-sets", "metadata", |
139 |
"prune", "regen", "search", |
140 |
"sync", "unmerge", "version", |
141 |
@@ -666,7 +663,7 @@ |
142 |
IS_OPERATOR = "/@" |
143 |
DIFF_OPERATOR = "-@" |
144 |
UNION_OPERATOR = "+@" |
145 |
- |
146 |
+ |
147 |
for i in range(0, len(myfiles)): |
148 |
if myfiles[i].startswith(SETPREFIX): |
149 |
start = 0 |
150 |
@@ -679,7 +676,7 @@ |
151 |
if start > 0 and start < end: |
152 |
namepart = x[:start] |
153 |
argpart = x[start+1:end] |
154 |
- |
155 |
+ |
156 |
# TODO: implement proper quoting |
157 |
args = argpart.split(",") |
158 |
options = {} |
159 |
@@ -696,13 +693,13 @@ |
160 |
newset += x |
161 |
x = "" |
162 |
myfiles[i] = SETPREFIX+newset |
163 |
- |
164 |
+ |
165 |
sets = setconfig.getSets() |
166 |
|
167 |
# display errors that occured while loading the SetConfig instance |
168 |
for e in setconfig.errors: |
169 |
print colorize("BAD", "Error during set creation: %s" % e) |
170 |
- |
171 |
+ |
172 |
# emerge relies on the existance of sets with names "world" and "system" |
173 |
required_sets = ("world", "system") |
174 |
missing_sets = [] |
175 |
@@ -870,9 +867,9 @@ |
176 |
writemsg_level(msg, level=logging.WARN, noiselevel=-1) |
177 |
|
178 |
def profile_check(trees, myaction, myopts): |
179 |
- if myaction in ("info", "sync"): |
180 |
+ if myaction in ("help", "info", "sync"): |
181 |
return os.EX_OK |
182 |
- elif "--version" in myopts or "--help" in myopts: |
183 |
+ elif "--version" in myopts: |
184 |
return os.EX_OK |
185 |
for root, root_trees in trees.iteritems(): |
186 |
if root_trees["root_config"].settings.profiles: |
187 |
@@ -1082,8 +1079,8 @@ |
188 |
settings.profile_path, settings["CHOST"], |
189 |
trees[settings["ROOT"]]["vartree"].dbapi) |
190 |
return 0 |
191 |
- elif "--help" in myopts: |
192 |
- _emerge.help.help(myaction, myopts, portage.output.havecolor) |
193 |
+ elif myaction == "help": |
194 |
+ _emerge.help.help(myopts, portage.output.havecolor) |
195 |
return 0 |
196 |
|
197 |
if "--debug" in myopts: |