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("--clean")+" | "+green("--depclean")+" | "+green("--prune")+" | "+green("--regen")+" | "+green("--search")+" | "+green("--unmerge")+" ]"
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 --oneshot @system @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."
96 for line in wrap(paragraph, desc_width):
97 print desc_indent + line
100 paragraph = "Depclean serves as a dependency aware version of " + \
101 "--unmerge. When given one or more atoms, it will unmerge " + \
102 "matched packages that have no reverse dependencies. Use " + \
103 "--depclean together with --verbose to show reverse dependencies."
105 for line in wrap(paragraph, desc_width):
106 print desc_indent + line
108 print " "+green("--info")
109 print " Displays important portage variables that will be exported to"
110 print " ebuild.sh when performing merges. This information is useful"
111 print " for bug reports and verification of settings. All settings in"
112 print " make.{conf,globals,defaults} and the environment show up if"
113 print " run with the '--verbose' flag."
115 print " "+green("--metadata")
116 print " Transfers metadata cache from ${PORTDIR}/metadata/cache/ to"
117 print " /var/cache/edb/dep/ as is normally done on the tail end of an"
118 print " rsync update using " + bold("emerge --sync") + ". This process populates the"
119 print " cache database that portage uses for pre-parsed lookups of"
120 print " package data. It does not populate cache for the overlays"
121 print " listed in PORTDIR_OVERLAY. In order to generate cache for"
122 print " overlays, use " + bold("--regen") + "."
124 print " "+green("--prune")+" ("+green("-P")+" short option)"
125 print " "+turquoise("WARNING: This action can remove important packages!")
126 paragraph = "Removes all but the highest installed version of a " + \
127 "package from your system. Use --prune together with " + \
128 "--verbose to show reverse dependencies or with --nodeps " + \
129 "to ignore all dependencies. "
131 for line in wrap(paragraph, desc_width):
132 print desc_indent + line
134 print " "+green("--regen")
135 print " Causes portage to check and update the dependency cache of all"
136 print " ebuilds in the portage tree. This is not recommended for rsync"
137 print " users as rsync updates the cache using server-side caches."
138 print " Rsync users should simply 'emerge --sync' to regenerate."
139 desc = "In order to specify parallel --regen behavior, use "+ \
140 "the ---jobs and --load-average options."
141 for line in wrap(desc, desc_width):
142 print desc_indent + line
144 print " "+green("--resume")
145 print " Resumes the most recent merge list that has been aborted due to an"
146 print " error. Please note that this operation will only return an error"
147 print " on failure. If there is nothing for portage to do, then portage"
148 print " will exit with a message and a success condition. A resume list"
149 print " will persist until it has been completed in entirety or until"
150 print " another aborted merge list replaces it. The resume history is"
151 print " capable of storing two merge lists. After one resume list"
152 print " completes, it is possible to invoke --resume once again in order"
153 print " to resume an older list."
155 print " "+green("--search")+" ("+green("-s")+" short option)"
156 print " Searches for matches of the supplied string in the current local"
157 print " portage tree. By default emerge uses a case-insensitive simple "
158 print " search, but you can enable a regular expression search by "
159 print " prefixing the search string with %."
160 print " Prepending the expression with a '@' will cause the category to"
161 print " be included in the search."
162 print " A few examples:"
163 print " "+bold("emerge --search libc")
164 print " list all packages that contain libc in their name"
165 print " "+bold("emerge --search '%^kde'")
166 print " list all packages starting with kde"
167 print " "+bold("emerge --search '%gcc$'")
168 print " list all packages ending with gcc"
169 print " "+bold("emerge --search '%@^dev-java.*jdk'")
170 print " list all available Java JDKs"
172 print " "+green("--searchdesc")+" ("+green("-S")+" short option)"
173 print " Matches the search string against the description field as well"
174 print " the package's name. Take caution as the descriptions are also"
175 print " matched as regular expressions."
176 print " emerge -S html"
177 print " emerge -S applet"
178 print " emerge -S 'perl.*module'"
180 print " "+green("--unmerge")+" ("+green("-C")+" short option)"
181 print " "+turquoise("WARNING: This action can remove important packages!")
182 print " Removes all matching packages. This does no checking of"
183 print " dependencies, so it may remove packages necessary for the proper"
184 print " operation of your system. Its arguments can be atoms or"
185 print " ebuilds. For a dependency aware version of --unmerge, use"
186 print " --depclean or --prune."
188 print " "+green("--update")+" ("+green("-u")+" short option)"
189 print " Updates packages to the best version available, which may not"
190 print " always be the highest version number due to masking for testing"
191 print " and development. This will also update direct dependencies which"
192 print " may not be what you want. Package atoms specified on the command"
193 print " line are greedy, meaning that unspecific atoms may match multiple"
194 print " installed versions of slotted packages."
196 print " "+green("--version")+" ("+green("-V")+" short option)"
197 print " Displays the currently installed version of portage along with"
198 print " other information useful for quick reference on a system. See"
199 print " "+bold("emerge info")+" for more advanced information."
201 print turquoise("Options:")
202 print " "+green("--alphabetical")
203 print " When displaying USE and other flag output, combines the enabled"
204 print " and disabled flags into a single list and sorts it alphabetically."
205 print " With this option, output such as USE=\"dar -bar -foo\" will instead"
206 print " be displayed as USE=\"-bar dar -foo\""
208 print " "+green("--ask")+" ("+green("-a")+" short option)"
209 print " before performing the merge, display what ebuilds and tbz2s will"
210 print " be installed, in the same format as when using --pretend; then"
211 print " ask whether to continue with the merge or abort. Using --ask is"
212 print " more efficient than using --pretend and then executing the same"
213 print " command without --pretend, as dependencies will only need to be"
214 print " calculated once. WARNING: If the \"Enter\" key is pressed at the"
215 print " prompt (with no other input), it is interpreted as acceptance of"
216 print " the first choice. Note that the input buffer is not cleared prior"
217 print " to the prompt, so an accidental press of the \"Enter\" key at any"
218 print " time prior to the prompt will be interpreted as a choice!"
220 print " "+green("--buildpkg")+" ("+green("-b")+" short option)"
221 desc = "Tells emerge to build binary packages for all ebuilds processed in" + \
222 " addition to actually merging the packages. Useful for maintainers" + \
223 " or if you administrate multiple Gentoo Linux systems (build once," + \
224 " emerge tbz2s everywhere) as well as disaster recovery. The package" + \
225 " will be created in the" + \
226 " ${PKGDIR}/All directory. An alternative for already-merged" + \
227 " packages is to use quickpkg(1) which creates a tbz2 from the" + \
229 for line in wrap(desc, desc_width):
230 print desc_indent + line
232 print " "+green("--buildpkgonly")+" ("+green("-B")+" short option)"
233 print " Creates a binary package, but does not merge it to the"
234 print " system. This has the restriction that unsatisfied dependencies"
235 print " must not exist for the desired package as they cannot be used if"
236 print " they do not exist on the system."
238 print " "+green("--changelog")+" ("+green("-l")+" short option)"
239 print " When pretending, also display the ChangeLog entries for packages"
240 print " that will be upgraded."
242 print " "+green("--color") + " < " + turquoise("y") + " | "+ turquoise("n")+" >"
243 print " Enable or disable color output. This option will override NOCOLOR"
244 print " (see make.conf(5)) and may also be used to force color output when"
245 print " stdout is not a tty (by default, color is disabled unless stdout"
248 print " "+green("--columns")
249 print " Display the pretend output in a tabular form. Versions are"
250 print " aligned vertically."
252 print " "+green("--complete-graph")
253 desc = "This causes emerge to consider the deep dependencies of all" + \
254 " packages from the system and world sets. With this option enabled," + \
255 " emerge will bail out if it determines that the given operation will" + \
256 " break any dependencies of the packages that have been added to the" + \
257 " graph. Like the --deep option, the --complete-graph" + \
258 " option will significantly increase the time taken for dependency" + \
259 " calculations. Note that, unlike the --deep option, the" + \
260 " --complete-graph option does not cause any more packages to" + \
261 " be updated than would have otherwise been updated with the option disabled."
262 for line in wrap(desc, desc_width):
263 print desc_indent + line
265 print " "+green("--debug")+" ("+green("-d")+" short option)"
266 print " Tell emerge to run the ebuild command in --debug mode. In this"
267 print " mode, the bash build environment will run with the -x option,"
268 print " causing it to output verbose debug information print to stdout."
269 print " --debug is great for finding bash syntax errors as providing"
270 print " very verbose information about the dependency and build process."
272 print " "+green("--deep")+" ("+green("-D")+" short option)"
273 print " This flag forces emerge to consider the entire dependency tree of"
274 print " packages, instead of checking only the immediate dependencies of"
275 print " the packages. As an example, this catches updates in libraries"
276 print " that are not directly listed in the dependencies of a package."
277 print " Also see --with-bdeps for behavior with respect to build time"
278 print " dependencies that are not strictly required."
280 print " "+green("--emptytree")+" ("+green("-e")+" short option)"
281 print " Virtually tweaks the tree of installed packages to contain"
282 print " nothing. This is great to use together with --pretend. This makes"
283 print " it possible for developers to get a complete overview of the"
284 print " complete dependency tree of a certain package."
286 print " "+green("--fetchonly")+" ("+green("-f")+" short option)"
287 print " Instead of doing any package building, just perform fetches for"
288 print " all packages (main package as well as all dependencies.) When"
289 print " used in combination with --pretend all the SRC_URIs will be"
290 print " displayed multiple mirrors per line, one line per file."
292 print " "+green("--fetch-all-uri")+" ("+green("-F")+" short option)"
293 print " Same as --fetchonly except that all package files, including those"
294 print " not required to build the package, will be processed."
296 print " "+green("--getbinpkg")+" ("+green("-g")+" short option)"
297 print " Using the server and location defined in PORTAGE_BINHOST, portage"
298 print " will download the information from each binary file there and it"
299 print " will use that information to help build the dependency list. This"
300 print " option implies '-k'. (Use -gK for binary-only merging.)"
302 print " "+green("--getbinpkgonly")+" ("+green("-G")+" short option)"
303 print " This option is identical to -g, as above, except it will not use"
304 print " ANY information from the local machine. All binaries will be"
305 print " downloaded from the remote server without consulting packages"
306 print " existing in the packages directory."
308 print " " + green("--jobs") + " " + turquoise("[JOBS]") + " ("+green("-j")+" short option)"
309 desc = "Specifies the number of packages " + \
310 "to build simultaneously. If this option is " + \
311 "given without an argument, emerge will not " + \
312 "limit the number of jobs that " + \
313 "can run simultaneously. Also see " + \
314 "the related --load-average option."
315 for line in wrap(desc, desc_width):
316 print desc_indent + line
318 print " "+green("--keep-going")
319 desc = "Continue as much as possible after " + \
320 "an error. When an error occurs, " + \
321 "dependencies are recalculated for " + \
322 "remaining packages and any with " + \
323 "unsatisfied dependencies are " + \
324 "automatically dropped. Also see " + \
325 "the related --skipfirst option."
326 for line in wrap(desc, desc_width):
327 print desc_indent + line
329 print " " + green("--load-average") + " " + turquoise("LOAD")
330 desc = "Specifies that no new builds should " + \
331 "be started if there are other builds " + \
332 "running and the load average is at " + \
333 "least LOAD (a floating-point number). " + \
334 "This option is recommended for use " + \
335 "in combination with --jobs in " + \
336 "order to avoid excess load. See " + \
337 "make(1) for information about " + \
338 "analogous options that should be " + \
339 "configured via MAKEOPTS in " + \
341 for line in wrap(desc, desc_width):
342 print desc_indent + line
344 print " "+green("--newuse")+" ("+green("-N")+" short option)"
345 print " Tells emerge to include installed packages where USE flags have "
346 print " changed since installation."
348 print " "+green("--noconfmem")
349 print " Portage keeps track of files that have been placed into"
350 print " CONFIG_PROTECT directories, and normally it will not merge the"
351 print " same file more than once, as that would become annoying. This"
352 print " can lead to problems when the user wants the file in the case"
353 print " of accidental deletion. With this option, files will always be"
354 print " merged to the live fs instead of silently dropped."
356 print " "+green("--nodeps")+" ("+green("-O")+" short option)"
357 print " Merge specified packages, but don't merge any dependencies."
358 print " Note that the build may fail if deps aren't satisfied."
360 print " "+green("--noreplace")+" ("+green("-n")+" short option)"
361 print " Skip the packages specified on the command-line that have"
362 print " already been installed. Without this option, any packages,"
363 print " ebuilds, or deps you specify on the command-line *will* cause"
364 print " Portage to remerge the package, even if it is already installed."
365 print " Note that Portage won't remerge dependencies by default."
367 print " "+green("--nospinner")
368 print " Disables the spinner regardless of terminal type."
370 print " "+green("--oneshot")+" ("+green("-1")+" short option)"
371 print " Emerge as normal, but don't add packages to the world profile."
372 print " This package will only be updated if it is depended upon by"
373 print " another package."
375 print " "+green("--onlydeps")+" ("+green("-o")+" short option)"
376 print " Only merge (or pretend to merge) the dependencies of the"
377 print " specified packages, not the packages themselves."
379 print " "+green("--pretend")+" ("+green("-p")+" short option)"
380 print " Instead of actually performing the merge, simply display what"
381 print " ebuilds and tbz2s *would* have been installed if --pretend"
382 print " weren't used. Using --pretend is strongly recommended before"
383 print " installing an unfamiliar package. In the printout, N = new,"
384 print " U = updating, R = replacing, F = fetch restricted, B = blocked"
385 print " by an already installed package, D = possible downgrading,"
386 print " S = slotted install. --verbose causes affecting use flags to be"
387 print " printed out accompanied by a '+' for enabled and a '-' for"
388 print " disabled USE flags."
390 print " "+green("--quiet")+" ("+green("-q")+" short option)"
391 print " Effects vary, but the general outcome is a reduced or condensed"
392 print " output from portage's displays."
394 print " "+green("--reinstall ") + turquoise("changed-use")
395 print " Tells emerge to include installed packages where USE flags have"
396 print " changed since installation. Unlike --newuse, this option does"
397 print " not trigger reinstallation when flags that the user has not"
398 print " enabled are added or removed."
400 print " "+green("--skipfirst")
401 desc = "This option is only valid when " + \
402 "used with --resume. It removes the " + \
403 "first package in the resume list. " + \
404 "Dependencies are recalculated for " + \
405 "remaining packages and any that " + \
406 "have unsatisfied dependencies or are " + \
407 "masked will be automatically dropped. " + \
408 "Also see the related " + \
409 "--keep-going option."
410 for line in wrap(desc, desc_width):
411 print desc_indent + line
413 print " "+green("--tree")+" ("+green("-t")+" short option)"
414 print " Shows the dependency tree using indentation for dependencies."
415 print " The packages are also listed in reverse merge order so that"
416 print " a package's dependencies follow the package. Only really useful"
417 print " in combination with --emptytree, --update or --deep."
419 print " "+green("--usepkg")+" ("+green("-k")+" short option)"
420 print " Tell emerge to use binary packages (from $PKGDIR) if they are"
421 print " available, thus possibly avoiding some time-consuming compiles."
422 print " This option is useful for CD installs; you can export"
423 print " PKGDIR=/mnt/cdrom/packages and then use this option to have"
424 print " emerge \"pull\" binary packages from the CD in order to satisfy"
425 print " dependencies."
427 print " "+green("--usepkgonly")+" ("+green("-K")+" short option)"
428 print " Like --usepkg above, except this only allows the use of binary"
429 print " packages, and it will abort the emerge if the package is not"
430 print " available at the time of dependency calculation."
432 print " "+green("--verbose")+" ("+green("-v")+" short option)"
433 print " Effects vary, but the general outcome is an increased or expanded"
434 print " display of content in portage's displays."
436 print " "+green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >"
437 print " In dependency calculations, pull in build time dependencies that"
438 print " are not strictly required. This defaults to 'n' for installation"
439 print " actions and 'y' for the --depclean action. This setting can be"
440 print " added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later"
441 print " overridden via the command line."
443 elif myaction == "sync":
445 print bold("Usage: ")+turquoise("emerge")+" "+turquoise("--sync")
447 print " 'emerge --sync' tells emerge to update the Portage tree as specified in"
448 print " The SYNC variable found in /etc/make.conf. By default, SYNC instructs"
449 print " emerge to perform an rsync-style update with rsync.gentoo.org."
451 print " 'emerge-webrsync' exists as a helper app to emerge --sync, providing a"
452 print " method to receive the entire portage tree as a tarball that can be"
453 print " extracted and used. First time syncs would benefit greatly from this."
455 print " "+turquoise("WARNING:")
456 print " If using our rsync server, emerge will clean out all files that do not"
457 print " exist on it, including ones that you may have created. The exceptions"
458 print " to this are the distfiles, local and packages directories."
460 elif myaction=="system":
462 print bold("Usage: ")+turquoise("emerge")+" [ "+green("options")+" ] "+turquoise("system")
464 print " \"emerge system\" is the Portage system update command. When run, it"
465 print " will scan the etc/make.profile/packages file and determine what"
466 print " packages need to be installed so that your system meets the minimum"
467 print " requirements of your current system profile. Note that this doesn't"
468 print " necessarily bring your system up-to-date at all; instead, it just"
469 print " ensures that you have no missing parts. For example, if your system"
470 print " profile specifies that you should have sys-apps/iptables installed"
471 print " and you don't, then \"emerge system\" will install it (the most"
472 print " recent version that matches the profile spec) for you. It's always a"
473 print " good idea to do an \"emerge --pretend system\" before an \"emerge"
474 print " system\", just so you know what emerge is planning to do."
476 elif myaction=="world":
478 print bold("Usage: ")+turquoise("emerge")+" [ "+green("options")+" ] "+turquoise("world")
480 print " 'emerge world' is the Portage command for completely updating your"
481 print " system. The normal procedure is to first do an 'emerge --sync' and"
482 print " then an 'emerge --update --deep world'. The first command brings your"
483 print " local Portage tree up-to-date with the latest version information and"
484 print " ebuilds. The second command then rebuilds all packages for which newer"
485 print " versions or newer ebuilds have become available since you last did a"
486 print " sync and update."