diff options
author | dcbw <dcbw> | 2005-06-21 17:48:06 +0000 |
---|---|---|
committer | dcbw <dcbw> | 2005-06-21 17:48:06 +0000 |
commit | bf21e37fbedb0d9f1047cf1c96b7a3073f717137 (patch) | |
tree | bd837bb737ce47fcafc597f5e44998589bd2ec7f | |
parent | 16ca74c8b32374a1e1c051eac08b237265514e17 (diff) | |
download | mock-bf21e37fbedb0d9f1047cf1c96b7a3073f717137.tar.gz mock-bf21e37fbedb0d9f1047cf1c96b7a3073f717137.tar.xz mock-bf21e37fbedb0d9f1047cf1c96b7a3073f717137.zip |
Make statedir function correctly, add newlines to config dump file
-rw-r--r-- | mock.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -49,13 +49,16 @@ class Root: self.basedir = '%s/%s' % (config['basedir'], config['root']) self.target_arch = config['target_arch'] self.rootdir = os.path.join(self.basedir, 'root') - self.statedir = os.path.join(self.basedir, 'state') self.homedir = self.config['chroothome'] self.builddir = os.path.join(self.homedir, 'build') if not self.config.has_key('resultdir'): self.resultdir = os.path.join(self.basedir, 'result') else: self.resultdir = self.config['resultdir'] + if not self.config.has_key('statedir'): + self.statedir = os.path.join(self.basedir, 'state') + else: + self.statedir = self.config['statedir'] if config['clean']: self.clean() @@ -74,9 +77,9 @@ class Root: # write out the config file cfg_log = os.path.join(self.resultdir, 'mockconfig.log') cfgout = open(cfg_log, 'w+') - cfgout.write('rootdir = %s' % self.rootdir) - cfgout.write('resultdir = %s' % self.resultdir) - cfgout.write('statedir = %s' % self.statedir) + cfgout.write('rootdir = %s\n' % self.rootdir) + cfgout.write('resultdir = %s\n' % self.resultdir) + cfgout.write('statedir = %s\n' % self.statedir) cfgout.close() @@ -131,7 +134,7 @@ class Root: if retval != 0: error("Errors cleaning out chroot: %s" % output) - if os.path.exists(self.rootdir) or os.path.exists(self.statedir): + if os.path.exists(self.rootdir): raise Error, "Failed to clean basedir, exiting" @@ -685,7 +688,7 @@ def main(): config_opts['resultdir'] = options.resultdir if options.statedir: - config_opts['statedir'] = options.resultdir + config_opts['statedir'] = options.statedir try: |