summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2008-01-04 14:42:58 -0600
committerMichael E Brown <michael_e_brown@dell.com>2008-01-04 14:42:58 -0600
commite964477a73d2ecb233e0e680e8c091a1f884e5a2 (patch)
tree8b635074da50f7471a59c4b11f3be979b5f1f1e4
parent63d55b3e4dcb6485e1658ab846852bfc021b15cb (diff)
downloadmock-e964477a73d2ecb233e0e680e8c091a1f884e5a2.tar.gz
mock-e964477a73d2ecb233e0e680e8c091a1f884e5a2.tar.xz
mock-e964477a73d2ecb233e0e680e8c091a1f884e5a2.zip
split up --target and --arch cmdline options.
-rwxr-xr-xpy/mock.py12
-rw-r--r--py/mock/backend.py6
2 files changed, 13 insertions, 5 deletions
diff --git a/py/mock.py b/py/mock.py
index fee2157..fbe71c2 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -124,8 +124,10 @@ def command_parse(config_opts):
dest="cleanup_after", default=None,
help="Dont clean chroot after building. If automatic"
" cleanup is enabled, use this to disable.", )
- parser.add_option("--target", "--arch", action ="store", dest="arch",
- default=None, help="target build arch")
+ parser.add_option("--arch", action ="store", dest="arch",
+ default=None, help="Use to set kernel personality() to use to build.")
+ parser.add_option("--target", action ="store", dest="rpmbuild_arch",
+ default=None, help="passed to rpmbuild as --target")
parser.add_option("-D", "--define", action="append", dest="rpmmacros",
default=[], type="string", metavar="'MACRO EXPR'",
help="define an rpm macro (may be used more than once)")
@@ -247,6 +249,7 @@ def setup_default_config_opts(config_opts, unprivUid):
config_opts['use_host_resolv'] = True
config_opts['chroot_setup_cmd'] = 'install buildsys-build'
config_opts['target_arch'] = 'i386'
+ config_opts['rpmbuild_arch'] = None # <-- None means set automatically from target_arch
config_opts['yum.conf'] = ''
config_opts['more_buildreqs'] = {}
config_opts['files'] = {}
@@ -262,6 +265,11 @@ def set_config_opts_per_cmdline(config_opts, options, args):
# do some other options and stuff
if options.arch:
config_opts['target_arch'] = options.arch
+ if options.rpmbuild_arch:
+ config_opts['rpmbuild_arch'] = options.rpmbuild_arch
+ elif config_opts['rpmbuild_arch'] is None:
+ config_opts['rpmbuild_arch'] = config_opts['target_arch']
+
if not options.clean:
config_opts['clean'] = options.clean
diff --git a/py/mock/backend.py b/py/mock/backend.py
index f257c7b..0ae7076 100644
--- a/py/mock/backend.py
+++ b/py/mock/backend.py
@@ -37,7 +37,7 @@ class Root(object):
config['root'] = "%s-%s" % (config['root'], config['unique-ext'])
self.basedir = os.path.join(config['basedir'], config['root'])
- self.target_arch = config['target_arch']
+ self.rpmbuild_arch = config['rpmbuild_arch']
self._rootdir = os.path.join(self.basedir, 'root')
self.homedir = config['chroothome']
self.builddir = os.path.join(self.homedir, 'build')
@@ -384,7 +384,7 @@ class Root(object):
chrootspec = spec.replace(self.makeChrootPath(), '') # get rid of rootdir prefix
# Completely/Permanently drop privs while running the following:
self.doChroot(
- "bash --login -c 'rpmbuild -bs --target %s --nodeps %s'" % (self.target_arch, chrootspec),
+ "bash --login -c 'rpmbuild -bs --target %s --nodeps %s'" % (self.rpmbuild_arch, chrootspec),
logger=self.build_log, timeout=timeout,
uidManager=self.uidManager,
uid=self.chrootuid,
@@ -405,7 +405,7 @@ class Root(object):
self._callHooks('prebuild')
self.doChroot(
- "bash --login -c 'rpmbuild -bb --target %s --nodeps %s'" % (self.target_arch, chrootspec),
+ "bash --login -c 'rpmbuild -bb --target %s --nodeps %s'" % (self.rpmbuild_arch, chrootspec),
logger=self.build_log, timeout=timeout,
uidManager=self.uidManager,
uid=self.chrootuid,