1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 from portage.output import bold, turquoise, green
10 print bold("emerge:")+" the other white meat (command-line interface to the Portage system)"
12 print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("set")+" | "+turquoise("atom")+" ] [ ... ]"
13 print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >"
14 print " "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >"
15 print " "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]"
16 print " "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("system")+" | "+green("world")+" | "+green("--sync")+" ] "
17 print bold("Options:")+" "+green("-")+"["+green("abBcCdDefgGhjkKlnNoOpqPsStuvV")+"]"
18 print " [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ] [ "+green("--columns")+" ]"
19 print " [ "+green("--complete-graph")+" ] [ "+green("--deep")+" ]"
20 print " [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]"
21 print " [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ] [ "+green("--oneshot")+" ]"
22 print " [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]"
23 print bold("Actions:")+" [ "+green("--depclean")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]"
25 def help(myaction,myopts,havecolor=1):
26 # TODO: Implement a wrap() that accounts for console color escape codes.
27 from textwrap import wrap
29 desc_indent = desc_left_margin * " "
30 desc_width = 80 - desc_left_margin - 5
31 if not myaction and ("--verbose" not in myopts):
34 print " For more help try 'emerge --help --verbose' or consult the man page."
38 print turquoise("Help (this screen):")
39 print " "+green("--help")+" ("+green("-h")+" short option)"
40 print " Displays this help; an additional argument (see above) will tell"
41 print " emerge to display detailed help."
43 print turquoise("Actions:")
44 print " "+green("--clean")+" ("+green("-c")+" short option)"
45 print " Cleans the system by removing outdated packages which will not"
46 print " remove functionalities or prevent your system from working."
47 print " The arguments can be in several different formats :"
50 print " * 'dependency specification' (in single quotes is best.)"
51 print " Here are a few examples of the dependency specification format:"
52 print " "+bold("binutils")+" matches"
53 print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
54 print " "+bold("sys-devel/binutils")+" matches"
55 print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
56 print " "+bold(">sys-devel/binutils-2.11.90.0.7")+" matches"
57 print " binutils-2.11.92.0.12.3-r1"
58 print " "+bold(">=sys-devel/binutils-2.11.90.0.7")+" matches"
59 print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
60 print " "+bold("<=sys-devel/binutils-2.11.92.0.12.3-r1")+" matches"
61 print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1"
63 print " "+green("--config")
64 print " Runs package-specific operations that must be executed after an"
65 print " emerge process has completed. This usually entails configuration"
66 print " file setup or other similar setups that the user may wish to run."
68 print " "+green("--depclean")
70 paragraph = "Cleans the system by removing packages that are " + \
71 "not associated with explicitly merged packages. Depclean works " + \
72 "by creating the full dependency tree from the system and " + \
73 "world sets, then comparing it to installed packages. Packages " + \
74 "installed, but not part of the dependency tree, will be " + \
75 "uninstalled by depclean. See --with-bdeps for behavior with " + \
76 "respect to build time dependencies that are not strictly " + \
77 "required. Packages that are part of the world set will " + \
78 "always be kept. They can be manually added to this set with " + \
79 "emerge --noreplace <atom>. As a safety measure, depclean " + \
80 "will not remove any packages unless *all* required dependencies " + \
81 "have been resolved. As a consequence, it is often necessary to " + \
82 "run emerge --update --newuse --deep world " + \
85 for line in wrap(paragraph, desc_width):
86 print desc_indent + line
89 paragraph = "WARNING: Inexperienced users are advised to use " + \
90 "--pretend with this option in order to see a preview of which " + \
91 "packages will be uninstalled. Always study the list of packages " + \
92 "to be cleaned for any obvious mistakes. Note that packages " + \
93 "listed in package.provided (see portage(5)) may be removed by " + \
94 "depclean, even if they are part of the world set. Also note that " + \
95 "depclean may break link level dependencies. Thus, it is " + \
96 "recommended to use a tool such as revdep-rebuild(1) " + \
97 "in order to detect such breakage."
99 for line in wrap(paragraph, desc_width):
100 print desc_indent + line
103 paragraph = "Depclean serves as a dependency aware version of " + \
104 "--unmerge. When given one or more atoms, it will unmerge " + \
105 "matched packages that have no reverse dependencies. Use " + \
106 "--depclean together with --verbose to show reverse dependencies."
108 for line in wrap(paragraph, desc_width):
109 print desc_indent + line
111 print " "+green("--info")
112 print " Displays important portage variables that will be exported to"
113 print " ebuild.sh when performing merges. This information is useful"
114 print " for bug reports and verification of settings. All settings in"
115 print " make.{conf,globals,defaults} and the environment show up if"
116 print " run with the '--verbose' flag."
118 print " "+green("--metadata")
119 print " Transfers metadata cache from ${PORTDIR}/metadata/cache/ to"
120 print " /var/cache/edb/dep/ as is normally done on the tail end of an"
121 print " rsync update using " + bold("emerge --sync") + ". This process populates the"
122 print " cache database that portage uses for pre-parsed lookups of"
123 print " package data. It does not populate cache for the overlays"
124 print " listed in PORTDIR_OVERLAY. In order to generate cache for"
125 print " overlays, use " + bold("--regen") + "."
127 print " "+green("--prune")+" ("+green("-P")+" short option)"
128 print " "+turquoise("WARNING: This action can remove important packages!")
129 paragraph = "Removes all but the highest installed version of a " + \
130 "package from your system. Use --prune together with " + \
131 "--verbose to show reverse dependencies or with --nodeps " + \
132 "to ignore all dependencies. "
134 for line in wrap(paragraph, desc_width):
135 print desc_indent + line
137 print " "+green("--regen")
138 print " Causes portage to check and update the dependency cache of all"
139 print " ebuilds in the portage tree. This is not recommended for rsync"
140 print " users as rsync updates the cache using server-side caches."
141 print " Rsync users should simply 'emerge --sync' to regenerate."
142 desc = "In order to specify parallel --regen behavior, use "+ \
143 "the ---jobs and --load-average options."
144 for line in wrap(desc, desc_width):
145 print desc_indent + line
147 print " "+green("--resume")
148 print " Resumes the most recent merge list that has been aborted due to an"
149 print " error. Please note that this operation will only return an error"
150 print " on failure. If there is nothing for portage to do, then portage"
151 print " will exit with a message and a success condition. A resume list"
152 print " will persist until it has been completed in entirety or until"
153 print " another aborted merge list replaces it. The resume history is"
154 print " capable of storing two merge lists. After one resume list"
155 print " completes, it is possible to invoke --resume once again in order"
156 print " to resume an older list."
158 print " "+green("--search")+" ("+green("-s")+" short option)"
159 print " Searches for matches of the supplied string in the current local"
160 print " portage tree. By default emerge uses a case-insensitive simple "
161 print " search, but you can enable a regular expression search by "
162 print " prefixing the search string with %."
163 print " Prepending the expression with a '@' will cause the category to"
164 print " be included in the search."
165 print " A few examples:"
166 print " "+bold("emerge --search libc")
167 print " list all packages that contain libc in their name"
168 print " "+bold("emerge --search '%^kde'")
169 print " list all packages starting with kde"
170 print " "+bold("emerge --search '%gcc$'")
171 print " list all packages ending with gcc"
172 print " "+bold("emerge --search '%@^dev-java.*jdk'")
173 print " list all available Java JDKs"
175 print " "+green("--searchdesc")+" ("+green("-S")+" short option)"
176 print " Matches the search string against the description field as well"
177 print " the package's name. Take caution as the descriptions are also"
178 print " matched as regular expressions."
179 print " emerge -S html"
180 print " emerge -S applet"
181 print " emerge -S 'perl.*module'"
183 print " "+green("--unmerge")+" ("+green("-C")+" short option)"
184 print " "+turquoise("WARNING: This action can remove important packages!")
185 print " Removes all matching packages. This does no checking of"
186 print " dependencies, so it may remove packages necessary for the proper"
187 print " operation of your system. Its arguments can be atoms or"
188 print " ebuilds. For a dependency aware version of --unmerge, use"
189 print " --depclean or --prune."
191 print " "+green("--update")+" ("+green("-u")+" short option)"
192 print " Updates packages to the best version available, which may not"
193 print " always be the highest version number due to masking for testing"
194 print " and development. This will also update direct dependencies which"
195 print " may not be what you want. Package atoms specified on the command"
196 print " line are greedy, meaning that unspecific atoms may match multiple"
197 print " installed versions of slotted packages."
199 print " "+green("--version")+" ("+green("-V")+" short option)"
200 print " Displays the currently installed version of portage along with"
201 print " other information useful for quick reference on a system. See"
202 print " "+bold("emerge info")+" for more advanced information."
204 print turquoise("Options:")
205 print " "+green("--alphabetical")
206 print " When displaying USE and other flag output, combines the enabled"
207 print " and disabled flags into a single list and sorts it alphabetically."
208 print " With this option, output such as USE=\"dar -bar -foo\" will instead"
209 print " be displayed as USE=\"-bar dar -foo\""
211 print " "+green("--ask")+" ("+green("-a")+" short option)"
212 print " before performing the merge, display what ebuilds and tbz2s will"
213 print " be installed, in the same format as when using --pretend; then"
214 print " ask whether to continue with the merge or abort. Using --ask is"
215 print " more efficient than using --pretend and then executing the same"
216 print " command without --pretend, as dependencies will only need to be"
217 print " calculated once. WARNING: If the \"Enter\" key is pressed at the"
218 print " prompt (with no other input), it is interpreted as acceptance of"
219 print " the first choice. Note that the input buffer is not cleared prior"
220 print " to the prompt, so an accidental press of the \"Enter\" key at any"
221 print " time prior to the prompt will be interpreted as a choice!"
223 print " "+green("--buildpkg")+" ("+green("-b")+" short option)"
224 desc = "Tells emerge to build binary packages for all ebuilds processed in" + \
225 " addition to actually merging the packages. Useful for maintainers" + \
226 " or if you administrate multiple Gentoo Linux systems (build once," + \
227 " emerge tbz2s everywhere) as well as disaster recovery. The package" + \
228 " will be created in the" + \
229 " ${PKGDIR}/All directory. An alternative for already-merged" + \
230 " packages is to use quickpkg(1) which creates a tbz2 from the" + \
232 for line in wrap(desc, desc_width):
233 print desc_indent + line
235 print " "+green("--buildpkgonly")+" ("+green("-B")+" short option)"
236 print " Creates a binary package, but does not merge it to the"
237 print " system. This has the restriction that unsatisfied dependencies"
238 print " must not exist for the desired package as they cannot be used if"
239 print " they do not exist on the system."
241 print " "+green("--changelog")+" ("+green("-l")+" short option)"
242 print " When pretending, also display the ChangeLog entries for packages"
243 print " that will be upgraded."
245 print " "+green("--color") + " < " + turquoise("y") + " | "+ turquoise("n")+" >"
246 print " Enable or disable color output. This option will override NOCOLOR"
247 print " (see make.conf(5)) and may also be used to force color output when"
248 print " stdout is not a tty (by default, color is disabled unless stdout"
251 print " "+green("--columns")
252 print " Display the pretend output in a tabular form. Versions are"
253 print " aligned vertically."
255 print " "+green("--complete-graph")
256 desc = "This causes emerge to consider the deep dependencies of all" + \
257 " packages from the system and world sets. With this option enabled," + \
258 " emerge will bail out if it determines that the given operation will" + \
259 " break any dependencies of the packages that have been added to the" + \
260 " graph. Like the --deep option, the --complete-graph" + \
261 " option will significantly increase the time taken for dependency" + \
262 " calculations. Note that, unlike the --deep option, the" + \
263 " --complete-graph option does not cause any more packages to" + \
264 " be updated than would have otherwise been updated with the option disabled."
265 for line in wrap(desc, desc_width):
266 print desc_indent + line
268 print " "+green("--debug")+" ("+green("-d")+" short option)"
269 print " Tell emerge to run the ebuild command in --debug mode. In this"
270 print " mode, the bash build environment will run with the -x option,"
271 print " causing it to output verbose debug information print to stdout."
272 print " --debug is great for finding bash syntax errors as providing"
273 print " very verbose information about the dependency and build process."
275 print " "+green("--deep")+" ("+green("-D")+" short option)"
276 print " This flag forces emerge to consider the entire dependency tree of"
277 print " packages, instead of checking only the immediate dependencies of"
278 print " the packages. As an example, this catches updates in libraries"
279 print " that are not directly listed in the dependencies of a package."
280 print " Also see --with-bdeps for behavior with respect to build time"
281 print " dependencies that are not strictly required."
283 print " "+green("--emptytree")+" ("+green("-e")+" short option)"
284 print " Virtually tweaks the tree of installed packages to contain"
285 print " nothing. This is great to use together with --pretend. This makes"
286 print " it possible for developers to get a complete overview of the"
287 print " complete dependency tree of a certain package."
289 print " "+green("--fetchonly")+" ("+green("-f")+" short option)"
290 print " Instead of doing any package building, just perform fetches for"
291 print " all packages (main package as well as all dependencies.) When"
292 print " used in combination with --pretend all the SRC_URIs will be"
293 print " displayed multiple mirrors per line, one line per file."
295 print " "+green("--fetch-all-uri")+" ("+green("-F")+" short option)"
296 print " Same as --fetchonly except that all package files, including those"
297 print " not required to build the package, will be processed."
299 print " "+green("--getbinpkg")+" ("+green("-g")+" short option)"
300 print " Using the server and location defined in PORTAGE_BINHOST, portage"
301 print " will download the information from each binary file there and it"
302 print " will use that information to help build the dependency list. This"
303 print " option implies '-k'. (Use -gK for binary-only merging.)"
305 print " "+green("--getbinpkgonly")+" ("+green("-G")+" short option)"
306 print " This option is identical to -g, as above, except it will not use"
307 print " ANY information from the local machine. All binaries will be"
308 print " downloaded from the remote server without consulting packages"
309 print " existing in the packages directory."
311 print " " + green("--jobs") + " " + turquoise("[JOBS]") + " ("+green("-j")+" short option)"
312 desc = "Specifies the number of packages " + \
313 "to build simultaneously. If this option is " + \
314 "given without an argument, emerge will not " + \
315 "limit the number of jobs that " + \
316 "can run simultaneously. Also see " + \
317 "the related --load-average option."
318 for line in wrap(desc, desc_width):
319 print desc_indent + line
321 print " "+green("--keep-going")
322 desc = "Continue as much as possible after " + \
323 "an error. When an error occurs, " + \
324 "dependencies are recalculated for " + \
325 "remaining packages and any with " + \
326 "unsatisfied dependencies are " + \
327 "automatically dropped. Also see " + \
328 "the related --skipfirst option."
329 for line in wrap(desc, desc_width):
330 print desc_indent + line
332 print " " + green("--load-average") + " " + turquoise("LOAD")
333 desc = "Specifies that no new builds should " + \
334 "be started if there are other builds " + \
335 "running and the load average is at " + \
336 "least LOAD (a floating-point number). " + \
337 "This option is recommended for use " + \
338 "in combination with --jobs in " + \
339 "order to avoid excess load. See " + \
340 "make(1) for information about " + \
341 "analogous options that should be " + \
342 "configured via MAKEOPTS in " + \
344 for line in wrap(desc, desc_width):
345 print desc_indent + line
347 print " "+green("--newuse")+" ("+green("-N")+" short option)"
348 print " Tells emerge to include installed packages where USE flags have "
349 print " changed since installation."
351 print " "+green("--noconfmem")
352 print " Portage keeps track of files that have been placed into"
353 print " CONFIG_PROTECT directories, and normally it will not merge the"
354 print " same file more than once, as that would become annoying. This"
355 print " can lead to problems when the user wants the file in the case"
356 print " of accidental deletion. With this option, files will always be"
357 print " merged to the live fs instead of silently dropped."
359 print " "+green("--nodeps")+" ("+green("-O")+" short option)"
360 print " Merge specified packages, but don't merge any dependencies."
361 print " Note that the build may fail if deps aren't satisfied."
363 print " "+green("--noreplace")+" ("+green("-n")+" short option)"
364 print " Skip the packages specified on the command-line that have"
365 print " already been installed. Without this option, any packages,"
366 print " ebuilds, or deps you specify on the command-line *will* cause"
367 print " Portage to remerge the package, even if it is already installed."
368 print " Note that Portage won't remerge dependencies by default."
370 print " "+green("--nospinner")
371 print " Disables the spinner regardless of terminal type."
373 print " "+green("--oneshot")+" ("+green("-1")+" short option)"
374 print " Emerge as normal, but don't add packages to the world profile."
375 print " This package will only be updated if it is depended upon by"
376 print " another package."
378 print " "+green("--onlydeps")+" ("+green("-o")+" short option)"
379 print " Only merge (or pretend to merge) the dependencies of the"
380 print " specified packages, not the packages themselves."
382 print " "+green("--pretend")+" ("+green("-p")+" short option)"
383 print " Instead of actually performing the merge, simply display what"
384 print " ebuilds and tbz2s *would* have been installed if --pretend"
385 print " weren't used. Using --pretend is strongly recommended before"
386 print " installing an unfamiliar package. In the printout, N = new,"
387 print " U = updating, R = replacing, F = fetch restricted, B = blocked"
388 print " by an already installed package, D = possible downgrading,"
389 print " S = slotted install. --verbose causes affecting use flags to be"
390 print " printed out accompanied by a '+' for enabled and a '-' for"
391 print " disabled USE flags."
393 print " "+green("--quiet")+" ("+green("-q")+" short option)"
394 print " Effects vary, but the general outcome is a reduced or condensed"
395 print " output from portage's displays."
397 print " "+green("--reinstall ") + turquoise("changed-use")
398 print " Tells emerge to include installed packages where USE flags have"
399 print " changed since installation. Unlike --newuse, this option does"
400 print " not trigger reinstallation when flags that the user has not"
401 print " enabled are added or removed."
403 print " "+green("--skipfirst")
404 desc = "This option is only valid when " + \
405 "used with --resume. It removes the " + \
406 "first package in the resume list. " + \
407 "Dependencies are recalculated for " + \
408 "remaining packages and any that " + \
409 "have unsatisfied dependencies or are " + \
410 "masked will be automatically dropped. " + \
411 "Also see the related " + \
412 "--keep-going option."
413 for line in wrap(desc, desc_width):
414 print desc_indent + line
416 print " "+green("--tree")+" ("+green("-t")+" short option)"
417 print " Shows the dependency tree using indentation for dependencies."
418 print " The packages are also listed in reverse merge order so that"
419 print " a package's dependencies follow the package. Only really useful"
420 print " in combination with --emptytree, --update or --deep."
422 print " "+green("--usepkg")+" ("+green("-k")+" short option)"
423 print " Tell emerge to use binary packages (from $PKGDIR) if they are"
424 print " available, thus possibly avoiding some time-consuming compiles."
425 print " This option is useful for CD installs; you can export"
426 print " PKGDIR=/mnt/cdrom/packages and then use this option to have"
427 print " emerge \"pull\" binary packages from the CD in order to satisfy"
428 print " dependencies."
430 print " "+green("--usepkgonly")+" ("+green("-K")+" short option)"
431 print " Like --usepkg above, except this only allows the use of binary"
432 print " packages, and it will abort the emerge if the package is not"
433 print " available at the time of dependency calculation."
435 print " "+green("--verbose")+" ("+green("-v")+" short option)"
436 print " Effects vary, but the general outcome is an increased or expanded"
437 print " display of content in portage's displays."
439 print " "+green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >"
440 print " In dependency calculations, pull in build time dependencies that"
441 print " are not strictly required. This defaults to 'n' for installation"
442 print " actions and 'y' for the --depclean action. This setting can be"
443 print " added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later"
444 print " overridden via the command line."
446 elif myaction == "sync":
448 print bold("Usage: ")+turquoise("emerge")+" "+turquoise("--sync")
450 print " 'emerge --sync' tells emerge to update the Portage tree as specified in"
451 print " The SYNC variable found in /etc/make.conf. By default, SYNC instructs"
452 print " emerge to perform an rsync-style update with rsync.gentoo.org."
454 print " 'emerge-webrsync' exists as a helper app to emerge --sync, providing a"
455 print " method to receive the entire portage tree as a tarball that can be"
456 print " extracted and used. First time syncs would benefit greatly from this."
458 print " "+turquoise("WARNING:")
459 print " If using our rsync server, emerge will clean out all files that do not"
460 print " exist on it, including ones that you may have created. The exceptions"
461 print " to this are the distfiles, local and packages directories."