# 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"
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):
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
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
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 ..."
# 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,
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],