summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-26 21:22:26 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-26 21:22:26 -0700
commitd47cf3efc797024749727464487ec0f155212b88 (patch)
tree0514b592c6db9669cc7c5e9daea10c80005c0f52
parenta7f9df6dac32d2efd31b1c84ce10981560913282 (diff)
downloadportage-d47cf3efc797024749727464487ec0f155212b88.tar.gz
portage-d47cf3efc797024749727464487ec0f155212b88.tar.bz2
portage-d47cf3efc797024749727464487ec0f155212b88.zip
Add emerge --check-news for bug #388233.
-rw-r--r--man/emerge.14
-rw-r--r--pym/_emerge/main.py15
-rw-r--r--pym/portage/tests/emerge/test_simple.py2
3 files changed, 20 insertions, 1 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index c10ac6b38..e63d38672 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -96,6 +96,10 @@ option if you want to install a tbz2\fR. The packages are added
to the \fBworld\fR file at the end, so that they are considered for
later updating.
.TP
+.BR \-\-check\-news
+Scan all repositories for relevant unread GLEP 42 news items, and display
+how many are found. See \fIhttp://www.gentoo.org/proj/en/glep/glep-0042.html\fR.
+.TP
.BR \-\-clean
Cleans up the system by examining the installed packages and removing older
packages. This is accomplished by looking at each installed package and separating
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index f0f50bdca..0dfc5f998 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -10,6 +10,10 @@ import sys
import textwrap
import platform
import portage
+import portage
+portage.proxy.lazyimport.lazyimport(globals(),
+ 'portage.news:count_unread_news,display_news_notifications',
+)
from portage import os
from portage import _encodings
from portage import _unicode_decode
@@ -587,7 +591,7 @@ def parse_opts(tmpcmdline, silent=False):
global options, shortmapping
actions = frozenset([
- "clean", "config", "depclean", "help",
+ "clean", "check-news", "config", "depclean", "help",
"info", "list-sets", "metadata",
"prune", "regen", "search",
"sync", "unmerge", "version",
@@ -1726,6 +1730,15 @@ def emerge_main(args=None):
if myaction == "list-sets":
writemsg_stdout("".join("%s\n" % s for s in sorted(root_config.sets)))
return os.EX_OK
+ elif myaction == "check-news":
+ news_counts = count_unread_news(
+ root_config.trees["porttree"].dbapi,
+ root_config.trees["vartree"].dbapi)
+ if list(filter(None, news_counts.values())):
+ display_news_notifications(news_counts)
+ elif "--quiet" not in myopts:
+ print("", colorize("GOOD", "*"), "No news items were found.")
+ return os.EX_OK
ensure_required_sets(trees)
diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index aaa54d0a7..271911537 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -177,6 +177,8 @@ pkg_info() {
emerge_cmd + ("--version",),
emerge_cmd + ("--info",),
emerge_cmd + ("--info", "--verbose"),
+ emerge_cmd + ("--list-sets",),
+ emerge_cmd + ("--check-news",),
rm_cmd + ("-rf", cachedir),
rm_cmd + ("-rf", cachedir_pregen),
emerge_cmd + ("--regen",),