From 2859965bb164f322d2e169d8534cdc535a3f9901 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 15 Oct 2011 14:40:28 -0700 Subject: [PATCH] fixpackages: don't use PORTAGE_CALLER --- bin/fixpackages | 9 +++++---- pym/portage/_global_updates.py | 8 ++++---- pym/portage/tests/emerge/test_simple.py | 8 +++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bin/fixpackages b/bin/fixpackages index 5e1df7045..dc43ed2b3 100755 --- a/bin/fixpackages +++ b/bin/fixpackages @@ -1,11 +1,12 @@ #!/usr/bin/python -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function -import os,sys -os.environ["PORTAGE_CALLER"]="fixpackages" +import os +import sys + try: import portage except ImportError: @@ -38,7 +39,7 @@ except (OSError, ValueError) as e: portage.writemsg("!!! %s\n" % str(e)) del e -_global_updates(mytrees, mtimedb["updates"]) +_global_updates(mytrees, mtimedb["updates"], if_mtime_changed=False) print() print("Done.") diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py index be8a73492..72fd5c4fd 100644 --- a/pym/portage/_global_updates.py +++ b/pym/portage/_global_updates.py @@ -15,7 +15,7 @@ from portage.update import grab_updates, parse_updates, update_config_files, upd from portage.util import grabfile, shlex_split, \ writemsg, writemsg_stdout, write_atomic -def _global_updates(trees, prev_mtimes, quiet=False): +def _global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True): """ Perform new global updates if they exist in 'profiles/updates/' subdirectories of all active repositories (PORTDIR + PORTDIR_OVERLAY). @@ -73,10 +73,10 @@ def _global_updates(trees, prev_mtimes, quiet=False): continue try: - if mysettings.get("PORTAGE_CALLER") == "fixpackages": - update_data = grab_updates(updpath) + if if_mtime_changed: + update_data = grab_updates(updpath, prev_mtimes=prev_mtimes) else: - update_data = grab_updates(updpath, prev_mtimes) + update_data = grab_updates(updpath) except DirectoryNotFound: continue myupd = [] diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py index 134d889ba..70d491845 100644 --- a/pym/portage/tests/emerge/test_simple.py +++ b/pym/portage/tests/emerge/test_simple.py @@ -249,7 +249,8 @@ src_install() { "PYTHONPATH" : pythonpath, } - dirs = [distdir, fake_bin, portage_tmpdir, + updates_dir = os.path.join(portdir, "profiles", "updates") + dirs = [distdir, fake_bin, portage_tmpdir, updates_dir, user_config_dir, var_cache_edb] true_symlinks = ["chown", "chgrp"] true_binary = find_binary("true") @@ -271,6 +272,11 @@ src_install() { for cp, xml_data in metadata_xml_files: with open(os.path.join(portdir, cp, "metadata.xml"), 'w') as f: f.write(playground.metadata_xml_template % xml_data) + with open(os.path.join(updates_dir, "1Q-2010"), 'w') as f: + f.write(""" +slotmove =app-doc/pms-3 2 3 +move dev-util/git dev-vcs/git +""") if debug: # The subprocess inherits both stdout and stderr, for -- 2.26.2