summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-05-18 14:58:10 +0000
committerMarius Mauch <genone@gentoo.org>2007-05-18 14:58:10 +0000
commit386b8e3c552a8c919d4d98f552f71c256dde9421 (patch)
tree473f58a74cc008cf1f316f6f2531edf506af0121
parent3842954f39c773d14b8540baedeb88b02884508b (diff)
downloadportage-386b8e3c552a8c919d4d98f552f71c256dde9421.tar.gz
portage-386b8e3c552a8c919d4d98f552f71c256dde9421.tar.bz2
portage-386b8e3c552a8c919d4d98f552f71c256dde9421.zip
Display notification about unread news in all situations specified by glep 42
svn path=/main/trunk/; revision=6547
-rw-r--r--pym/emerge/__init__.py44
1 files changed, 28 insertions, 16 deletions
diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py
index 0d319d450..6e091ab51 100644
--- a/pym/emerge/__init__.py
+++ b/pym/emerge/__init__.py
@@ -3724,6 +3724,26 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
print " "+green("*")+" Processed",icount,"info files."
+def display_news_notification(settings):
+ target_root = settings["ROOT"]
+ NEWS_PATH = os.path.join("metadata", "news")
+ UNREAD_PATH = os.path.join(target_root, NEWS_LIB_PATH, "news")
+ porttree = portdbapi(porttree_root=settings["PORTDIR"], mysettings=settings)
+ newsReaderDisplay = False
+
+ print
+ 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 "Use " + colorize("GOOD", "eselect news") + " to read news items."
+
+ print
def post_emerge(settings, mtimedb, retval):
"""
Misc. things to run at the end of a merge session.
@@ -3732,6 +3752,7 @@ def post_emerge(settings, mtimedb, retval):
Update Config Files
Update News Items
Commit mtimeDB
+ Display preserved libs warnings
Exit Emerge
@param settings: Configuration settings (typically portage.settings)
@@ -3766,26 +3787,11 @@ def post_emerge(settings, mtimedb, retval):
chk_updated_cfg_files(target_root, config_protect)
- NEWS_PATH = os.path.join( "metadata", "news" )
- UNREAD_PATH = os.path.join( target_root, NEWS_LIB_PATH, 'news')
- 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 "Use " + colorize("GOOD", "eselect news") + " to read news items."
+ display_news_notification(settings)
from portage.dbapi.vartree import PreservedLibsRegistry
plib_registry = PreservedLibsRegistry(os.path.join(target_root, CACHE_PATH, "preserved_libs_registry"))
if plib_registry.hasEntries():
- print
print colorize("WARN", "!!!") + " existing preserved libs:"
plibdata = plib_registry.getPreservedLibs()
for cpv in plibdata.keys():
@@ -4333,6 +4339,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
print red(" * ")+"configuration files."
print red(" * ")+"To update portage, run 'emerge portage'."
print
+
+ display_news_notification(settings)
def action_metadata(settings, portdb, myopts):
portage.writemsg_stdout("\n>>> Updating Portage cache: ")
@@ -5626,10 +5634,14 @@ def emerge_main():
# "update", "system", or just process files:
else:
validate_ebuild_environment(trees)
+ if "--pretend" not in myopts:
+ display_news_notification(settings)
action_build(settings, trees, mtimedb,
myopts, myaction, myfiles, spinner)
if "--pretend" not in myopts:
post_emerge(settings, mtimedb, 0)
+ else:
+ display_news_notification(settings)
if __name__ == "__main__":
retval = emerge_main()