summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/chk_updated_cfg_files.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-10-16 01:33:54 -0700
committerZac Medico <zmedico@gentoo.org>2012-10-16 01:33:54 -0700
commit65e69242814553b826b9277495a5f62b79569269 (patch)
treec70ee0e7310eb1ec4d457949d15732c577f49fb4 /pym/_emerge/chk_updated_cfg_files.py
parenteeef84317758b01ae2c1ba8f343343179aebc01e (diff)
downloadportage-65e69242814553b826b9277495a5f62b79569269.tar.gz
portage-65e69242814553b826b9277495a5f62b79569269.tar.bz2
portage-65e69242814553b826b9277495a5f62b79569269.zip
emerge_main: split out run_action
Also move post_emerge and chk_updated_cfg_files to separate files.
Diffstat (limited to 'pym/_emerge/chk_updated_cfg_files.py')
-rw-r--r--pym/_emerge/chk_updated_cfg_files.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/pym/_emerge/chk_updated_cfg_files.py b/pym/_emerge/chk_updated_cfg_files.py
new file mode 100644
index 000000000..9f2ab6f3e
--- /dev/null
+++ b/pym/_emerge/chk_updated_cfg_files.py
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from __future__ import print_function
+
+import logging
+
+import portage
+from portage import os
+from portage.localization import _
+from portage.output import bold, colorize, yellow
+from portage.util import writemsg_level
+
+def chk_updated_cfg_files(eroot, config_protect):
+ target_root = eroot
+ result = list(
+ portage.util.find_updated_config_files(target_root, config_protect))
+
+ for x in result:
+ writemsg_level("\n %s " % (colorize("WARN", "* " + _("IMPORTANT:"))),
+ level=logging.INFO, noiselevel=-1)
+ if not x[1]: # it's a protected file
+ writemsg_level( _("config file '%s' needs updating.\n") % x[0],
+ level=logging.INFO, noiselevel=-1)
+ else: # it's a protected dir
+ if len(x[1]) == 1:
+ head, tail = os.path.split(x[1][0])
+ tail = tail[len("._cfg0000_"):]
+ fpath = os.path.join(head, tail)
+ writemsg_level(_("config file '%s' needs updating.\n") % fpath,
+ level=logging.INFO, noiselevel=-1)
+ else:
+ writemsg_level(
+ _("%d config files in '%s' need updating.\n") % \
+ (len(x[1]), x[0]), level=logging.INFO, noiselevel=-1)
+
+ if result:
+ print(" " + yellow("*") + " See the " +
+ colorize("INFORM", _("CONFIGURATION FILES")) +
+ " " + _("section of the") + " " + bold("emerge"))
+ print(" " + yellow("*") + " " +
+ _("man page to learn how to update config files."))