import: support for --upstream-tag option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 18 Oct 2013 08:49:09 +0000 (11:49 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 18 Oct 2013 09:41:28 +0000 (12:41 +0300)
Change-Id: I68538150da79bd34b3e98697ae8bbbb14fd7d1ef
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gitbuildsys/cmd_import.py
tools/gbs

index 67c7d52d8704624f42dc7fcded5b5b379fc8dcf0..1ade47c2264bf8b1d4052b83a38eaa976c679c17 100644 (file)
@@ -19,6 +19,7 @@
 """Implementation of subcmd: import
 """
 import os
+import re
 
 from gitbuildsys.errors import GbsError
 from gitbuildsys.cmd_export import get_packaging_dir
@@ -47,11 +48,18 @@ def main(args):
         upstream_branch = args.upstream_branch
     else:
         upstream_branch = configmgr.get('upstream_branch', 'general')
+    if args.upstream_tag:
+        upstream_tag = args.upstream_tag
+    else:
+        upstream_tag = configmgr.get('upstream_tag', 'general')
+    # transform variables from shell to python convention ${xxx} -> %(xxx)s
+    upstream_tag = re.sub(r'\$\{([^}]+)\}', r'%(\1)s', upstream_tag)
 
     params = ["argv[0] placeholder",
               "--color-scheme=magenta:green:yellow:red",
               "--packaging-dir=%s" % get_packaging_dir(args),
               "--upstream-branch=%s" % upstream_branch, path,
+              "--upstream-tag=%s" % upstream_tag,
               "--tmp-dir=%s" % tmp.path,
               ]
     if args.debug:
index dbdb520bebc6b5d4020dfeaf41feaaedeb97dad3..351b769838953f84937d23fddc32a9ee3800c183 100755 (executable)
--- a/tools/gbs
+++ b/tools/gbs
@@ -47,6 +47,10 @@ def import_parser(parser):
     parser.add_argument('--author-email', help='author email of git commit')
     parser.add_argument('--upstream-branch',
                         help='specify upstream branch for new package version')
+    parser.add_argument('--upstream-tag',
+                        help="upstream tag format, '${upstreamversion}' is "
+                        'expanded to the version in the spec file. '
+                        "E.g. 'v${upstreamversion}'")
     parser.add_argument('--upstream-vcs-tag',
                         help='upstream VCS tag on top of which to import the '
                              'orig sources')