summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-09-16 00:42:00 +0000
committerZac Medico <zmedico@gentoo.org>2006-09-16 00:42:00 +0000
commit689d099f5ed6b41e3bd517c1b201363ec78b25ad (patch)
tree59469236a6fd17920861a3ac1eb03f4d5d1338a6
parent67ba1db18b8ca37d678963b698432ddcbcbbd2a1 (diff)
downloadportage-689d099f5ed6b41e3bd517c1b201363ec78b25ad.tar.gz
portage-689d099f5ed6b41e3bd517c1b201363ec78b25ad.tar.bz2
portage-689d099f5ed6b41e3bd517c1b201363ec78b25ad.zip
For bug #14321, make emerge scan for individual files listed in CONFIG_PROTECT.
svn path=/main/trunk/; revision=4459
-rwxr-xr-xbin/emerge34
1 files changed, 24 insertions, 10 deletions
diff --git a/bin/emerge b/bin/emerge
index 5bcb6eaa4..22f366130 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -20,7 +20,7 @@ try:
except KeyboardInterrupt:
sys.exit(1)
-import os
+import os, stat
os.environ["PORTAGE_CALLER"]="emerge"
sys.path = ["/usr/lib/portage/pym"]+sys.path
@@ -2521,15 +2521,29 @@ def chk_updated_cfg_files(target_root, config_protect):
procount=0
for x in config_protect:
x = os.path.join(target_root, x.lstrip(os.path.sep))
- if os.path.isdir(x):
- a=commands.getstatusoutput("cd "+x+"; find . -iname '._cfg????_*'")
- if a[0]!=0:
- print " "+red("*")+" error scanning",x
- else:
- files=string.split(a[1])
- if files:
- procount=procount+1
- print " "+yellow("* IMPORTANT:")+"",len(files),"config files in",x,"need updating."
+ try:
+ mymode = os.lstat(x).st_mode
+ except OSError:
+ continue
+ if stat.S_ISDIR(mymode):
+ mycommand = "cd '%s'; find . -iname '._cfg????_*'" % x
+ else:
+ mycommand = "cd '%s'; find . -maxdepth 1 -iname '._cfg????_%s'" % \
+ os.path.split(x.rstrip(os.path.sep))
+ a = commands.getstatusoutput(mycommand)
+ if a[0] != 0:
+ print >> sys.stderr, " " + bad("*")+ " error scanning '%s'" % x
+ else:
+ files = a[1].split()
+ if files:
+ procount += 1
+ print colorize("WARN", " * IMPORTANT:"),
+ if stat.S_ISDIR(mymode):
+ print "%d config files in '%s' need updating." % \
+ (len(files), x)
+ else:
+ print "config file '%s' needs updating." % x
+
if procount:
#print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."
print " "+yellow("*")+" Type "+green("emerge --help config")+" to learn how to update config files."