From b7b906fdf49a55621a12798ae21d603d9ca4eb76 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 14 Oct 2012 03:33:38 +0200 Subject: [PATCH] Bug #434970: Disable some warnings during `emerge --sync`. --- pym/_emerge/actions.py | 1 + pym/_emerge/main.py | 2 ++ pym/portage/__init__.py | 2 ++ pym/portage/package/ebuild/_config/LocationsManager.py | 6 +++--- pym/portage/repository/config.py | 8 +++++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 5d1110a08..3003afc65 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2468,6 +2468,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): return 1 # Reload the whole config from scratch. + portage._sync_disabled_warnings = False settings, trees, mtimedb = load_emerge_config(trees=trees) adjust_configs(myopts, trees) root_config = trees[settings['EROOT']]['root_config'] diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index e3557e574..dad144c7d 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -1655,6 +1655,8 @@ def emerge_main(args=None): # Portage needs to ensure a sane umask for the files it creates. os.umask(0o22) + if myaction == "sync": + portage._sync_disabled_warnings = True settings, trees, mtimedb = load_emerge_config() portdb = trees[settings['EROOT']]['porttree'].dbapi rval = profile_check(trees, myaction) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 695f1ea0a..9119b25bb 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -328,6 +328,8 @@ _python_interpreter = os.path.realpath(sys.executable) _bin_path = PORTAGE_BIN_PATH _pym_path = PORTAGE_PYM_PATH +_sync_disabled_warnings = False + def _shell_quote(s): """ Quote a string in double-quotes and use backslashes to diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py index c3099d73f..1ca2b324d 100644 --- a/pym/portage/package/ebuild/_config/LocationsManager.py +++ b/pym/portage/package/ebuild/_config/LocationsManager.py @@ -100,9 +100,9 @@ class LocationsManager(object): self._addProfile(os.path.realpath(self.profile_path), repositories, known_repos) except ParseError as e: - writemsg(_("!!! Unable to parse profile: '%s'\n") % \ - self.profile_path, noiselevel=-1) - writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1) + if not portage._sync_disabled_warnings: + writemsg(_("!!! Unable to parse profile: '%s'\n") % self.profile_path, noiselevel=-1) + writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1) self.profiles = [] self.profiles_complex = [] diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 83018b8a6..71f548ca4 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -15,6 +15,7 @@ try: from configparser import SafeConfigParser except ImportError: from ConfigParser import SafeConfigParser, ParsingError +import portage from portage import eclass_cache, os from portage.const import (MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH, REPO_NAME_LOC, USER_CONFIG_PATH) @@ -396,8 +397,8 @@ class RepoConfigLoader(object): prepos[repo.name] = repo else: - writemsg(_("!!! Invalid PORTDIR_OVERLAY" - " (not a dir): '%s'\n") % ov, noiselevel=-1) + if not portage._sync_disabled_warnings: + writemsg(_("!!! Invalid PORTDIR_OVERLAY (not a dir): '%s'\n") % ov, noiselevel=-1) return portdir @@ -521,7 +522,8 @@ class RepoConfigLoader(object): prepos['DEFAULT'].main_repo = ignored_location_map[portdir] else: prepos['DEFAULT'].main_repo = None - writemsg(_("!!! main-repo not set in DEFAULT and PORTDIR is empty. \n"), noiselevel=-1) + if not portage._sync_disabled_warnings: + writemsg(_("!!! main-repo not set in DEFAULT and PORTDIR is empty.\n"), noiselevel=-1) self.prepos = prepos self.prepos_order = prepos_order -- 2.26.2