diff options
| author | Michael E Brown <mebrown@michaels-house.net> | 2007-10-18 21:29:48 -0500 |
|---|---|---|
| committer | Michael E Brown <mebrown@michaels-house.net> | 2007-10-18 21:29:48 -0500 |
| commit | a9172fdfdf9811cb84626f0a414668cc2ab03dc4 (patch) | |
| tree | 29c2f1cd7873bf2b5223cd08ea0c42a1f1c23f40 /src | |
| parent | 8a780e16ad87c2ad0ac3494b2254032748093ced (diff) | |
| download | mock-a9172fdfdf9811cb84626f0a414668cc2ab03dc4.tar.gz mock-a9172fdfdf9811cb84626f0a414668cc2ab03dc4.tar.xz mock-a9172fdfdf9811cb84626f0a414668cc2ab03dc4.zip | |
shell and chroot cmds are identical. merge them save LOC. switch to os.system. Yes, it is a layering violation, but hey, it fixes a huge wart in mock.util.do.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/mock.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mock.py b/src/mock.py index d19cc76..41abc48 100755 --- a/src/mock.py +++ b/src/mock.py @@ -195,20 +195,12 @@ def main(): if chroot.state() != "clean": chroot.clean() - elif args[0] == 'chroot': + elif args[0] in ('chroot', 'shell'): chroot.init() chroot._mountall() try: cmd = ' '.join(args[1:]) - output = chroot.doChroot(cmd, env="PS1='mock-chroot> '", interactive=1, raiseExc=0) - finally: - chroot._umountall() - - elif args[0] == 'shell': - chroot.init() - chroot._mountall() - try: - output = chroot.doChroot("/bin/bash", env="PS1='mock-chroot> '", interactive=1, raiseExc=0) + os.system("PS1='mock-chroot> ' /usr/sbin/chroot %s %s" % (chroot.rootdir, cmd)) finally: chroot._umountall() |
