summaryrefslogtreecommitdiff
path: root/gbp/scripts/import_srpm.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-05-31 09:48:50 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-05 14:20:05 +0300
commit386608bb879ae9a272e2a75f9c9319ecf3bcacce (patch)
treec9878ce41a3f81ff7147672547d4e187b59f8a80 /gbp/scripts/import_srpm.py
parentb4b62db9f4379693d483ca2c2db1ddf6c08e3581 (diff)
downloadgit-buildpackage-386608bb879ae9a272e2a75f9c9319ecf3bcacce.tar.gz
git-buildpackage-386608bb879ae9a272e2a75f9c9319ecf3bcacce.tar.bz2
git-buildpackage-386608bb879ae9a272e2a75f9c9319ecf3bcacce.zip
RpmGitRepository: make version-tag methods more flexible
Simplifies version_to_tag() and find_version() so that all string fields (for the format string) are given in one dict. Now it's easier to add support for new string fields (e.g. commitdate etc). Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Diffstat (limited to 'gbp/scripts/import_srpm.py')
-rwxr-xr-xgbp/scripts/import_srpm.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py
index b8cf5ecd..e58d3fd9 100755
--- a/gbp/scripts/import_srpm.py
+++ b/gbp/scripts/import_srpm.py
@@ -91,11 +91,11 @@ def committer_from_author(author, options):
return committer
-def move_tag_stamp(repo, format, version, vendor):
+def move_tag_stamp(repo, format, tag_str_fields):
"Move tag out of the way appending the current timestamp"
- old = repo.version_to_tag(format, version, vendor)
+ old = repo.version_to_tag(format, tag_str_fields)
new = repo.version_to_tag('%s~%d' % (format, int(time.time())),
- version, vendor)
+ tag_str_fields)
repo.move_tag(old, new)
@@ -275,13 +275,14 @@ def main(argv):
upstream = None
format = [(options.upstream_tag, "Upstream"), (options.packaging_tag, options.vendor)][options.native]
- tag = repo.version_to_tag(format[0], dict(upstreamversion=upstream_version), options.vendor)
+ tag_str_fields = dict(pkgver, vendor=options.vendor)
+ tag = repo.version_to_tag(format[0], tag_str_fields)
- if repo.find_version(options.packaging_tag, pkgver, options.vendor):
+ if repo.find_version(options.packaging_tag, tag_str_fields):
gbp.log.warn("Version %s already imported." % RpmPkgPolicy.compose_full_version(pkgver))
if options.allow_same_version:
gbp.log.info("Moving tag of version '%s' since import forced" % RpmPkgPolicy.compose_full_version(pkgver))
- move_tag_stamp(repo, options.packaging_tag, pkgver, options.vendor)
+ move_tag_stamp(repo, options.packaging_tag, tag_str_fields)
else:
raise SkipImport
@@ -302,7 +303,7 @@ def main(argv):
# Import upstream sources
if upstream:
- upstream_commit = repo.find_version(format[0], dict(upstreamversion=upstream_version), options.vendor)
+ upstream_commit = repo.find_version(format[0], tag_str_fields)
if not upstream_commit:
gbp.log.info("Tag %s not found, importing %s tarball" % (tag, format[1]))
@@ -348,7 +349,8 @@ def main(argv):
"\nAlso check the --create-missing-branches option.")
raise GbpError
- tag = repo.version_to_tag(options.packaging_tag, pkgver, options.vendor)
+ tag_str_fields = dict(pkgver, vendor=options.vendor)
+ tag = repo.version_to_tag(options.packaging_tag, tag_str_fields)
msg = "%s release %s" % (options.vendor, RpmPkgPolicy.compose_full_version(pkgver))
if options.orphan_packaging or not upstream: