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