1 |
Author: zmedico |
2 |
Date: 2009-08-01 19:58:52 +0000 (Sat, 01 Aug 2009) |
3 |
New Revision: 13873 |
4 |
|
5 |
Modified: |
6 |
main/trunk/man/emerge.1 |
7 |
main/trunk/pym/_emerge/help.py |
8 |
main/trunk/pym/_emerge/main.py |
9 |
Log: |
10 |
Add support for --usepkg=n so that it's possible to disable it on |
11 |
the command line after it's been enabled in EMERGE_DEFAULT_OPTS. |
12 |
Also do the same for --usepkgonly, --getbinpkg, and --getbinpkgonly. |
13 |
|
14 |
|
15 |
Modified: main/trunk/man/emerge.1 |
16 |
=================================================================== |
17 |
--- main/trunk/man/emerge.1 2009-08-01 18:58:23 UTC (rev 13872) |
18 |
+++ main/trunk/man/emerge.1 2009-08-01 19:58:52 UTC (rev 13873) |
19 |
@@ -324,14 +324,14 @@ |
20 |
Instead of doing any package building, just perform fetches for all |
21 |
packages (fetch everything in SRC_URI regardless of USE setting). |
22 |
.TP |
23 |
-.BR "\-\-getbinpkg " (\fB\-g\fR) |
24 |
+.BR "\-\-getbinpkg[=n] " (\fB\-g\fR) |
25 |
Using the server and location defined in \fIPORTAGE_BINHOST\fR (see |
26 |
\fBmake.conf\fR(5)), portage will download the information from each binary |
27 |
package found and it will use that information to help build the dependency |
28 |
list. This option implies \fB\-k\fR. (Use \fB\-gK\fR for binary\-only |
29 |
merging.) |
30 |
.TP |
31 |
-.BR "\-\-getbinpkgonly " (\fB\-G\fR) |
32 |
+.BR "\-\-getbinpkgonly[=n] " (\fB\-G\fR) |
33 |
This option is identical to \fB\-g\fR, as above, except binaries from the |
34 |
remote server are preferred over local packages if they are not identical. |
35 |
.TP |
36 |
@@ -462,13 +462,13 @@ |
37 |
This is only really useful in combination with \fB\-\-emptytree\fR or |
38 |
\fB\-\-update\fR and \fB\-\-deep\fR. |
39 |
.TP |
40 |
-.BR "\-\-usepkg " (\fB\-k\fR) |
41 |
+.BR "\-\-usepkg[=n] " (\fB\-k\fR) |
42 |
Tells emerge to use binary packages (from $PKGDIR) if they are available, thus |
43 |
possibly avoiding some time\-consuming compiles. This option is useful for CD |
44 |
installs; you can export PKGDIR=/mnt/cdrom/packages and then use this option to |
45 |
have emerge "pull" binary packages from the CD in order to satisfy dependencies. |
46 |
.TP |
47 |
-.BR "\-\-usepkgonly " (\fB\-K\fR) |
48 |
+.BR "\-\-usepkgonly[=n] " (\fB\-K\fR) |
49 |
Tells emerge to only use binary packages (from $PKGDIR). All the binary |
50 |
packages must be available at the time of dependency calculation or emerge |
51 |
will simply abort. Portage does not use $PORTDIR when calculating dependency |
52 |
|
53 |
Modified: main/trunk/pym/_emerge/help.py |
54 |
=================================================================== |
55 |
--- main/trunk/pym/_emerge/help.py 2009-08-01 18:58:23 UTC (rev 13872) |
56 |
+++ main/trunk/pym/_emerge/help.py 2009-08-01 19:58:52 UTC (rev 13873) |
57 |
@@ -338,13 +338,13 @@ |
58 |
print " Same as --fetchonly except that all package files, including those" |
59 |
print " not required to build the package, will be processed." |
60 |
print |
61 |
- print " "+green("--getbinpkg")+" ("+green("-g")+" short option)" |
62 |
+ print " "+green("--getbinpkg")+ "[=%s]" % turquoise("n") + " ("+green("-g")+" short option)" |
63 |
print " Using the server and location defined in PORTAGE_BINHOST, portage" |
64 |
print " will download the information from each binary file there and it" |
65 |
print " will use that information to help build the dependency list. This" |
66 |
print " option implies '-k'. (Use -gK for binary-only merging.)" |
67 |
print |
68 |
- print " "+green("--getbinpkgonly")+" ("+green("-G")+" short option)" |
69 |
+ print " "+green("--getbinpkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-G")+" short option)" |
70 |
print " This option is identical to -g, as above, except it will not use" |
71 |
print " ANY information from the local machine. All binaries will be" |
72 |
print " downloaded from the remote server without consulting packages" |
73 |
@@ -492,7 +492,7 @@ |
74 |
print " a package's dependencies follow the package. Only really useful" |
75 |
print " in combination with --emptytree, --update or --deep." |
76 |
print |
77 |
- print " "+green("--usepkg")+" ("+green("-k")+" short option)" |
78 |
+ print " "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)" |
79 |
print " Tell emerge to use binary packages (from $PKGDIR) if they are" |
80 |
print " available, thus possibly avoiding some time-consuming compiles." |
81 |
print " This option is useful for CD installs; you can export" |
82 |
@@ -500,7 +500,7 @@ |
83 |
print " emerge \"pull\" binary packages from the CD in order to satisfy" |
84 |
print " dependencies." |
85 |
print |
86 |
- print " "+green("--usepkgonly")+" ("+green("-K")+" short option)" |
87 |
+ print " "+green("--usepkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-K")+" short option)" |
88 |
print " Like --usepkg above, except this only allows the use of binary" |
89 |
print " packages, and it will abort the emerge if the package is not" |
90 |
print " available at the time of dependency calculation." |
91 |
|
92 |
Modified: main/trunk/pym/_emerge/main.py |
93 |
=================================================================== |
94 |
--- main/trunk/pym/_emerge/main.py 2009-08-01 18:58:23 UTC (rev 13872) |
95 |
+++ main/trunk/pym/_emerge/main.py 2009-08-01 19:58:52 UTC (rev 13873) |
96 |
@@ -52,7 +52,6 @@ |
97 |
"--digest", |
98 |
"--emptytree", |
99 |
"--fetchonly", "--fetch-all-uri", |
100 |
-"--getbinpkg", "--getbinpkgonly", |
101 |
"--ignore-default-opts", |
102 |
"--keep-going", |
103 |
"--noconfmem", |
104 |
@@ -65,7 +64,6 @@ |
105 |
"--skipfirst", |
106 |
"--tree", |
107 |
"--update", |
108 |
-"--usepkg", "--usepkgonly", |
109 |
"--verbose", |
110 |
] |
111 |
|
112 |
@@ -77,9 +75,7 @@ |
113 |
"d":"--debug", |
114 |
"e":"--emptytree", |
115 |
"f":"--fetchonly", "F":"--fetch-all-uri", |
116 |
-"g":"--getbinpkg", "G":"--getbinpkgonly", |
117 |
"h":"--help", |
118 |
-"k":"--usepkg", "K":"--usepkgonly", |
119 |
"l":"--changelog", |
120 |
"n":"--noreplace", "N":"--newuse", |
121 |
"o":"--onlydeps", "O":"--nodeps", |
122 |
@@ -386,8 +382,12 @@ |
123 |
'--deep' : valid_integers, |
124 |
'--deselect' : ('n',), |
125 |
'--binpkg-respect-use' : ('n', 'y',), |
126 |
+ '--getbinpkg' : ('n',), |
127 |
+ '--getbinpkgonly' : ('n',), |
128 |
'--jobs' : valid_integers, |
129 |
'--root-deps' : ('rdeps',), |
130 |
+ '--usepkg' : ('n',), |
131 |
+ '--usepkgonly' : ('n',), |
132 |
} |
133 |
|
134 |
short_arg_opts = { |
135 |
@@ -395,6 +395,15 @@ |
136 |
'j' : valid_integers, |
137 |
} |
138 |
|
139 |
+ # Don't make things like "-kn" expand to "-k n" |
140 |
+ # since existence of -n makes it too ambiguous. |
141 |
+ short_arg_opts_n = { |
142 |
+ 'g' : ('n',), |
143 |
+ 'G' : ('n',), |
144 |
+ 'k' : ('n',), |
145 |
+ 'K' : ('n',), |
146 |
+ } |
147 |
+ |
148 |
arg_stack = args[:] |
149 |
arg_stack.reverse() |
150 |
while arg_stack: |
151 |
@@ -421,6 +430,12 @@ |
152 |
break |
153 |
|
154 |
if match is None: |
155 |
+ for k, arg_choices in short_arg_opts_n.iteritems(): |
156 |
+ if k in arg: |
157 |
+ match = k |
158 |
+ break |
159 |
+ |
160 |
+ if match is None: |
161 |
new_args.append(arg) |
162 |
continue |
163 |
|
164 |
@@ -441,7 +456,7 @@ |
165 |
saved_opts = None |
166 |
|
167 |
if arg[1:2] == match: |
168 |
- if arg[2:] in arg_choices: |
169 |
+ if match not in short_arg_opts_n and arg[2:] in arg_choices: |
170 |
opt_arg = arg[2:] |
171 |
else: |
172 |
saved_opts = arg[2:] |
173 |
@@ -551,6 +566,20 @@ |
174 |
"choices" : ("True", "y", "n") |
175 |
}, |
176 |
|
177 |
+ "--getbinpkg": { |
178 |
+ "shortopt" : "-g", |
179 |
+ "help" : "fetch binary packages", |
180 |
+ "type" : "choice", |
181 |
+ "choices" : ("True", "n") |
182 |
+ }, |
183 |
+ |
184 |
+ "--getbinpkgonly": { |
185 |
+ "shortopt" : "-G", |
186 |
+ "help" : "fetch binary packages only", |
187 |
+ "type" : "choice", |
188 |
+ "choices" : ("True", "n") |
189 |
+ }, |
190 |
+ |
191 |
"--root": { |
192 |
"help" : "specify the target root filesystem for merging packages", |
193 |
"action" : "store" |
194 |
@@ -561,6 +590,21 @@ |
195 |
"type" : "choice", |
196 |
"choices" :("True", "rdeps") |
197 |
}, |
198 |
+ |
199 |
+ "--usepkg": { |
200 |
+ "shortopt" : "-k", |
201 |
+ "help" : "use binary packages", |
202 |
+ "type" : "choice", |
203 |
+ "choices" : ("True", "n") |
204 |
+ }, |
205 |
+ |
206 |
+ "--usepkgonly": { |
207 |
+ "shortopt" : "-K", |
208 |
+ "help" : "use only binary packages", |
209 |
+ "type" : "choice", |
210 |
+ "choices" : ("True", "n") |
211 |
+ }, |
212 |
+ |
213 |
} |
214 |
|
215 |
from optparse import OptionParser |
216 |
@@ -606,6 +650,16 @@ |
217 |
else: |
218 |
myoptions.complete_graph = None |
219 |
|
220 |
+ if myoptions.getbinpkg in ("True",): |
221 |
+ myoptions.getbinpkg = True |
222 |
+ else: |
223 |
+ myoptions.getbinpkg = None |
224 |
+ |
225 |
+ if myoptions.getbinpkgonly in ("True",): |
226 |
+ myoptions.getbinpkgonly = True |
227 |
+ else: |
228 |
+ myoptions.getbinpkgonly = None |
229 |
+ |
230 |
if myoptions.root_deps == "True": |
231 |
myoptions.root_deps = True |
232 |
|
233 |
@@ -660,6 +714,16 @@ |
234 |
|
235 |
myoptions.load_average = load_average |
236 |
|
237 |
+ if myoptions.usepkg in ("True",): |
238 |
+ myoptions.usepkg = True |
239 |
+ else: |
240 |
+ myoptions.usepkg = None |
241 |
+ |
242 |
+ if myoptions.usepkgonly in ("True",): |
243 |
+ myoptions.usepkgonly = True |
244 |
+ else: |
245 |
+ myoptions.usepkgonly = None |
246 |
+ |
247 |
for myopt in options: |
248 |
v = getattr(myoptions, myopt.lstrip("--").replace("-", "_")) |
249 |
if v: |