commit e9df74745fb662caa1fd1cea4ca495b81b5e908e (HEAD -> master, tag: v1.0)
Author: Nishanth Aravamudan <nish.aravamudan@canonical.com>
Date: Mon Oct 17 17:25:27 2016 -0700
usd-import: add support for passing repository version to importer
In order to annotate the tags with the version, use the `git describe`
output as a first step.
Signed-off-by: Nishanth Aravamudan <nish.aravamudan@canonical.com>
diff --git a/usd-import b/usd-import
index 5b25eef..359bf2b 100755
--- a/usd-import
+++ b/usd-import
@@ -2,10 +2,13 @@
if __name__ == '__main__':
try:
+ import subprocess
import sys
import usd.importer
- usd.importer.main()
+ version = subprocess.check_output(['git', 'describe'])
+
+ usd.importer.main(version)
except KeyboardInterrupt:
sys.stderr.write('User abort\n')
sys.exit(130)
diff --git a/usd/importer.py b/usd/importer.py
index 4292f8b..8676df3 100755
--- a/usd/importer.py
+++ b/usd/importer.py
@@ -341,7 +341,7 @@ class USDGitRepository:
check=True,
env=self._env)
- def commit_import(self, publish_parent_commit, changelog_parent_commit, tree_hash, spi, patch_overrides):
+ def commit_import(self, publish_parent_commit, changelog_parent_commit, tree_hash, spi, patch_overrides, importer_version):
tag = None
_, _, pretty_head_name = spi.head_name.partition('importer/')
@@ -421,7 +421,7 @@ class USDGitRepository:
# should be annotated to use create_tag API
logging.info('Creating tag %s pointing to %s', tag, commit_hash)
subprocess.run(
- ['git', 'tag', tag, commit_hash],
+ ['git', 'tag', '-a', '-m', 'usd-import v%s' % importer_version, tag, commit_hash],
check=True,
env=self._env)
@@ -529,7 +529,7 @@ class USDGitRepository:
return cp
# imports a package based upon source package information
- def import_spi(self, spi, parent_overrides, patch_overrides):
+ def import_spi(self, spi, parent_overrides, patch_overrides, importer_version):
srcpkg = spi.archive_srcpkg
_, _, pretty_head_name = spi.head_name.partition('importer/')
@@ -781,7 +781,7 @@ class USDGitRepository:
tag = self.import_tag(spi.version)
logging.info('Creating tag %s pointing to %s', tag, commit_hash)
subprocess.run(
- ['git', 'tag', self.import_tag(spi.version), commit_hash],
+ ['git', 'tag', '-a', '-m', 'usd-import v%s' % importer_version, self.import_tag(spi.version), commit_hash],
check=True,
env=self._env)
return
@@ -798,7 +798,8 @@ class USDGitRepository:
changelog_parent_commit,
import_tree_hash,
spi,
- patch_overrides
+ patch_overrides,
+ importer_version
)
@@ -1090,7 +1091,7 @@ def parse_patchfile(pkgname, patchfile):
pass
return patch_overrides
-def main():
+def main(importer_version):
args = parse_args()
pkgname = args.package
owner = args.lp_owner
@@ -1151,7 +1152,8 @@ def main():
for srcpkg_information in \
dist_sinfo.launchpad_versions_published_after(versions):
local_repo.import_spi(srcpkg_information, parent_overrides,
- [x for x in patch_overrides if x['distribution'] == distname]
+ [x for x in patch_overrides if x['distribution'] == distname],
+ importer_version
)
history_found.append(distname)
except NoPublicationHistoryException: