mock mock.py,1.44,1.45

John Clark Williams (jcwillia) fedora-extras-commits at redhat.com
Fri May 12 20:57:06 UTC 2006


Author: jcwillia

Update of /cvs/fedora/mock
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13432

Modified Files:
	mock.py 
Log Message:
added interactive "shell" command for examining chroots


Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- mock.py	12 May 2006 20:56:30 -0000	1.44
+++ mock.py	12 May 2006 20:57:03 -0000	1.45
@@ -800,13 +800,28 @@
         print 'Finished initializing root'
 
     elif args[0] == 'chroot':
+        # catch-all for executing arbitrary commands in the chroot
         config_opts['clean'] = config_opts['quiet'] = False
-        my= Root(config_opts)
+        my = Root(config_opts)
+        cmd = ' '.join(args[1:])
+        my.debug("executing: %s" % cmd)
         my._mount()
-        my.do_chroot(' '.join(args[1:]), True)
+        my.do_chroot(cmd, True)
         my.close()
-        print 'Finished chroot command'
+        my.debug('finished chroot command')
         
+    elif args[0] == 'shell':
+        # debugging tool for interactive poking around in the chroot
+        config_opts['clean'] = config_opts['quiet'] = False
+        my = Root(config_opts)
+        cmd = "PS1='mock-chroot> ' %s %s /bin/bash" % (config_opts['chroot'],
+                                 my.rootdir)
+        my.debug("executing: %s" % cmd)
+        my._mount()
+        ret = os.system(cmd)
+        my.close()
+        my.debug("finished shell with retval %d" % ret)
+
     else:
         if args[0] == 'rebuild':
             if len(args) > 1:




More information about the fedora-extras-commits mailing list