diff options
-rwxr-xr-x | py/mock.py | 5 | ||||
-rw-r--r-- | py/mock/backend.py | 5 | ||||
-rw-r--r-- | py/mock/exception.py | 14 |
3 files changed, 22 insertions, 2 deletions
@@ -652,6 +652,11 @@ if __name__ == '__main__': exitStatus = 7 log.error("Exiting on user interrupt, <CTRL>-C") + except (mock.exception.ResultDirNotAccessible,), exc: + exitStatus = exc.resultcode + log.error(str(exc)) + killOrphans = 0 + except (mock.exception.BadCmdline, mock.exception.BuildRootLocked), exc: exitStatus = exc.resultcode log.error(str(exc)) diff --git a/py/mock/backend.py b/py/mock/backend.py index 6cfd603..ed61a69 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -169,8 +169,9 @@ class Root(object): self.uidManager.dropPrivsTemp() try: mock.util.mkdirIfAbsent(self.resultdir) - except OSError: - pass + except (OSError,), e: + if e.errno == 13: + raise mock.exception.ResultDirNotAccessible( ResultDirNotAccessible.__doc__ % self.resultdir ) self.uidManager.restorePrivs() # lock this buildroot so we dont get stomped on. diff --git a/py/mock/exception.py b/py/mock/exception.py index d02bddb..3c84606 100644 --- a/py/mock/exception.py +++ b/py/mock/exception.py @@ -35,6 +35,7 @@ class Error(Exception): # 40 = some error in the pkg we're building # 50 = tried to fork a subcommand and it errored out # 60 = buildroot locked +# 70 = result dir could not be created class BuildError(Error): "rpmbuild failed." @@ -77,3 +78,16 @@ class BadCmdline(Error): Error.__init__(self, msg) self.msg = msg self.resultcode = 05 + +class ResultDirNotAccessible(Error): + """ +Could not create output directory for built rpms. The directory specified was: + %s + +Try using the --resultdir= option to select another location. Recommended location is --resultdir=~/mock/. +""" + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 70 + |