From 0e622a638fe059aafde079eb552ab8e433510d41 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 28 Jul 2010 08:14:34 -0700 Subject: [PATCH] Add a --package-moves[=n] option that can be used to control the "Performing Global Updates" routine. This option is enabled by default. --- man/emerge.1 | 4 ++++ pym/_emerge/actions.py | 3 ++- pym/_emerge/help.py | 6 ++++++ pym/_emerge/main.py | 23 +++++++++++++++++------ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index fbf668d71..15d7fcac5 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -468,6 +468,10 @@ for later updating. Only merge (or pretend to merge) the dependencies of the packages specified, not the packages themselves. .TP +.BR "\-\-package\-moves[=n]" +Perform package moves when necessary. This option +is enabled by default. +.TP .BR "\-\-pretend " (\fB\-p\fR) Instead of actually performing the merge, simply display what *would* have been installed if \fB\-\-pretend\fR weren't used. Using \fB\-\-pretend\fR diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index e014b16d4..16c329bbe 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2289,7 +2289,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): # the only one that's been synced here. action_metadata(settings, portdb, myopts, porttrees=[myportdir]) - if _global_updates(trees, mtimedb["updates"]): + if myopts.get('--package-moves') != 'n' and \ + _global_updates(trees, mtimedb["updates"]): mtimedb.commit() # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(trees=trees) diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index fe616ca95..9834c5c54 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -515,6 +515,12 @@ def help(myopts, havecolor=1): print(" Only merge (or pretend to merge) the dependencies of the") print(" specified packages, not the packages themselves.") print() + print(" " + green("--package-moves") + "[=%s]" % turquoise("n")) + desc = "Perform package moves when necessary. This option " + \ + "is enabled by default." + for line in wrap(desc, desc_width): + print(desc_indent + line) + print() print(" "+green("--pretend")+" ("+green("-p")+" short option)") print(" Instead of actually performing the merge, simply display what") print(" ebuilds and tbz2s *would* have been installed if --pretend") diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index e4449e805..5f0a7663a 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -398,6 +398,7 @@ def insert_optional_args(args): '--getbinpkgonly' : ('n',), '--jobs' : valid_integers, '--keep-going' : ('n',), + '--package-moves' : ('n',), '--rebuilt-binaries' : ('n',), '--root-deps' : ('rdeps',), '--select' : ('n',), @@ -638,6 +639,12 @@ def parse_opts(tmpcmdline, silent=False): "choices" : ("True", "n") }, + "--package-moves": { + "help" : "perform package moves when necessary", + "type" : "choice", + "choices" : ("True", "n") + }, + "--rebuilt-binaries": { "help" : "replace installed packages with binary " + \ "packages that have been rebuilt", @@ -791,6 +798,9 @@ def parse_opts(tmpcmdline, silent=False): else: myoptions.keep_going = None + if myoptions.package_moves in ("True",): + myoptions.package_moves = True + if myoptions.rebuilt_binaries in ("True",): myoptions.rebuilt_binaries = True @@ -1247,7 +1257,14 @@ def emerge_main(): if rval != os.EX_OK: return rval + tmpcmdline = [] + if "--ignore-default-opts" not in myopts: + tmpcmdline.extend(settings["EMERGE_DEFAULT_OPTS"].split()) + tmpcmdline.extend(sys.argv[1:]) + myaction, myopts, myfiles = parse_opts(tmpcmdline) + if myaction not in ('help', 'info', 'version') and \ + myopts.get('--package-moves') != 'n' and \ _global_updates(trees, mtimedb["updates"]): mtimedb.commit() # Reload the whole config from scratch. @@ -1258,12 +1275,6 @@ def emerge_main(): if xterm_titles: xtermTitle("emerge") - tmpcmdline = [] - if "--ignore-default-opts" not in myopts: - tmpcmdline.extend(settings["EMERGE_DEFAULT_OPTS"].split()) - tmpcmdline.extend(sys.argv[1:]) - myaction, myopts, myfiles = parse_opts(tmpcmdline) - if "--digest" in myopts: os.environ["FEATURES"] = os.environ.get("FEATURES","") + " digest" # Reload the whole config from scratch so that the portdbapi internal -- 2.26.2