You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-portage/esearch/files/1.1-Reprint-warnings-detect...

101 lines
3.0 KiB

From 32797b3ac5992c1711f9d965a967d00cbe014c78 Mon Sep 17 00:00:00 2001
From: Brian Dolbec <dolsen@gentoo.org>
Date: Sun, 15 Apr 2012 16:12:51 -0700
Subject: [PATCH] Reprint warnings detected during layman sync API operations
at the end of the sync output.
---
esearch/common.py | 8 +++++++-
esearch/sync.py | 17 ++++++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/esearch/common.py b/esearch/common.py
index c092026..a97102f 100755
--- a/esearch/common.py
+++ b/esearch/common.py
@@ -10,7 +10,7 @@ from __future__ import print_function
import sys
from portage import catpkgsplit
-from portage.output import red, green
+from portage.output import red, green, yellow
from . import __version__
@@ -101,3 +101,9 @@ def error(msg, fatal=True, stderr=CONFIG['stderr']):
print('', file=stderr)
if fatal:
sys.exit(1)
+
+def warn(msg, fatal=False, stdout=CONFIG['stdout']):
+ print(yellow(" * Warning:"), msg, file=stdout)
+ print('', file=stdout)
+ if fatal:
+ sys.exit(1)
diff --git a/esearch/sync.py b/esearch/sync.py
index a05f1cf..5748698 100755
--- a/esearch/sync.py
+++ b/esearch/sync.py
@@ -29,7 +29,7 @@ except ImportError:
from esearch.common import (CONFIG, SyncOpts, error, outofdateerror,
logfile_sync, laymanlog_sync, tmp_path, tmp_prefix, version,
- EPREFIX, COMPACT)
+ EPREFIX, COMPACT, warn)
from esearch.update import updatedb
from esearch.search import searchdb
@@ -166,8 +166,8 @@ def layman_sync(config):
error("'" + config['layman-cmd'] + "' failed, see " +
laymanlog_sync + " for errors", fatal=False)
print("")
- return False
- return True
+ return False, []
+ return True, []
# run the api to sync
emsg("Running the Layman API", config)
if config['verbose']<1:
@@ -179,6 +179,7 @@ def layman_sync(config):
verbose=config['verbose']>0, nocolor=config['nocolor'])
repos = _layman.get_installed()
success = _layman.sync(repos, output_results=config['verbose']>0)
+ warnings = _layman.sync_results[1]
if not success:
error("Syncing with the layman api "\
"failed.\n Failures were:", fatal=False)
@@ -186,7 +187,7 @@ def layman_sync(config):
for ovl, result in fatals:
error(result, fatal=False)
- return success
+ return success, warnings
def sync(config):
@@ -194,7 +195,8 @@ def sync(config):
tree_old = gettree("old", config)
if config['layman-sync']:
- if not layman_sync(config):
+ success, warnings = layman_sync(config)
+ if not success:
return False
if config['verbose'] >= 0:
@@ -266,6 +268,11 @@ def sync(config):
emsg("No updates found", config)
success = True
+ if warnings:
+ print("", file=config['stdout'])
+ for ovl, result in warnings:
+ warn(result)
+
# multiple pkgname search method
# build our re search list
#pkg_patterns = []
--
1.7.8.5