diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-16 01:37:27 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-16 01:37:27 +0000 |
commit | 2fea7711d96105aeac715e321419cd4f732c5f27 (patch) | |
tree | d0c42d9face63ab278bd59dfe1c963e4f2ae265b | |
parent | 11b0b22be712281ec6a15db5fc02373a4649a26a (diff) | |
download | portage-2fea7711d96105aeac715e321419cd4f732c5f27.tar.gz portage-2fea7711d96105aeac715e321419cd4f732c5f27.tar.bz2 portage-2fea7711d96105aeac715e321419cd4f732c5f27.zip |
Redirect dblink.merge() output to the log file when --jobs > 1.
svn path=/main/trunk/; revision=11068
-rw-r--r-- | pym/portage/dbapi/vartree.py | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 724e00ef8..f730a2151 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2208,17 +2208,18 @@ class dblink(object): collision_ignore = set([normalize_path(myignore) for myignore in \ self.settings.get("COLLISION_IGNORE", "").split()]) + showMessage = self._display_merge stopmerge = False i=0 collisions = [] destroot = normalize_path(destroot).rstrip(os.path.sep) + \ os.path.sep - writemsg_stdout("%s checking %d files for package collisions\n" % \ + showMessage("%s checking %d files for package collisions\n" % \ (green("*"), len(mycontents))) for f in mycontents: i = i + 1 if i % 1000 == 0: - writemsg_stdout("%d files checked ...\n" % i) + showMessage("%d files checked ...\n" % i) dest_path = normalize_path( os.path.join(destroot, f.lstrip(os.path.sep))) try: @@ -2276,6 +2277,9 @@ class dblink(object): def _security_check(self, installed_instances): if not installed_instances: return 0 + + showMessage = self._display_merge + file_paths = set() for dblnk in installed_instances: file_paths.update(dblnk.getcontents()) @@ -2310,13 +2314,13 @@ class dblink(object): return 0 from portage.output import colorize prefix = colorize("SECURITY_WARN", "*") + " WARNING: " - writemsg(prefix + "suid/sgid file(s) " + \ - "with suspicious hardlink(s):\n", noiselevel=-1) + showMessage(prefix + "suid/sgid file(s) " + \ + "with suspicious hardlink(s):\n", level=logging.ERROR) for path_list in suspicious_hardlinks: for path, s in path_list: - writemsg(prefix + " '%s'\n" % path, noiselevel=-1) - writemsg(prefix + "See the Gentoo Security Handbook " + \ - "guide for advice on how to proceed.\n", noiselevel=-1) + showMessage(prefix + " '%s'\n" % path, level=logging.ERROR) + showMessage(prefix + "See the Gentoo Security Handbook " + \ + "guide for advice on how to proceed.\n", level=logging.ERROR) return 1 def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0, @@ -2355,12 +2359,14 @@ class dblink(object): not existing; we will merge these symlinks at a later time. """ + showMessage = self._display_merge + srcroot = normalize_path(srcroot).rstrip(os.path.sep) + os.path.sep destroot = normalize_path(destroot).rstrip(os.path.sep) + os.path.sep if not os.path.isdir(srcroot): - writemsg("!!! Directory Not Found: D='%s'\n" % srcroot, - noiselevel=-1) + showMessage("!!! Directory Not Found: D='%s'\n" % srcroot, + level=logging.ERROR) return 1 inforoot_slot_file = os.path.join(inforoot, "SLOT") @@ -2385,8 +2391,8 @@ class dblink(object): _eerror(l, phase="preinst", key=self.settings.mycpv) if slot != self.settings["SLOT"]: - writemsg("!!! WARNING: Expected SLOT='%s', got '%s'\n" % \ - (self.settings["SLOT"], slot)) + showMessage("!!! WARNING: Expected SLOT='%s', got '%s'\n" % \ + (self.settings["SLOT"], slot), level=logging.WARN) if not os.path.exists(self.dbcatdir): os.makedirs(self.dbcatdir) @@ -2603,7 +2609,7 @@ class dblink(object): # run preinst script if scheduler is None: - writemsg_stdout(">>> Merging %s to %s\n" % (self.mycpv, destroot)) + showMessage(">>> Merging %s to %s\n" % (self.mycpv, destroot)) a = doebuild(myebuild, "preinst", destroot, self.settings, use_cache=0, tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree) @@ -2613,7 +2619,8 @@ class dblink(object): # XXX: Decide how to handle failures here. if a != os.EX_OK: - writemsg("!!! FAILED preinst: "+str(a)+"\n", noiselevel=-1) + showMessage("!!! FAILED preinst: "+str(a)+"\n", + level=logging.ERROR) return a # copy "info" files (like SLOT, CFLAGS, etc.) into the database @@ -2723,19 +2730,20 @@ class dblink(object): continue if not (autoclean or dblnk.mycpv == self.mycpv or reinstall_self): continue - writemsg_stdout(">>> Safely unmerging already-installed instance...\n") + showMessage(">>> Safely unmerging already-installed instance...\n") others_in_slot.remove(dblnk) # dblnk will unmerge itself now dblnk.unmerge(trimworld=0, ldpath_mtimes=prev_mtimes, others_in_slot=others_in_slot) # TODO: Check status and abort if necessary. dblnk.delete() - writemsg_stdout(">>> Original instance of package unmerged safely.\n") + showMessage(">>> Original instance of package unmerged safely.\n") if len(others_in_slot) > 1: from portage.output import colorize - writemsg_stdout(colorize("WARN", "WARNING:") + showMessage(colorize("WARN", "WARNING:") + " AUTOCLEAN is disabled. This can cause serious" - + " problems due to overlapping packages.\n") + + " problems due to overlapping packages.\n", + level=logging.WARN) # We hold both directory locks. self.dbdir = self.dbpkgdir @@ -2768,7 +2776,7 @@ class dblink(object): use_cache=0, tree=self.treetype, mydbapi=mydbapi, vartree=self.vartree) if a == os.EX_OK: - writemsg_stdout(">>> %s %s\n" % (self.mycpv, "merged.")) + showMessage(">>> %s %s\n" % (self.mycpv, "merged.")) else: a = scheduler.dblinkEbuildPhase( self, mydbapi, myebuild, "postinst") @@ -2777,7 +2785,8 @@ class dblink(object): # XXX: Decide how to handle failures here. if a != os.EX_OK: - writemsg("!!! FAILED postinst: "+str(a)+"\n", noiselevel=-1) + showMessage("!!! FAILED postinst: "+str(a)+"\n", + level=logging.ERROR) return a downgrade = False @@ -2819,6 +2828,9 @@ class dblink(object): 2. None otherwise """ + + showMessage = self._display_merge + from os.path import sep, join srcroot = normalize_path(srcroot).rstrip(sep) + sep destroot = normalize_path(destroot).rstrip(sep) + sep @@ -2919,7 +2931,7 @@ class dblink(object): # unlinking no longer necessary; "movefile" will overwrite symlinks atomically and correctly mymtime = movefile(mysrc, mydest, newmtime=thismtime, sstat=mystat, mysettings=self.settings) if mymtime != None: - writemsg_stdout(">>> %s -> %s\n" % (mydest, myto)) + showMessage(">>> %s -> %s\n" % (mydest, myto)) outfile.write("sym "+myrealdest+" -> "+myto+" "+str(mymtime)+"\n") else: print "!!! Failed to move file." @@ -2947,7 +2959,7 @@ class dblink(object): if stat.S_ISLNK(mydmode) or stat.S_ISDIR(mydmode): # a symlink to an existing directory will work for us; keep it: - writemsg_stdout("--- %s/\n" % mydest) + showMessage("--- %s/\n" % mydest) if bsd_chflags: bsd_chflags.lchflags(mydest, dflags) else: @@ -2966,7 +2978,7 @@ class dblink(object): bsd_chflags.lchflags(mydest, dflags) os.chmod(mydest, mystat[0]) os.chown(mydest, mystat[4], mystat[5]) - writemsg_stdout(">>> %s/\n" % mydest) + showMessage(">>> %s/\n" % mydest) else: #destination doesn't exist if self.settings.selinux_enabled(): @@ -2977,7 +2989,7 @@ class dblink(object): os.mkdir(mydest) os.chmod(mydest, mystat[0]) os.chown(mydest, mystat[4], mystat[5]) - writemsg_stdout(">>> %s/\n" % mydest) + showMessage(">>> %s/\n" % mydest) outfile.write("dir "+myrealdest+"\n") # recurse and merge this directory if self.mergeme(srcroot, destroot, outfile, secondhand, @@ -2996,7 +3008,7 @@ class dblink(object): if stat.S_ISDIR(mydmode): # install of destination is blocked by an existing directory with the same name moveme = 0 - writemsg_stdout("!!! %s\n" % mydest) + showMessage("!!! %s\n" % mydest, level=logging.ERROR) elif stat.S_ISREG(mydmode) or (stat.S_ISLNK(mydmode) and os.path.exists(mydest) and stat.S_ISREG(os.stat(mydest)[stat.ST_MODE])): cfgprot = 0 # install of destination is blocked by an existing regular file, @@ -3042,7 +3054,7 @@ class dblink(object): if mymtime != None: outfile.write("obj "+myrealdest+" "+mymd5+" "+str(mymtime)+"\n") - writemsg_stdout("%s %s\n" % (zing,mydest)) + showMessage("%s %s\n" % (zing,mydest)) else: # we are merging a fifo or device node zing = "!!!" @@ -3056,7 +3068,7 @@ class dblink(object): outfile.write("fif %s\n" % myrealdest) else: outfile.write("dev %s\n" % myrealdest) - writemsg_stdout(zing + " " + mydest + "\n") + showMessage(zing + " " + mydest + "\n") def merge(self, mergeroot, inforoot, myroot, myebuild=None, cleanup=0, mydbapi=None, prev_mtimes=None): |