summaryrefslogtreecommitdiffstats
path: root/py/mock.py
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2007-12-10 11:04:20 -0600
committerMichael E Brown <michael_e_brown@dell.com>2007-12-10 11:04:20 -0600
commitce6e26a58c56b7b8e0b770318a6a1469e6937e66 (patch)
tree9237400fa9a3f35d4fe4e3543059b0d3978f8de9 /py/mock.py
parentaada35a1281981a361cce99f923f467ddabbeb76 (diff)
downloadmock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.tar.gz
mock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.tar.xz
mock-ce6e26a58c56b7b8e0b770318a6a1469e6937e66.zip
add --orphanskill mode. requested by mbonnet for koji.
Diffstat (limited to 'py/mock.py')
-rwxr-xr-xpy/mock.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/py/mock.py b/py/mock.py
index f4a9d80..12b280f 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -83,6 +83,9 @@ def command_parse(config_opts):
parser.add_option("--install", action="store_const", const="install",
dest="mode",
help="install packages using yum")
+ parser.add_option("--orphanskill", action="store_const", const="orphanskill",
+ dest="mode",
+ help="Kill all processes using specified buildroot.")
parser.add_option("-r", action="store", type="string", dest="chroot",
help="chroot name/config file name default: %default",
@@ -449,8 +452,6 @@ def main(ret):
ret["chroot"] = chroot
ret["config_opts"] = config_opts
os.umask(002)
- if options.mode not in ('chroot', 'shell', 'install', 'installdeps') and config_opts['clean']:
- chroot.clean()
# New namespace starting from here
try:
@@ -459,11 +460,12 @@ def main(ret):
log.info("Namespace unshare failed.")
if options.mode == 'init':
+ if config_opts['clean']:
+ chroot.clean()
chroot.init()
elif options.mode == 'clean':
- if chroot.state() != "clean":
- chroot.clean()
+ chroot.clean()
elif options.mode in ('chroot', 'shell'):
chroot.tryLockBuildRoot()
@@ -503,6 +505,9 @@ def main(ret):
elif options.mode == 'rebuild':
do_rebuild(config_opts, chroot, args)
+ elif options.mode == 'orphanskill':
+ mock.util.orphansKill(chroot.rootdir)
+
if __name__ == '__main__':
# fix for python 2.4 logging module bug: