diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-12-06 10:52:50 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-12-06 10:52:50 -0800 |
commit | 96a8b44c8a1fddfa82424ad3c86b6a380ad863a2 (patch) | |
tree | 8da5d3a06fda6443f323e432be020bf3b364de1d | |
parent | 6bdc8c114a60727a4a5c77344b5c89379463b693 (diff) | |
download | portage-96a8b44c8a1fddfa82424ad3c86b6a380ad863a2.tar.gz portage-96a8b44c8a1fddfa82424ad3c86b6a380ad863a2.tar.bz2 portage-96a8b44c8a1fddfa82424ad3c86b6a380ad863a2.zip |
action_sync: fix git_sync_timestamps KeyError
This fixes the case where $PORTDIR doesn't exist prior to sync.
-rw-r--r-- | pym/_emerge/actions.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index a62b30510..87610a693 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1971,6 +1971,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): os.umask(0o022) dosyncuri = syncuri updatecache_flg = False + git = False if myaction == "metadata": print("skipping sync") updatecache_flg = True @@ -1999,9 +2000,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): msg = ">>> Git pull in %s successful" % myportdir emergelog(xterm_titles, msg) writemsg_level(msg + "\n") - exitcode = git_sync_timestamps(portdb, myportdir) - if exitcode == os.EX_OK: - updatecache_flg = True + git = True elif syncuri[:8]=="rsync://" or syncuri[:6]=="ssh://": for vcs_dir in vcs_dirs: writemsg_level(("!!! %s appears to be under revision " + \ @@ -2443,17 +2442,25 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): noiselevel=-1, level=logging.ERROR) return 1 - if updatecache_flg and \ - myaction != "metadata" and \ - "metadata-transfer" not in settings.features: - updatecache_flg = False - # Reload the whole config from scratch. settings, trees, mtimedb = load_emerge_config(trees=trees) adjust_configs(myopts, trees) root_config = trees[settings['EROOT']]['root_config'] portdb = trees[settings['EROOT']]['porttree'].dbapi + if git: + # NOTE: Do this after reloading the config, in case + # it did not exist prior to sync, so that the config + # and portdb properly account for its existence. + exitcode = git_sync_timestamps(portdb, myportdir) + if exitcode == os.EX_OK: + updatecache_flg = True + + if updatecache_flg and \ + myaction != "metadata" and \ + "metadata-transfer" not in settings.features: + updatecache_flg = False + if updatecache_flg and \ os.path.exists(os.path.join(myportdir, 'metadata', 'cache')): |