-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
While we're in patch-a-thon mode, thought I'd submit this for comment.
While attempting to track down a bizarre bug with elinks, I hacked
mock so that I could get an interactive shell in the chroot
environment. Not useful for everyone, but handy if you want to look at
the environment in which something is failing. Oh and I converted some
prints in my chroot command to use the debug method.
Index: mock.py
===================================================================
RCS file: /cvs/fedora/mock/mock.py,v
retrieving revision 1.43
diff -u -r1.43 mock.py
- --- mock.py 8 May 2006 16:39:53 -0000 1.43
+++ mock.py 11 May 2006 17:04:34 -0000
@@ -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:
Index: src/mock-helper.c
===================================================================
RCS file: /cvs/fedora/mock/src/mock-helper.c,v
retrieving revision 1.7
diff -u -r1.7 mock-helper.c
- --- src/mock-helper.c 14 Jul 2005 18:00:26 -0000 1.7
+++ src/mock-helper.c 11 May 2006 17:04:34 -0000
@@ -25,7 +25,7 @@
static char const * const ALLOWED_ENV[] =
{
"dist",
- - "ftp_proxy", "http_proxy", "https_proxy",
"no_proxy"
+ "ftp_proxy", "http_proxy", "https_proxy",
"no_proxy", "PS1",
};
#define ALLOWED_ENV_SIZE (sizeof (ALLOWED_ENV) / sizeof (ALLOWED_ENV[0]))
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org
iD8DBQFEY3BpHyuj/+TTEp0RAvnBAJ9tqOtxB102szDxsv/QZGbHkF5SFgCg1mCn
QzgvjxfcsjBrfcKXOAg3Efs=
=iMVS
-----END PGP SIGNATURE-----