From d9c13cdfc3ba5ec9e3b253a8d9b4ecfa3d126196 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 2 Aug 2009 14:32:04 +0000 Subject: [PATCH] Merged from trunk -r13865:13874 |13870 |In the _check_build_log(), exclude output from dev-libs/yaz-3.0.47 | |zmedico|which looks like this: Configuration: Automake: ${SHELL} | | |/var/tmp/portage/dev-libs/yaz-3.0.47/work/yaz-3.0.47/config/missing | | |--run automake-1.10 Thanks to Robin H. Johnson for| | |reporting. | |13872 |Add support for --complete-graph=n so that it's possible to disable it | |zmedico|on the command line after it's been enabled in EMERGE_DEFAULT_OPTS. | |13873 |Add support for --usepkg=n so that it's possible to disable it on the | |zmedico|command line after it's been enabled in EMERGE_DEFAULT_OPTS. Also do | | |the same for --usepkgonly, --getbinpkg, and --getbinpkgonly. | |13874 |Only treat non-negative integers as valid in insert_optional_args(). | |zmedico| | svn path=/main/branches/prefix/; revision=13876 --- man/emerge.1 | 10 ++--- pym/_emerge/help.py | 10 ++--- pym/_emerge/main.py | 90 +++++++++++++++++++++++++++++++++++++---- pym/portage/__init__.py | 7 +++- 4 files changed, 98 insertions(+), 19 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index 4e25085bf..3104cc18b 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -281,7 +281,7 @@ is not a tty (by default, color is disabled unless stdout is a tty). Used alongside \fB\-\-pretend\fR to cause the package name, new version, and old version to be displayed in an aligned format for easy cut\-n\-paste. .TP -.BR "\-\-complete\-graph" +.BR "\-\-complete\-graph[=n]" This causes \fBemerge\fR to consider the deep dependencies of all packages from the system and world sets. With this option enabled, \fBemerge\fR will bail out if it determines that the given operation will @@ -324,14 +324,14 @@ packages (fetch things from SRC_URI based upon USE setting). Instead of doing any package building, just perform fetches for all packages (fetch everything in SRC_URI regardless of USE setting). .TP -.BR "\-\-getbinpkg " (\fB\-g\fR) +.BR "\-\-getbinpkg[=n] " (\fB\-g\fR) Using the server and location defined in \fIPORTAGE_BINHOST\fR (see \fBmake.conf\fR(5)), portage will download the information from each binary package found and it will use that information to help build the dependency list. This option implies \fB\-k\fR. (Use \fB\-gK\fR for binary\-only merging.) .TP -.BR "\-\-getbinpkgonly " (\fB\-G\fR) +.BR "\-\-getbinpkgonly[=n] " (\fB\-G\fR) This option is identical to \fB\-g\fR, as above, except binaries from the remote server are preferred over local packages if they are not identical. .TP @@ -462,13 +462,13 @@ Shows the dependency tree for the given target by indenting dependencies. This is only really useful in combination with \fB\-\-emptytree\fR or \fB\-\-update\fR and \fB\-\-deep\fR. .TP -.BR "\-\-usepkg " (\fB\-k\fR) +.BR "\-\-usepkg[=n] " (\fB\-k\fR) Tells emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time\-consuming compiles. This option is useful for CD installs; you can export PKGDIR=/mnt/cdrom/packages and then use this option to have emerge "pull" binary packages from the CD in order to satisfy dependencies. .TP -.BR "\-\-usepkgonly " (\fB\-K\fR) +.BR "\-\-usepkgonly[=n] " (\fB\-K\fR) Tells emerge to only use binary packages (from $PKGDIR). All the binary packages must be available at the time of dependency calculation or emerge will simply abort. Portage does not use $PORTDIR when calculating dependency diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 393886698..448ef1adf 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -287,7 +287,7 @@ def help(myopts, havecolor=1): print " Display the pretend output in a tabular form. Versions are" print " aligned vertically." print - print " "+green("--complete-graph") + print " "+green("--complete-graph") + "[=%s]" % turquoise("n") desc = "This causes emerge to consider the deep dependencies of all" + \ " packages from the system and world sets. With this option enabled," + \ " emerge will bail out if it determines that the given operation will" + \ @@ -338,13 +338,13 @@ def help(myopts, havecolor=1): print " Same as --fetchonly except that all package files, including those" print " not required to build the package, will be processed." print - print " "+green("--getbinpkg")+" ("+green("-g")+" short option)" + print " "+green("--getbinpkg")+ "[=%s]" % turquoise("n") + " ("+green("-g")+" short option)" print " Using the server and location defined in PORTAGE_BINHOST, portage" print " will download the information from each binary file there and it" print " will use that information to help build the dependency list. This" print " option implies '-k'. (Use -gK for binary-only merging.)" print - print " "+green("--getbinpkgonly")+" ("+green("-G")+" short option)" + print " "+green("--getbinpkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-G")+" short option)" print " This option is identical to -g, as above, except it will not use" print " ANY information from the local machine. All binaries will be" print " downloaded from the remote server without consulting packages" @@ -492,7 +492,7 @@ def help(myopts, havecolor=1): print " a package's dependencies follow the package. Only really useful" print " in combination with --emptytree, --update or --deep." print - print " "+green("--usepkg")+" ("+green("-k")+" short option)" + print " "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)" print " Tell emerge to use binary packages (from $PKGDIR) if they are" print " available, thus possibly avoiding some time-consuming compiles." print " This option is useful for CD installs; you can export" @@ -500,7 +500,7 @@ def help(myopts, havecolor=1): print " emerge \"pull\" binary packages from the CD in order to satisfy" print " dependencies." print - print " "+green("--usepkgonly")+" ("+green("-K")+" short option)" + print " "+green("--usepkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-K")+" short option)" print " Like --usepkg above, except this only allows the use of binary" print " packages, and it will abort the emerge if the package is not" print " available at the time of dependency calculation." diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 8e0702c7d..c6c8d8583 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -61,12 +61,10 @@ options=[ "--ask", "--alphabetical", "--buildpkg", "--buildpkgonly", "--changelog", "--columns", -"--complete-graph", "--debug", "--digest", "--emptytree", "--fetchonly", "--fetch-all-uri", -"--getbinpkg", "--getbinpkgonly", "--ignore-default-opts", "--keep-going", "--noconfmem", @@ -79,7 +77,6 @@ options=[ "--skipfirst", "--tree", "--update", -"--usepkg", "--usepkgonly", "--verbose", ] @@ -91,9 +88,7 @@ shortmapping={ "d":"--debug", "e":"--emptytree", "f":"--fetchonly", "F":"--fetch-all-uri", -"g":"--getbinpkg", "G":"--getbinpkgonly", "h":"--help", -"k":"--usepkg", "K":"--usepkgonly", "l":"--changelog", "n":"--noreplace", "N":"--newuse", "o":"--onlydeps", "O":"--nodeps", @@ -386,21 +381,25 @@ def insert_optional_args(args): class valid_integers(object): def __contains__(self, s): try: - int(s) + return int(s) >= 0 except (ValueError, OverflowError): return False - return True valid_integers = valid_integers() new_args = [] default_arg_opts = { + '--complete-graph' : ('n',), '--deep' : valid_integers, '--deselect' : ('n',), '--binpkg-respect-use' : ('n', 'y',), + '--getbinpkg' : ('n',), + '--getbinpkgonly' : ('n',), '--jobs' : valid_integers, '--root-deps' : ('rdeps',), + '--usepkg' : ('n',), + '--usepkgonly' : ('n',), } short_arg_opts = { @@ -408,6 +407,15 @@ def insert_optional_args(args): 'j' : valid_integers, } + # Don't make things like "-kn" expand to "-k n" + # since existence of -n makes it too ambiguous. + short_arg_opts_n = { + 'g' : ('n',), + 'G' : ('n',), + 'k' : ('n',), + 'K' : ('n',), + } + arg_stack = args[:] arg_stack.reverse() while arg_stack: @@ -433,6 +441,12 @@ def insert_optional_args(args): match = k break + if match is None: + for k, arg_choices in short_arg_opts_n.iteritems(): + if k in arg: + match = k + break + if match is None: new_args.append(arg) continue @@ -454,7 +468,7 @@ def insert_optional_args(args): saved_opts = None if arg[1:2] == match: - if arg[2:] in arg_choices: + if match not in short_arg_opts_n and arg[2:] in arg_choices: opt_arg = arg[2:] else: saved_opts = arg[2:] @@ -503,6 +517,12 @@ def parse_opts(tmpcmdline, silent=False): "choices":("y", "n") }, + "--complete-graph": { + "help" : "completely account for all known dependencies", + "type" : "choice", + "choices" : ("True", "n") + }, + "--deep": { "shortopt" : "-D", @@ -558,6 +578,20 @@ def parse_opts(tmpcmdline, silent=False): "choices" : ("True", "y", "n") }, + "--getbinpkg": { + "shortopt" : "-g", + "help" : "fetch binary packages", + "type" : "choice", + "choices" : ("True", "n") + }, + + "--getbinpkgonly": { + "shortopt" : "-G", + "help" : "fetch binary packages only", + "type" : "choice", + "choices" : ("True", "n") + }, + "--root": { "help" : "specify the target root filesystem for merging packages", "action" : "store" @@ -568,6 +602,21 @@ def parse_opts(tmpcmdline, silent=False): "type" : "choice", "choices" :("True", "rdeps") }, + + "--usepkg": { + "shortopt" : "-k", + "help" : "use binary packages", + "type" : "choice", + "choices" : ("True", "n") + }, + + "--usepkgonly": { + "shortopt" : "-K", + "help" : "use only binary packages", + "type" : "choice", + "choices" : ("True", "n") + }, + } from optparse import OptionParser @@ -608,6 +657,21 @@ def parse_opts(tmpcmdline, silent=False): else: myoptions.binpkg_respect_use = None + if myoptions.complete_graph in ("y", "True",): + myoptions.complete_graph = True + else: + myoptions.complete_graph = None + + if myoptions.getbinpkg in ("True",): + myoptions.getbinpkg = True + else: + myoptions.getbinpkg = None + + if myoptions.getbinpkgonly in ("True",): + myoptions.getbinpkgonly = True + else: + myoptions.getbinpkgonly = None + if myoptions.root_deps == "True": myoptions.root_deps = True @@ -662,6 +726,16 @@ def parse_opts(tmpcmdline, silent=False): myoptions.load_average = load_average + if myoptions.usepkg in ("True",): + myoptions.usepkg = True + else: + myoptions.usepkg = None + + if myoptions.usepkgonly in ("True",): + myoptions.usepkgonly = True + else: + myoptions.usepkgonly = None + for myopt in options: v = getattr(myoptions, myopt.lstrip("--").replace("-", "_")) if v: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 57b491d71..61ffd65fd 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5050,9 +5050,14 @@ def _check_build_log(mysettings, out=None): configure_opts_warn = [] configure_opts_warn_re = re.compile( r'^configure: WARNING: [Uu]nrecognized options: ') + + # Exclude output from dev-libs/yaz-3.0.47 which looks like this: + # + #Configuration: + # Automake: ${SHELL} /var/tmp/portage/dev-libs/yaz-3.0.47/work/yaz-3.0.47/config/missing --run automake-1.10 am_maintainer_mode_re = re.compile(r'/missing --run ') am_maintainer_mode_exclude_re = \ - re.compile(r'/missing --run (autoheader|makeinfo)') + re.compile(r'(/missing --run (autoheader|makeinfo)|^\s*Automake:\s)') make_jobserver_re = \ re.compile(r'g?make\[\d+\]: warning: jobserver unavailable:') -- 2.26.2