Add --tag option for submit module to support group submission, #596
authorZhang Qiang <qiang.z.zhang@intel.com>
Thu, 17 Jan 2013 22:43:31 +0000 (17:43 -0500)
committerZhang Qiang <qiang.z.zhang@intel.com>
Fri, 18 Jan 2013 22:59:59 +0000 (17:59 -0500)
workflow of group submission:

gbs side:

1) one developer call 'gbs sr' to submit a patch, and he/she told
   other developer the tag name, created by gbs for this submission.
2) other developer use --tag to specified the same tag to submit
   other packages.

backend service:

Creating different OBS build project for different tag, and all submission
with the same tag would be submit to the same OBS project for building.

Release engineer:

All packages in the same OBS build project should be accept at the same
time

Change-Id: I04b838b0c9fc9cf469b814223b43f5bbcde9860e

gitbuildsys/cmd_submit.py
tools/gbs

index c07239f75141ba02241ba69e16ceb7901c1335a8..181e4f1bc6e7bc71fccf90253d0dc888732cd934 100644 (file)
@@ -74,22 +74,25 @@ def main(args):
                        "'origin' as the remote server")
             args.remote = 'origin'
 
-    target = args.target
-    if not target:
-        if upstream and upstream.startswith(args.remote):
-            target = os.path.basename(upstream)
-        else:
-            log.warning("Can't find upstream branch for current branch "
-                          "%s. Gbs uses the local branch name as the target. "
-                          "Please consider to use git-branch --set-upstream "
-                          "to set upstream remote branch." % current_branch)
-            target = current_branch
-
-    if target == 'master':
-        target = 'trunk'
 
-    tagname = 'submit/%s/%s' % (target, time.strftime( \
+    if args.tag:
+        tagname = args.tag
+    else:
+        target = args.target
+        if not target:
+            if upstream and upstream.startswith(args.remote):
+                target = os.path.basename(upstream)
+            else:
+                log.warning("Can't find upstream branch for current branch "
+                            "%s. Gbs uses the local branch name as the target. "
+                            "Please consider to use git-branch --set-upstream "
+                            "to set upstream remote branch." % current_branch)
+                target = current_branch
+        if target == 'master':
+            target = 'trunk'
+        tagname = 'submit/%s/%s' % (target, time.strftime( \
                                     '%Y%m%d.%H%M%S', time.gmtime()))
+
     log.info('creating tag: %s' % tagname)
     try:
         repo.create_tag(tagname, msg=message, commit=commit, sign=args.sign,
index 5287172f56a3152492c966b91d63850b8bd5964a..6287107170b1dc9191d65cbbf77b7964ffbd4f35 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -362,6 +362,9 @@ def submit_parser(parser):
                         default=os.getcwd(),
                         help='path to git repository')
 
+    parser.add_argument('--tag', help='create tag using specified tag name. '
+                        'This option can be used for group submission, and '
+                        'submissions with same tag can be seen as one group')
     parser.add_argument('-m', '--msg', help='specify tag message info')
     parser.add_argument('-c', '--commit', default='HEAD',
                         help='specify a commit ID to submit')