From 193832586b48a1ae7cdcfe800077b88ec1c12cc0 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 15 Sep 2008 18:54:22 +0000 Subject: Improve error messages for issues with the SYNC variable inside action_sync(). svn path=/main/trunk/; revision=11513 --- pym/_emerge/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index cef13e3e8..aabb02687 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -11078,7 +11078,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): if not os.path.exists(myportdir): print ">>>",myportdir,"not found, creating it." os.makedirs(myportdir,0755) - syncuri=settings["SYNC"].rstrip() + syncuri = settings.get("SYNC", "").strip() + if not syncuri: + writemsg_level("!!! SYNC is undefined. Is /etc/make.globals missing?\n", + noiselevel=-1, level=logging.ERROR) + return 1 + os.umask(0022) updatecache_flg = False if myaction == "metadata": @@ -11482,8 +11487,9 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): sys.exit(retval) dosyncuri = syncuri else: - print "!!! rsync setting: ",syncuri,"not recognized; exiting." - sys.exit(1) + writemsg_level("!!! Unrecognized protocol: SYNC='%s'\n" % (syncuri,), + noiselevel=-1, level=logging.ERROR) + return 1 if updatecache_flg and \ myaction != "metadata" and \ @@ -11528,6 +11534,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): print display_news_notification(root_config, myopts) + return os.EX_OK def action_metadata(settings, portdb, myopts): portage.writemsg_stdout("\n>>> Updating Portage cache: ") @@ -13746,7 +13753,7 @@ def emerge_main(): root_config = trees[settings["ROOT"]]["root_config"] if "sync" == myaction: - action_sync(settings, trees, mtimedb, myopts, myaction) + return action_sync(settings, trees, mtimedb, myopts, myaction) elif "metadata" == myaction: action_metadata(settings, portdb, myopts) elif myaction=="regen": -- cgit v1.2.3-1-g7c22