diff options
-rw-r--r-- | pym/portage.py | 12 | ||||
-rw-r--r-- | pym/portage_update.py | 11 |
2 files changed, 17 insertions, 6 deletions
diff --git a/pym/portage.py b/pym/portage.py index f2bf9d6d6..e3d5ad742 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6850,10 +6850,14 @@ def global_updates(): updpath = os.path.join(settings["PORTDIR"], "profiles", "updates") if not mtimedb.has_key("updates"): mtimedb["updates"] = {} - if settings["PORTAGE_CALLER"] == "fixpackages": - update_data = grab_updates(updpath) - else: - update_data = grab_updates(updpath, mtimedb["updates"]) + try: + if settings["PORTAGE_CALLER"] == "fixpackages": + update_data = grab_updates(updpath) + else: + update_data = grab_updates(updpath, mtimedb["updates"]) + except portage_exception.DirectoryNotFound: + writemsg("--- 'profiles/updates' is empty or not available. Empty portage tree?\n") + return if len(update_data) > 0: do_upgrade_packagesmessage = 0 myupd = [] diff --git a/pym/portage_update.py b/pym/portage_update.py index a33bc9188..f2d0675d1 100644 --- a/pym/portage_update.py +++ b/pym/portage_update.py @@ -1,7 +1,8 @@ -import os, re +import errno, os, re from portage_util import write_atomic +from portage_exception import DirectoryNotFound ignored_dbentries = ("CONTENTS", "environment.bz2") @@ -49,7 +50,13 @@ def grab_updates(updpath, prev_mtimes=None): """Returns all the updates from the given directory as a sorted list of tuples, each containing (file_path, statobj, content). If prev_mtimes is given then only updates with differing mtimes are considered.""" - mylist = os.listdir(updpath) + try: + mylist = os.listdir(updpath) + except OSError, oe: + if oe.errno == errno.ENOENT: + raise DirectoryNotFound(oe) + else: + raise oe if prev_mtimes is None: prev_mtimes = {} # validate the file name (filter out CVS directory, etc...) |