--include-uncommited and --include-untracked support
authorZhang Qiang <qiang.z.zhang@intel.com>
Wed, 11 Jul 2012 02:04:45 +0000 (10:04 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 11 Jul 2012 02:04:45 +0000 (10:04 +0800)
Add these two options to build/remotebuild/export:
* --include-uncommited: only use files that are already tracked,
    including changes have not been commited
* --include-untracked: use untracked files, including changes have
    not been commited, and untracked files

gitbuildsys/cmd_build.py
gitbuildsys/cmd_export.py
gitbuildsys/cmd_remotebuild.py
tools/gbs

index d0ae14a620c1c19904aae85f3afc116303cf00af..3bf90bf3bd085b8293c7366224a99877b960ab84 100644 (file)
@@ -377,8 +377,15 @@ def do(opts, args):
     packaging_dir = os.path.join(workdir, 'packaging/')
     export_dir = tempfile.mkdtemp(prefix=packaging_dir + 'build_')
     with utils.Workdir(workdir):
+        if opts.commit:
+            commit = opts.commit
+        elif opts.include_uncommited:
+            commit = 'WC.TRACKED'
+        elif opts.include_untracked:
+            commit = 'WC.UNTRACKED'
+        else:
+            commit = 'HEAD'
         relative_spec = specfile.replace('%s/' % workdir, '')
-        commit = opts.commit or 'HEAD'
         msger.info('export tar ball and packaging files ... ')
         try:
             if gbp_build(["argv[0] placeholder", "--git-export-only",
index ca7e5f025d58114504902c5c64309265d80cb5a5..28ce94a96f75e4d8191043f952d0e83d7b164df2 100644 (file)
@@ -83,7 +83,14 @@ def do(opts, args):
     specfile = utils.guess_spec(workdir, opts.spec)
     export_dir = tempfile.mkdtemp(prefix='gbs_export_', dir=outdir)
     with utils.Workdir(workdir):
-        commit = opts.commit or 'HEAD'
+        if opts.commit:
+            commit = opts.commit
+        elif opts.include_uncommited:
+            commit = 'WC.TRACKED'
+        elif opts.include_untracked:
+            commit = 'WC.UNTRACKED'
+        else:
+            commit = 'HEAD'
         relative_spec = specfile.replace('%s/' % workdir, '')
         try:
             if gbp_build(["argv[0] placeholder", "--git-export-only",
index 7ff5e861871a892ac4f014b6ba2f27a797ffc22c..814ada1839e0f2de4458a4ee63a6a6271b368ea3 100644 (file)
@@ -186,7 +186,14 @@ def do(opts, args):
     localpkg.remove_all()
 
     with utils.Workdir(workdir):
-        commit = opts.commit or 'HEAD'
+        if opts.commit:
+            commit = opts.commit
+        elif opts.include_uncommited:
+            commit = 'WC.TRACKED'
+        elif opts.include_untracked:
+            commit = 'WC.UNTRACKED'
+        else:
+            commit = 'HEAD'
         relative_spec = specfile.replace('%s/' % workdir, '')
         try:
             if gbp_build(["argv[0] placeholder", "--git-export-only",
index 0ac8fc3b123f0af146a417cc0830f60bb56e7308..489743c807243b0367482213175c461ff1972ca8 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -128,6 +128,18 @@ class Gbs(cmdln.Cmdln):
                   default=None,
                   dest='commit',
                   help='Specify a commit ID to export')
+    @cmdln.option('--include-uncommited',
+                  action='store_true',
+                  default=False,
+                  dest='include_uncommited',
+                  help='uncommited changes would be included while '\
+                       'generating tar ball')
+    @cmdln.option('--include-untracked',
+                  action='store_true',
+                  default=False,
+                  dest='include_untracked',
+                  help='untracked files would be included while '\
+                       'generating tar ball')
     def do_export(self, _subcmd, opts, *args):
         """${cmd_name}: export files and prepare for build
 
@@ -200,6 +212,18 @@ class Gbs(cmdln.Cmdln):
                   dest='extra_packs',
                   help='Specify extra packages to install to build root '\
                        'multiple packages can be separated by comma')
+    @cmdln.option('--include-uncommited',
+                  action='store_true',
+                  default=False,
+                  dest='include_uncommited',
+                  help='uncommited changes would be included while '\
+                       'generating tar ball')
+    @cmdln.option('--include-untracked',
+                  action='store_true',
+                  default=False,
+                  dest='include_untracked',
+                  help='untracked files would be included while '\
+                       'generating tar ball')
     @cmdln.option('--debuginfo',
                   action='store_true',
                   default=False,
@@ -288,7 +312,18 @@ class Gbs(cmdln.Cmdln):
                   default=False,
                   dest='status',
                   help='Get build status from build server')
-
+    @cmdln.option('--include-uncommited',
+                  action='store_true',
+                  default=False,
+                  dest='include_uncommited',
+                  help='uncommited changes would be included while '\
+                       'generating tar ball')
+    @cmdln.option('--include-untracked',
+                  action='store_true',
+                  default=False,
+                  dest='include_untracked',
+                  help='untracked files would be included while '\
+                       'generating tar ball')
     def do_remotebuild(self, subcmd, opts, *args):
         """${cmd_name}: remote build package