From d1d19239e1c81c7ad40db62ca5844953a97ec5cc Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 14 Oct 2007 09:26:44 +0000 Subject: [PATCH] Merged from trunk 8113:8121 | 8114 | In the file collision eerror output, don't colorize the file | | zmedico | paths since the escape codes look ugly in the log. | | 8115 | Remove unused import. | | zmedico | | | 8117 | Avoid an error message from find when "${D}"/usr/share does | | zmedico | not exist. | | 8119 | In some cases, openpty can be slow when it fails. Therefore, | | zmedico | stop trying to use it after the first failure. | | 8121 | Remove the checks for files in symlinked directories from | | zmedico | the collision protect code since it hasn't been needed ever | | | since the followSymlinks parameter was disabled for | | | portage.listdir() calls in order to prevent infinite | | | recursion loops. | svn path=/main/branches/prefix/; revision=8122 --- bin/misc-functions.sh | 2 +- pym/portage/__init__.py | 23 ++++++++++++++++------- pym/portage/dbapi/vartree.py | 20 ++++---------------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index b6361c7ff..ee8d806c4 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -403,7 +403,7 @@ install_qa_check() { # Compiled python objects do not belong in /usr/share (FHS violation) # and can be a pain when upgrading python - f=$(find "${ED}"/usr/share -name '*.py[co]') + f=$([ -d "${ED}"/usr/share ] && find "${D}"/usr/share -name '*.py[co]') if [[ -n ${f} ]] ; then vecho -ne '\a\n' eqawarn "QA Notice: Precompiled python object files do not belong in /usr/share" diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a2a38ff87..c0fc83deb 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -2513,6 +2513,10 @@ class config(object): pass return self._selinux_enabled +# In some cases, openpty can be slow when it fails. Therefore, +# stop trying to use it after the first failure. +_disable_openpty = False + # XXX This would be to replace getstatusoutput completely. # XXX Issue: cannot block execution. Deadlock condition. def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakeroot=0, **keywords): @@ -2587,14 +2591,19 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero del keywords["logfile"] if 1 not in fd_pipes or 2 not in fd_pipes: raise ValueError(fd_pipes) - from pty import openpty - try: - master_fd, slave_fd = openpty() - got_pty = True - except EnvironmentError, e: - writemsg("openpty failed: '%s'\n" % str(e), noiselevel=1) - del e + global _disable_openpty + if _disable_openpty: master_fd, slave_fd = os.pipe() + else: + from pty import openpty + try: + master_fd, slave_fd = openpty() + got_pty = True + except EnvironmentError, e: + _disable_openpty = True + writemsg("openpty failed: '%s'\n" % str(e), noiselevel=1) + del e + master_fd, slave_fd = os.pipe() # We must set non-blocking mode before we close the slave_fd # since otherwise the fcntl call can fail on FreeBSD (the child diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 4fc590a46..26badff20 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1474,11 +1474,9 @@ class dblink(object): del preserve_paths - def _collision_protect(self, srcroot, destroot, mypkglist, mycontents, mysymlinks): + def _collision_protect(self, srcroot, destroot, mypkglist, mycontents): collision_ignore = set([normalize_path(myignore) for myignore in \ self.settings.get("COLLISION_IGNORE", "").split()]) - mysymlinked_directories = [s + os.path.sep for s in mysymlinks] - del mysymlinks stopmerge = False i=0 @@ -1487,15 +1485,6 @@ class dblink(object): os.path.sep print green("*")+" checking "+str(len(mycontents))+" files for package collisions" for f in mycontents: - nocheck = False - # listdir isn't intelligent enough to exclude symlinked dirs, - # so we have to do it ourself - for s in mysymlinked_directories: - if f.startswith(s): - nocheck = True - break - if nocheck: - continue i = i + 1 if i % 1000 == 0: print str(i)+" files checked ..." @@ -1750,7 +1739,7 @@ class dblink(object): # check for package collisions collisions = self._collision_protect(srcroot, destroot, others_in_slot, - myfilelist+mylinklist, mylinklist) + myfilelist+mylinklist) if True: """ The merge process may move files out of the image directory, @@ -1803,10 +1792,9 @@ class dblink(object): cmd += "eerror \"Detected file collision(s):\" ; " cmd += "eerror ; " - from portage.output import colorize for f in collisions: - cmd += "eerror \" '%s'\" ; " % colorize("INFORM", - os.path.join(destroot, f.lstrip(os.path.sep))) + cmd += "eerror \" '%s'\" ; " % \ + os.path.join(destroot, f.lstrip(os.path.sep)) from portage import process process.spawn(["bash", "-c", cmd], -- 2.26.2