/usr/share/pyshared/mockbuild/exception.py is in mock 1.1.33-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | # vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Originally written by Seth Vidal
# Sections taken from Mach by Thomas Vander Stichele
# Major reorganization and adaptation by Michael Brown
# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
"""define most of the exceptions used."""
# python library imports
#from exceptions import Exception
# our imports
# classes
class Error(Exception):
"base class for our errors."
def __init__(self, msg, status=None):
Exception.__init__(self)
self.msg = msg
self.resultcode = 1
if status is not None:
self.resultcode = status
def __str__(self):
return self.msg
# result/exit codes
# 0 = yay!
# 1 = something happened - it's bad
# 5 = cmdline processing error
# 6 = invalid architecture
# 10 = problem building the package
# 20 = error in the chroot of some kind
# 30 = Yum emitted an error of some sort
# 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
# 80 = unshare of namespace failed
# 90 = attempted to use an uninitialized chroot
# 100 = attempt to run a root shell and root shells disallowed
class BuildError(Error):
"rpmbuild failed."
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 10
class RootError(Error):
"failed to set up chroot"
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 20
class YumError(RootError):
"yum failed."
def __init__(self, msg):
RootError.__init__(self, msg)
self.msg = msg
self.resultcode = 30
class PkgError(Error):
"error with the srpm given to us."
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 40
class BuildRootLocked(Error):
"build root in use by another process."
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 60
class BadCmdline(Error):
"user gave bad/inconsistent command line."
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 05
class InvalidArchitecture(Error):
"invalid host/target architecture specified."
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 06
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
class UnshareFailed(Error):
"call to C library unshare(2) syscall failed"
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 80
class ChrootNotInitialized(Error):
"attempt to use uninitialized chroot"
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 90
class NoRootShells(Error):
"attempt to run an interactive root shell on secured system"
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 100
class StateError(Error):
"unbalanced call to state functions"
def __init__(self, msg):
Error.__init__(self, msg)
self.msg = msg
self.resultcode = 110
|