Use build-experimental to replace build module
authorZhang Qiang <qiang.z.zhang@intel.com>
Wed, 19 Sep 2012 02:19:08 +0000 (10:19 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 19 Sep 2012 03:30:29 +0000 (11:30 +0800)
We have tested new new build module 'build-experimental' for several
circles, and its compartiable with build module, no any regression
issue, so let's use this module to replace current build module.

Change-Id: I58ea77cb86f21d32a5819bb0213291e407f810e5

gitbuildsys/cmd_build.py
gitbuildsys/cmd_localbuild.py [deleted file]
tools/gbs

index 5daaee4add70d548d6e762d4855a839e709fc2ca..fd87decd19ed35e9a400c592919c81e2974a0e4d 100644 (file)
 import os
 import subprocess
 import tempfile
-import glob
 import shutil
 import pwd
 
 from gitbuildsys import msger, utils, runner, errors
 from gitbuildsys.conf import configmgr
 from gitbuildsys.safe_url import SafeURL
-from gitbuildsys.cmd_export import export_sources
 
 from gbp.rpm.git import GitRepositoryError, RpmGitRepository
-import gbp.rpm as rpm
-from gbp.errors import GbpError
 
 CHANGE_PERSONALITY = {
             'i686':  'linux32',
@@ -46,10 +42,10 @@ CHANGE_PERSONALITY = {
           }
 
 BUILDARCHMAP = {
-            'ia32':     'i686',
-            'i686':     'i686',
-            'i586':     'i686',
-            'i386':     'i686',
+            'ia32':     'i586',
+            'i686':     'i586',
+            'i586':     'i586',
+            'i386':     'i586',
           }
 
 SUPPORTEDARCHS = [
@@ -63,6 +59,97 @@ SUPPORTEDARCHS = [
             'armv7l',
           ]
 
+def prepare_repos_and_build_conf(opts, arch):
+    '''generate repos and build conf options for depanneur'''
+
+    cmd_opts = []
+    userid     = pwd.getpwuid(os.getuid())[0]
+    tmpdir     = os.path.join(configmgr.get('tmpdir', 'general'),
+                              '%s-gbs' % userid)
+    cache = utils.Temp(prefix=os.path.join(tmpdir, 'gbscache'),
+                       directory=True)
+    cachedir  = cache.path
+    if not os.path.exists(cachedir):
+        os.makedirs(cachedir)
+    msger.info('generate repositories ...')
+
+    if opts.skip_conf_repos:
+        repos = []
+    else:
+        repos = [i.url for i in configmgr.get_current_profile().repos]
+
+    if opts.repositories:
+        for i in opts.repositories:
+            try:
+                opt_repo = SafeURL(i)
+            except ValueError, err:
+                msger.warning('Invalid repo %s: %s' % (i, str(err)))
+            else:
+                repos.append(opt_repo)
+
+    if not repos:
+        msger.error('No package repository specified.')
+
+    repoparser = utils.RepoParser(repos, cachedir)
+    repourls = repoparser.get_repos_by_arch(arch)
+    if not repourls:
+        msger.error('no available repositories found for arch %s under the '
+                    'following repos:\n%s' % (arch, '\n'.join(repos)))
+    cmd_opts += [('--repository=%s' % url.full) for url in repourls]
+
+    if opts.dist:
+        distconf = opts.dist
+    else:
+        if repoparser.buildconf is None:
+            msger.warning('failed to get build conf, use default')
+            distconf = configmgr.get('distconf', 'build')
+        else:
+            shutil.copy(repoparser.buildconf, tmpdir)
+            distconf = os.path.join(tmpdir, os.path.basename(\
+                                    repoparser.buildconf))
+            msger.info('build conf has been downloaded at:\n      %s' \
+                       % distconf)
+
+    if distconf is None:
+        msger.error('No build config file specified, please specify in '\
+                    '~/.gbs.conf or command line using -D')
+    target_conf = os.path.basename(distconf).replace('-', '')
+    os.rename(distconf, os.path.join(os.path.dirname(distconf), target_conf))
+    dist = target_conf.rsplit('.', 1)[0]
+    cmd_opts += ['--dist=%s' % dist]
+    cmd_opts += ['--configdir=%s' % os.path.dirname(distconf)]
+
+    return cmd_opts
+
+def prepare_depanneur_opts(opts):
+    '''generate extra options for depanneur'''
+
+    cmd_opts = []
+    if opts.exclude:
+        cmd_opts += ['--exclude=%s' % i for i in opts.exclude]
+    if opts.exclude_from_file:
+        cmd_opts += ['--exclude-from-file=%s' % opts.exclude_from_file]
+    if opts.overwrite:
+        cmd_opts += ['--overwrite']
+    if opts.clean_once:
+        cmd_opts += ['--clean-once']
+    if opts.debug:
+        cmd_opts += ['--debug']
+    if opts.incremental:
+        cmd_opts += ['--incremental']
+    if opts.keepgoing:
+        cmd_opts += ['--keepgoing']
+    if opts.no_configure:
+        cmd_opts += ['--no-configure']
+    if opts.binary_list:
+        if not os.path.exists(opts.binary_list):
+            msger.error('specified binary list file %s not exists' %\
+                        opts.binary_list)
+        cmd_opts += ['--binary=%s' % opts.binary_list]
+    cmd_opts += ['--threads=%s' % opts.threads]
+
+    return cmd_opts
+
 def get_processors():
     """
     get number of processors (online) based on
@@ -74,12 +161,18 @@ def get_processors():
         return 1
 
 def get_hostarch():
+    """
+    get arch of host
+    """
     hostarch = os.uname()[4]
     if hostarch == 'i686':
         hostarch = 'i586'
     return hostarch
 
 def find_binary_path(binary):
+    """
+    return full path of specified binary file
+    """
     if os.environ.has_key("PATH"):
         paths = os.environ["PATH"].split(":")
     else:
@@ -96,9 +189,15 @@ def find_binary_path(binary):
     return None
 
 def is_statically_linked(binary):
+    """
+    check if binary is statically linked
+    """
     return ", statically linked, " in runner.outs(['file', binary])
 
 def setup_qemu_emulator():
+    """
+    setup qemu emulator env using system static qemu
+    """
     # mount binfmt_misc if it doesn't exist
     if not os.path.exists("/proc/sys/fs/binfmt_misc"):
         modprobecmd = find_binary_path("modprobe")
@@ -158,17 +257,11 @@ def setup_qemu_emulator():
 
     return qemu_emulator
 
-def get_env_proxies():
-    proxies = []
-    for name, value in os.environ.items():
-        name = name.lower()
-        if value and name.endswith('_proxy'):
-            proxies.append('%s=%s' % (name, value))
-    return proxies
-
 
 def do(opts, args):
-
+    """
+    Main of build module
+    """
     workdir = os.getcwd()
     if len(args) > 1:
         msger.error('only one work directory can be specified in args.')
@@ -179,19 +272,11 @@ def do(opts, args):
         raise errors.Usage('--commit can\'t be specified together with '\
                            '--include-all')
 
-    if opts.out:
-        if not os.path.exists(opts.out):
-            msger.error('Output directory %s doesn\'t exist' % opts.out)
-        if not os.path.isdir(opts.out):
-            msger.error('%s is not a directory' % opts.out)
-
     try:
         repo = RpmGitRepository(workdir)
-    except GitRepositoryError, err:
-        msger.error(str(err))
-
-    utils.git_status_checker(repo, opts)
-    workdir = repo.path
+        workdir = repo.path
+    except GitRepositoryError:
+        pass
 
     hostarch = get_hostarch()
     if opts.arch:
@@ -206,150 +291,67 @@ def do(opts, args):
         msger.error('arch %s not supported, supported archs are: %s ' % \
                    (buildarch, ','.join(SUPPORTEDARCHS)))
 
-    build_cmd  = configmgr.get('build_cmd', 'build')
-    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' % buildarch)
+    build_root = os.path.expanduser('~/GBS-ROOT/')
     if opts.buildroot:
         build_root = opts.buildroot
-    cmd = [ build_cmd,
-            '--root='+build_root,
-            '--arch='+buildarch ]
 
-    if os.path.exists(os.path.join(build_root, 'not-ready')):
-        cmd += ['--clean']
+    # get virtual env from system env first
+    if 'VIRTUAL_ENV' not in os.environ:
+        os.environ['VIRTUAL_ENV'] = '/'
+
+    if 'TIZEN_BUILD_ROOT' not in os.environ:
+        os.environ['TIZEN_BUILD_ROOT'] = build_root
+
+    cmd = ['%s/usr/bin/depanneur' % os.environ['VIRTUAL_ENV']]
+    cmd += ['--arch=%s' % buildarch]
 
-    build_jobs = get_processors()
-    if build_jobs > 1:
-        cmd += ['--jobs=%s' % build_jobs]
-    if opts.clean and '--clean' not in cmd:
+    if opts.clean:
         cmd += ['--clean']
 
-    if opts.noinit:
-        cmd += ['--no-init']
-    else:
-        # check & prepare repos and build conf if no noinit option
-        cache = utils.Temp(prefix=os.path.join(tmpdir, 'gbscache'),
-                           directory=True)
-        cachedir  = cache.path
-        if not os.path.exists(cachedir):
-            os.makedirs(cachedir)
-        msger.info('generate repositories ...')
-
-        if opts.skip_conf_repos:
-            repos = []
-        else:
-            repos = [i.url for i in configmgr.get_current_profile().repos]
-
-        if opts.repositories:
-            for i in opts.repositories:
-                try:
-                    opt_repo = SafeURL(i)
-                except ValueError, err:
-                    msger.warning('Invalid repo %s: %s' % (i, str(err)))
-                else:
-                    repos.append(opt_repo)
-
-        if not repos:
-            msger.error('No package repository specified.')
-
-        repoparser = utils.RepoParser(repos, cachedir)
-        repourls = repoparser.get_repos_by_arch(buildarch)
-        if not repourls:
-            msger.error('no available repositories found for arch %s under the '
-                        'following repos:\n%s' % (buildarch, '\n'.join(repos)))
-        cmd += [('--repository=%s' % url.full) for url in repourls]
-
-        if opts.dist:
-            distconf = opts.dist
-        else:
-            if repoparser.buildconf is None:
-                msger.warning('failed to get build conf, '
-                              'use default build conf')
-                distconf = configmgr.get('distconf', 'build')
-            else:
-                shutil.copy(repoparser.buildconf, tmpdir)
-                distconf = os.path.join(tmpdir, os.path.basename(\
-                                        repoparser.buildconf))
-                msger.info('build conf has been downloaded at:\n      %s' \
-                           % distconf)
+    # check & prepare repos and build conf
+    cmd += prepare_repos_and_build_conf(opts, buildarch)
 
-        if distconf is None:
-            msger.error('No build config file specified, please specify in '\
-                        '~/.gbs.conf or command line using -D')
-        cmd += ['--dist=%s' % distconf]
+    cmd += ['--path=%s' % workdir]
 
     if opts.ccache:
         cmd += ['--ccache']
 
     if opts.extra_packs:
-        extrapkgs = opts.extra_packs.split(',')
-        cmd += ['--extra-packs=%s' % ' '.join(extrapkgs)]
+        cmd += ['--extra-packs=%s' % opts.extra_packs]
 
     if hostarch != buildarch and buildarch in CHANGE_PERSONALITY:
         cmd = [ CHANGE_PERSONALITY[buildarch] ] + cmd
 
-    proxies = get_env_proxies()
-
     if buildarch.startswith('arm'):
         try:
             setup_qemu_emulator()
-            cmd += ['--use-system-qemu']
         except errors.QemuError, exc:
             msger.error('%s' % exc)
 
-    # Only guess spec filename here, parse later when we have the correct
-    # spec file at hand
-    specfile = utils.guess_spec(workdir, opts.spec)
-    tmpd = utils.Temp(prefix=os.path.join(tmpdir, '.gbs_build'), directory=True)
-    export_dir = tmpd.path
-    with utils.Workdir(workdir):
-        if opts.commit:
-            commit = opts.commit
-        elif opts.include_all:
-            commit = 'WC.UNTRACKED'
-        else:
-            commit = 'HEAD'
-        relative_spec = specfile.replace('%s/' % workdir, '')
-        msger.info('export tar ball and packaging files ... ')
-        export_sources(repo, commit, export_dir, relative_spec, opts)
-
-    # Parse spec file
-    try:
-        spec = rpm.parse_spec(os.path.join(export_dir,
-                                           os.path.basename(specfile)))
-    except GbpError, err:
-        msger.error('%s' % err)
-
-    if not spec.name or not spec.version:
-        msger.error('can\'t get correct name or version from spec file.')
-
-    cmd += [spec.specfile]
-
-    # if current user is root, don't run with sucmd
-    if os.getuid() != 0:
-        cmd = ['sudo'] + proxies + cmd
-
-    # runner.show() can't support interactive mode, so use subprocess insterad.
-    msger.debug("running command %s" % cmd)
-    try:
-        if subprocess.call(cmd):
-            msger.error('rpmbuild fails')
-        else:
-            out_dir = os.path.join(build_root, 'home/abuild/rpmbuild/RPMS/')
-            if opts.out:
-                for fpath in glob.glob(out_dir + '/*/*.rpm'):
-                    shutil.copy(fpath, opts.out)
-                msger.info('RPMs have been copied from %s to %s' \
-                           % (out_dir, opts.out))
-                out_dir = os.path.abspath(opts.out)
-                subprocess.call(["createrepo", out_dir])
-                msger.info("RPM repo has been created: %s" % out_dir)
-            msger.info('The buildroot was: %s' % build_root)
-            msger.info('Binaries RPM packages can be found here:'\
-                       '\n     %s' % out_dir)
-            msger.info('Done')
-    except KeyboardInterrupt:
-        msger.info('keyboard interrupt, killing build ...')
-        subprocess.call(cmd + ["--kill"])
-        msger.error('interrupt from keyboard')
+    # Extra depanneur special command options
+    cmd += prepare_depanneur_opts(opts)
+
+    # Extra options for gbs export
+    if opts.include_all:
+        cmd += ['--include-all']
+    if opts.commit:
+        cmd += ['--commit=%s' % opts.commit]
+    if opts.upstream_branch:
+        cmd += ['--upstream-branch']
+    if opts.upstream_tag:
+        cmd += ['--upstream-tag']
+    if opts.squash_patches_until:
+        cmd += ['--squash-patches-until']
+
+    msger.debug("running command: %s" % ' '.join(cmd))
+    if subprocess.call(cmd):
+        msger.error('rpmbuild fails')
+    else:
+        dist = [opt[len('--dist='):] for opt in cmd \
+                                     if opt.startswith('--dist=')][0]
+        repodir = os.path.join(build_root, 'local', 'repos', dist)
+        msger.info('generated RPM packages can be found from local repo:'\
+                   '\n     %s' % repodir)
+        msger.info('build roots located in:\n     %s' % \
+                   os.path.join(build_root, 'local', 'scratch.{arch}.*'))
+        msger.info('Done')
diff --git a/gitbuildsys/cmd_localbuild.py b/gitbuildsys/cmd_localbuild.py
deleted file mode 100644 (file)
index 978ad1d..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-#!/usr/bin/python -tt
-# vim: ai ts=4 sts=4 et sw=4
-#
-# Copyright (c) 2012 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Implementation of subcmd: localbuild
-"""
-
-import os
-import re
-import subprocess
-import shutil
-import pwd
-
-from gitbuildsys import msger, utils, errors
-from gitbuildsys.conf import configmgr
-from gitbuildsys.safe_url import SafeURL
-
-from gbp.rpm.git import GitRepositoryError, RpmGitRepository
-from gitbuildsys.cmd_build import get_hostarch, setup_qemu_emulator
-
-CHANGE_PERSONALITY = {
-            'i686':  'linux32',
-            'i586':  'linux32',
-            'i386':  'linux32',
-            'ppc':   'powerpc32',
-            's390':  's390',
-            'sparc': 'linux32',
-            'sparcv8': 'linux32',
-          }
-
-BUILDARCHMAP = {
-            'ia32':     'i586',
-            'i686':     'i586',
-            'i586':     'i586',
-            'i386':     'i586',
-          }
-
-SUPPORTEDARCHS = [
-            'ia32',
-            'i686',
-            'i586',
-            'armv7hl',
-            'armv7el',
-            'armv7tnhl',
-            'armv7nhl',
-            'armv7l',
-          ]
-
-def prepare_repos_and_build_conf(opts, arch):
-    '''generate repos and build conf options for depanneur'''
-
-    cmd_opts = []
-    userid     = pwd.getpwuid(os.getuid())[0]
-    tmpdir     = os.path.join(configmgr.get('tmpdir', 'general'),
-                              '%s-gbs' % userid)
-    cache = utils.Temp(prefix=os.path.join(tmpdir, 'gbscache'),
-                       directory=True)
-    cachedir  = cache.path
-    if not os.path.exists(cachedir):
-        os.makedirs(cachedir)
-    msger.info('generate repositories ...')
-
-    if opts.skip_conf_repos:
-        repos = []
-    else:
-        repos = [i.url for i in configmgr.get_current_profile().repos]
-
-    if opts.repositories:
-        repos.extend([ SafeURL(i) for i in opts.repositories ])
-    if not repos:
-        msger.error('No package repository specified.')
-
-    repoparser = utils.RepoParser(repos, cachedir)
-    repourls = repoparser.get_repos_by_arch(arch)
-    if not repourls:
-        msger.error('no repositories found for arch: %s under the '\
-                    'following repos:\n      %s' % \
-                    (arch, '\n'.join(repos)))
-    for url in repourls:
-        if not  re.match('https?://.*', url) and \
-           not (url.startswith('/') and os.path.exists(url)):
-            msger.error("Invalid repo url: %s" % url)
-        cmd_opts += ['--repository=%s' % url.full]
-
-    if opts.dist:
-        distconf = opts.dist
-    else:
-        if repoparser.buildconf is None:
-            msger.warning('failed to get build conf, use default')
-            distconf = configmgr.get('distconf', 'build')
-        else:
-            shutil.copy(repoparser.buildconf, tmpdir)
-            distconf = os.path.join(tmpdir, os.path.basename(\
-                                    repoparser.buildconf))
-            msger.info('build conf has been downloaded at:\n      %s' \
-                       % distconf)
-
-    if distconf is None:
-        msger.error('No build config file specified, please specify in '\
-                    '~/.gbs.conf or command line using -D')
-    target_conf = os.path.basename(distconf).replace('-', '')
-    os.rename(distconf, os.path.join(os.path.dirname(distconf), target_conf))
-    dist = target_conf.rsplit('.', 1)[0]
-    cmd_opts += ['--dist=%s' % dist]
-    cmd_opts += ['--configdir=%s' % os.path.dirname(distconf)]
-
-    return cmd_opts
-
-def prepare_depanneur_opts(opts):
-    '''generate extra options for depanneur'''
-
-    cmd_opts = []
-    if opts.exclude:
-        cmd_opts += ['--exclude=%s' % i for i in opts.exclude]
-    if opts.exclude_from_file:
-        cmd_opts += ['--exclude-from-file=%s' % opts.exclude_from_file]
-    if opts.overwrite:
-        cmd_opts += ['--overwrite']
-    if opts.clean_once:
-        cmd_opts += ['--clean-once']
-    if opts.debug:
-        cmd_opts += ['--debug']
-    if opts.incremental:
-        cmd_opts += ['--incremental']
-    if opts.keepgoing:
-        cmd_opts += ['--keepgoing']
-    if opts.no_configure:
-        cmd_opts += ['--no-configure']
-    if opts.binary_list:
-        if not os.path.exists(opts.binary_list):
-            msger.error('specified binary list file %s not exists' %\
-                        opts.binary_list)
-        cmd_opts += ['--binary=%s' % opts.binary_list]
-    cmd_opts += ['--threads=%s' % opts.threads]
-
-    return cmd_opts
-
-def do(opts, args):
-
-    workdir = os.getcwd()
-    if len(args) > 1:
-        msger.error('only one work directory can be specified in args.')
-    if len(args) == 1:
-        workdir = os.path.abspath(args[0])
-
-    if opts.commit and opts.include_all:
-        raise errors.Usage('--commit can\'t be specified together with '\
-                           '--include-all')
-
-    try:
-        repo = RpmGitRepository(workdir)
-        workdir = repo.path
-    except GitRepositoryError:
-        pass
-
-    hostarch = get_hostarch()
-    if opts.arch:
-        buildarch = opts.arch
-    else:
-        buildarch = hostarch
-        msger.info('No arch specified, using system arch: %s' % hostarch)
-    if buildarch in BUILDARCHMAP:
-        buildarch = BUILDARCHMAP[buildarch]
-
-    if not buildarch in SUPPORTEDARCHS:
-        msger.error('arch %s not supported, supported archs are: %s ' % \
-                   (buildarch, ','.join(SUPPORTEDARCHS)))
-
-    build_root = os.path.expanduser('~/GBS-ROOT/')
-    if opts.buildroot:
-        build_root = opts.buildroot
-
-    # get virtual env from system env first
-    if 'VIRTUAL_ENV' not in os.environ:
-        os.environ['VIRTUAL_ENV'] = '/'
-
-    if 'TIZEN_BUILD_ROOT' not in os.environ:
-        os.environ['TIZEN_BUILD_ROOT'] = build_root
-
-    cmd = ['%s/usr/bin/depanneur' % os.environ['VIRTUAL_ENV']]
-    cmd += ['--arch=%s' % buildarch]
-
-    if opts.clean:
-        cmd += ['--clean']
-
-    # check & prepare repos and build conf
-    cmd += prepare_repos_and_build_conf(opts, buildarch)
-
-    cmd += ['--path=%s' % workdir]
-
-    if opts.ccache:
-        cmd += ['--ccache']
-
-    if opts.extra_packs:
-        cmd += ['--extra-packs=%s' % opts.extra_packs]
-
-    if hostarch != buildarch and buildarch in CHANGE_PERSONALITY:
-        cmd = [ CHANGE_PERSONALITY[buildarch] ] + cmd
-
-    if buildarch.startswith('arm'):
-        try:
-            setup_qemu_emulator()
-        except errors.QemuError, exc:
-            msger.error('%s' % exc)
-
-    # Extra depanneur special command options
-    cmd += prepare_depanneur_opts(opts)
-
-    # Extra options for gbs export
-    if opts.include_all:
-        cmd += ['--include-all']
-    if opts.commit:
-        cmd += ['--commit=%s' % opts.commit]
-
-    msger.debug("running command: %s" % ' '.join(cmd))
-    if subprocess.call(cmd):
-        msger.error('rpmbuild fails')
-    else:
-        dist = [opt[len('--dist='):] for opt in cmd \
-                                     if opt.startswith('--dist=')][0]
-        repodir = os.path.join(build_root, 'local', 'repos', dist)
-        msger.info('generated RPM packages can be found from local repo:'\
-                   '\n     %s' % repodir)
-        msger.info('build roots located in:\n     %s' % \
-                   os.path.join(build_root, 'local', 'scratch.{arch}.*'))
-        msger.info('Done')
index 0bb3b05ef015863ea7cac0ae3dcc7e9990d39958..b7b3db91bd15df0091df2fc05ab8cdf79c73689c 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -181,7 +181,7 @@ class Gbs(cmdln.Cmdln):
         from gitbuildsys import cmd_export as cmd
         cmd.do(opts, args)
 
-    @cmdln.alias('build-experimental')
+    @cmdln.alias('lb')
     @cmdln.option('-D', '--dist',
                   default=None,
                   dest='dist',
@@ -237,6 +237,21 @@ class Gbs(cmdln.Cmdln):
                   dest='include_all',
                   help='uncommitted changes and untracked files would be '\
                        'included while generating tar ball')
+    @cmdln.option('--upstream-branch',
+                  default=None,
+                  dest='upstream_branch',
+                  help='upstream branch')
+    @cmdln.option('--upstream-tag',
+                  default=None,
+                  dest='upstream_tag',
+                  help="upstream tag format, e.g. 'v${upstreamversion}'")
+    @cmdln.option('--squash-patches-until',
+                  default=None,
+                  dest='squash_patches_until',
+                  help="when generating patches, squash patches up to given "\
+                       "commit-ish into one monolithic diff file. Format is "\
+                       "the commit-ish optionally followed by a colon and "\
+                       "diff filename base.")
 
     # depanneur special options
     @cmdln.option('--clean-once',
@@ -304,14 +319,14 @@ class Gbs(cmdln.Cmdln):
                        'spec to be refereneced using the %configure, %reconfigre '\
                        'and %autogen macros')
 
-    def do_build_experimental(self, _subcmd, opts, *args):
-        """${cmd_name}: experimental version of local build package
+    def do_build(self, _subcmd, opts, *args):
+        """${cmd_name}: local build package
 
         Usage:
-            gbs build-experimental -R repository [options] [package git dir]
+            gbs build -R repository [options] [package git dir]
 
             [package git dir] is optional, if not specified, current dir would
-            be used.
+            be used, and all packages in this dir would be scheduled to be built.
 
         Examples:
             $ mkdir tizen-packages
@@ -329,113 +344,6 @@ class Gbs(cmdln.Cmdln):
         ${cmd_option_list}
         """
 
-        from gitbuildsys import cmd_localbuild as cmd
-        cmd.do(opts, args)
-    @cmdln.alias('lb')
-    @cmdln.option('-D', '--dist',
-                  default=None,
-                  dest='dist',
-                  help='specify distribution configuration file, which should ' \
-                       'be a full path')
-    @cmdln.option('-R', '--repository',
-                  action="callback",
-                  default=None,
-                  type='string',
-                  dest='repositories',
-                  callback=handle_repository,
-                  help='specify package repositories, only rpm-md format ' \
-                       'is supported')
-    @cmdln.option('-B', '--buildroot',
-                  default=None,
-                  dest='buildroot',
-                  help='specify build root to setup chroot environment')
-    @cmdln.option('-A', '--arch',
-                  default=None,
-                  dest='arch',
-                  help='build target arch ')
-    @cmdln.option('-C', '--clean',
-                  action='store_true',
-                  default=False,
-                  dest='clean',
-                  help='delete old build root before initialization')
-    @cmdln.option('--noinit',
-                  action='store_true',
-                  default=False,
-                  dest='noinit',
-                  help='skip initialization of build root and start ' \
-                       'with build immediately')
-    @cmdln.option('--ccache',
-                  action="store_true",
-                  default=False,
-                  dest='ccache',
-                  help='use ccache to speed up rebuilds')
-    @cmdln.option('--skip-conf-repos',
-                  action="store_true",
-                  default=False,
-                  dest='skip_conf_repos',
-                  help='skip repositories mentioned in config file')
-    @cmdln.option('-c', '--commit',
-                  default=None,
-                  dest='commit',
-                  help='specify a commit ID to build')
-    @cmdln.option('--spec',
-                  default=None,
-                  dest='spec',
-                  help='specify a spec file to use')
-    @cmdln.option('--extra-packs',
-                  default=None,
-                  dest='extra_packs',
-                  help='specify extra packages to install to build root '\
-                       'multiple packages can be separated by comma')
-    @cmdln.option('--include-all',
-                  action='store_true',
-                  default=False,
-                  dest='include_all',
-                  help='uncommitted changes and untracked files would be '\
-                       'included while generating tar ball')
-    @cmdln.option('--out',
-                  default=None,
-                  dest='out',
-                  help='output directory for RPMs')
-    @cmdln.option('--upstream-branch',
-                  default=None,
-                  dest='upstream_branch',
-                  help='Upstream branch')
-    @cmdln.option('--upstream-tag',
-                  default=None,
-                  dest='upstream_tag',
-                  help="Upstream tag format, e.g. 'v${upstreamversion}'")
-    @cmdln.option('--squash-patches-until',
-                  default=None,
-                  dest='squash_patches_until',
-                  help="When generating patches, squash patches up to given "\
-                       "commit-ish into one monolithic diff file. Format is "\
-                       "the commit-ish optionally followed by a colon and "\
-                       "diff filename base.")
-    def do_build(self, _subcmd, opts, *args):
-        """${cmd_name}: local build package
-
-        Usage:
-            gbs build -R repository -A ARCH [options] [package git dir]
-
-            [package git dir] is optional, if not specified, current dir would
-            be used.
-
-        Examples:
-            gbs build -R http://example1.org/packages/ \\
-                      -R http://example2.org/packages/ \\
-                      -A i586                          \\
-                      -D /usr/share/gbs/tizen-1.0.conf
-
-        Note:
-
-        If -D not specified, distconf key in ~/.gbs.conf would be used.
-        If distconf key is None, dist conf file would be got from OBS
-        project (Tizen:Main by default).
-
-        ${cmd_option_list}
-        """
-
         from gitbuildsys import cmd_build as cmd
         cmd.do(opts, args)