diff options
author | Clark Williams <williams@redhat.com> | 2008-04-14 11:02:10 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2008-04-14 11:02:10 -0500 |
commit | 5b5662b02a1d82148beaeae3fe4a8fa2bcf55ba2 (patch) | |
tree | 4b75c7f6ed2f90f16a77da917f4aa7d9c2afbe7c /py | |
parent | c5dfce5f71df354aa87cd19cdec33288ef85c7c1 (diff) | |
parent | e070277073e8bf8bf4f43588de1a1c361fd4230c (diff) | |
download | mock-5b5662b02a1d82148beaeae3fe4a8fa2bcf55ba2.tar.gz mock-5b5662b02a1d82148beaeae3fe4a8fa2bcf55ba2.tar.xz mock-5b5662b02a1d82148beaeae3fe4a8fa2bcf55ba2.zip |
Merge branch 'master' of git+ssh://jcwillia@git.fedoraproject.org/git/hosted/mock
Diffstat (limited to 'py')
-rwxr-xr-x | py/mock.py | 11 | ||||
-rw-r--r-- | py/mock/backend.py | 19 | ||||
-rw-r--r-- | py/mock/util.py | 2 |
3 files changed, 24 insertions, 8 deletions
@@ -637,6 +637,17 @@ if __name__ == '__main__': except (SystemExit,): raise + except (OSError,), e: + if e.errno == 1: + print + log.error("%s" % str(e)) + print + log.error("The most common cause for this error is trying to run /usr/sbin/mock as an unprivileged user.") + log.error("Check your path to make sure that /usr/bin/ is listed before /usr/sbin, or manually run /usr/bin/mock to see if that fixes this problem.") + print + else: + raise + except (KeyboardInterrupt,): exitStatus = 7 log.error("Exiting on user interrupt, <CTRL>-C") diff --git a/py/mock/backend.py b/py/mock/backend.py index 6726deb..3cc0a9f 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -269,6 +269,7 @@ class Root(object): # files in /dev mock.util.rmtree(self.makeChrootPath("dev")) mock.util.mkdirIfAbsent(self.makeChrootPath("dev", "pts")) + mock.util.mkdirIfAbsent(self.makeChrootPath("dev", "shm")) prevMask = os.umask(0000) devFiles = ( (stat.S_IFCHR | 0666, os.makedev(1, 3), "dev/null"), @@ -295,13 +296,17 @@ class Root(object): os.umask(prevMask) # mount/umount - umntCmd = 'umount -n %s' % self.makeChrootPath('/dev/pts') - if umntCmd not in self.umountCmds: - self.umountCmds.append(umntCmd) - - mntCmd = 'mount -n -t devpts mock_chroot_devpts %s' % self.makeChrootPath('/dev/pts') - if mntCmd not in self.mountCmds: - self.mountCmds.append(mntCmd) + for devUnmtCmd in ( + 'umount -n %s' % self.makeChrootPath('/dev/pts'), + 'umount -n %s' % self.makeChrootPath('/dev/shm') ): + if devUnmtCmd not in self.umountCmds: + self.umountCmds.append(devUnmtCmd) + + for devMntCmd in ( + 'mount -n -t devpts mock_chroot_devpts %s' % self.makeChrootPath('/dev/pts'), + 'mount -n -t tmpfs mock_chroot_shmfs %s' % self.makeChrootPath('/dev/shm') ): + if devMntCmd not in self.mountCmds: + self.mountCmds.append(devMntCmd) # bad hack # comment out decorator here so we dont get double exceptions in the root log diff --git a/py/mock/util.py b/py/mock/util.py index 9f0eb3a..7f46b94 100644 --- a/py/mock/util.py +++ b/py/mock/util.py @@ -306,7 +306,7 @@ def do(command, shell=False, chrootPath=None, cwd=None, timeout=0, raiseExc=True os.killpg(child.pid, 9) if not niceExit: - raise commandTimeoutExpired, ("Timeout(%s) expired for command:\n # %s\n%s" % (timeout, cmd, output)) + raise commandTimeoutExpired, ("Timeout(%s) expired for command:\n # %s\n%s" % (timeout, command, output)) logger.debug("Child returncode was: %s" % str(child.returncode)) if raiseExc and child.returncode: |