Ubuntu Pastebin

Paste from nacc at Tue, 18 Oct 2016 00:47:11 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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:
Download as text