Add --ccache and --incremental options
authorZhang Qiang <qiang.z.zhang@intel.com>
Tue, 17 Apr 2012 21:58:09 +0000 (05:58 +0800)
committerEd Bartosh <eduard.bartosh@intel.com>
Wed, 16 May 2012 15:00:34 +0000 (18:00 +0300)
Change-Id: I2ea1d17d4421cd3ac4a07809537e83d2e25d15ac

gitbuildsys/cmd_localbuild.py
tools/gbs

index 463cb9ff31367870caaf5bfe8c8cfc0e098d4068..45dc453372f81ed679fe3a7ef6a96c47d1a5505e 100644 (file)
@@ -189,14 +189,14 @@ def do(opts, args):
         msger.error('No package repository specified.')
 
     if opts.noinit:
-        cmd += ['--noinit']
+        cmd += ['--no-init']
+    if opts.ccache:
+        cmd += ['--ccache']
     cmd += [specfile]
 
     if hostarch != buildarch and buildarch in change_personality:
         cmd = [ change_personality[buildarch] ] + cmd;
 
-    msger.info(' '.join(cmd))
-
     if buildarch.startswith('arm'):
         try:
             utils.setup_qemu_emulator()
@@ -224,6 +224,12 @@ def do(opts, args):
     except GbpError, exc:
         msger.error(str(exc))
  
+    if opts.incremental:
+        cmd += ['--rsync-src=%s' % os.path.abspath(workdir)]
+        cmd += ['--rsync-dest=/home/abuild/rpmbuild/BUILD/%s-%s' % (name, version)]
+
+    msger.info(' '.join(cmd))
+
     # runner.show() can't support interactive mode, so use subprocess insterad.
     try:
         rc = subprocess.call(cmd)
index 42b5f83d00d11a79864e10e773da2ed176962776..a6dadf974a1fcc0ae534a2bd83084a41e0124ba1 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -87,6 +87,18 @@ class Gbs(cmdln.Cmdln):
                   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('-I', '--incremental',
+                  action="store_true",
+                  default=False,
+                  dest='incremental',
+                  help='Do incremental build, which need support of spec file,'
+                       ' and tar ball unpack stage should be enabled with the '
+                       'condition of RPM macro RSYNCDONE')
     @cmdln.option('--debuginfo',
                   action='store_true',
                   default=False,