From f72beba1fa2c393af7101d45ab8b3614a314874e Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Tue, 16 Jan 2007 16:07:10 +0000 Subject: [PATCH] Various glep 42 fixes, fix up the portageq calls to fail properly, rewrite the news checking code to check news for all repos with a name. svn path=/main/trunk/; revision=5670 --- bin/emerge | 21 ++++++++++++++------- bin/portageq | 11 +++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bin/emerge b/bin/emerge index f42c2cb96..1e4926752 100755 --- a/bin/emerge +++ b/bin/emerge @@ -29,7 +29,7 @@ except ImportError: sys.path.insert(0, "/usr/lib/portage/pym") import portage del os.environ["PORTAGE_LEGACY_GLOBALS"] -from portage import digraph +from portage import digraph, portdbapi import emergehelp, xpak, commands, errno, re, socket, time, types import output @@ -3561,13 +3561,20 @@ def post_emerge(settings, mtimedb, retval): NEWS_PATH = os.path.join( "metadata", "news" ) UNREAD_PATH = os.path.join( target_root, portage.PRIVATE_PATH, 'news') - repo_id = 'gentoo' - unreadItems = checkUpdatedNewsItems(target_root, NEWS_PATH, UNREAD_PATH, repo_id) - if unreadItems: - print colorize("WARN", " * IMPORTANT:"), - print "%s news items need reading." % unreadItems + porttree = portdbapi( porttree_root = settings["PORTDIR"], mysettings = settings ) + newsReaderDisplay = False + + for repo in porttree.getRepositories(): + unreadItems = checkUpdatedNewsItems(target_root, NEWS_PATH, UNREAD_PATH, repo) + if unreadItems: + print colorize("WARN", " * IMPORTANT:"), + print "%s news items need reading for repository '%s'." % (unreadItems, repo) + newsReaderDisplay = True + + if newsReaderDisplay: print colorize("WARN", " *"), - print "Type something to read the news" + print "Use " + colorize("GOOD", "eselect news") + " to read news items." + mtimedb.commit() sys.exit(retval) diff --git a/bin/portageq b/bin/portageq index 6485d7c79..aa302555d 100755 --- a/bin/portageq +++ b/bin/portageq @@ -274,13 +274,20 @@ def get_repos(argv): """ Returns all repos with names (repo_name file) argv[0] = $ROOT """ + if len(argv) < 1: + print "ERROR: insufficient parameters!" + sys.exit(2) print " ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories()) def get_repo_path(argv): - """ + """ + Returns the path to the repo named argv[1], argv[0] = $ROOT """ - print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(argv[1]) + if len(argv) < 2: + print "ERROR: insufficient parameters!" + sys.exit(2) + for arg in arvg[1:] + print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(argv[1]) #----------------------------------------------------------------------------- # -- 2.26.2