"""
import os
import subprocess
-import pwd
-
-from gitbuildsys import msger
-from gitbuildsys.conf import configmgr
-
-def do(opts, _args):
-
- if opts.arch in ['ia32', 'i686', 'i586', 'i386']:
- arch = 'i686'
- else:
- arch = opts.arch
- if opts.buildroot:
- build_root = opts.buildroot
- else:
- userid = pwd.getpwuid(os.getuid())[0]
- tmpdir = os.path.join(configmgr.get('tmpdir', 'general'), "%s-gbs" %\
- userid)
- build_root = os.path.join(tmpdir, 'gbs-buildroot.%s' % arch)
+
+from gitbuildsys import msger, errors
+
+def do(opts, args):
+
+ if len(args) != 1:
+ raise errors.Usage('no build root directory specified')
+
+ build_root = os.path.abspath(args[0])
running_lock = '%s/not-ready' % build_root
if os.path.exists(running_lock) or not os.path.exists(build_root):
msger.error('build root %s is not ready' % build_root)
if opts.root:
user = 'root'
cmd = ['sudo', 'chroot', build_root, 'su', user]
+
try:
subprocess.call(['sudo', 'cp', '/etc/resolv.conf', build_root + \
'/etc/resolv.conf'])
@cmdln.option('-B', '--buildroot',
default=None,
dest='buildroot',
- help='specify build root to setup chroot environment')
+ help='specify build root to setup chroot environment. '\
+ 'By default, ~/GBS-ROOT/ will be used, and if no ' \
+ '-B option, but TIZEN_BUILD_ROOT env exists, then '\
+ '${TIZEN_BUILD_ROOT} will used as build root')
@cmdln.option('-A', '--arch',
default=None,
dest='arch',
default=False,
dest='root',
help='chroot as root instead of abuild by default')
- @cmdln.option('-A', '--arch',
- default='i586',
- dest='arch',
- help='specify the build root arch')
- @cmdln.option('-B', '--buildroot',
- default=None,
- dest='buildroot',
- help='specify build root directory to chroot')
def do_chroot(self, subcmd, opts, *args):
"""${cmd_name}: chroot to build root
Usage:
- gbs chroot [options]
+ gbs chroot [options] <build root dir>
+
+ Note: The default location of build root located at:
+ ~/GBS-ROOT/local/scratch.{arch}.*, which will be different
+ if -B option specified while running gbs build
${cmd_option_list}
"""