Ubuntu Pastebin

Paste from smoser at Fri, 13 Jan 2017 16:54:32 +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
commit 74855e9cd8ab5ab6f296d55657412f1140387cd8 (HEAD -> master)
Author: Scott Moser <smoser@brickies.net>
Date:   Fri Jan 13 11:53:03 2017 -0500

    default to attempting to import patches applied and warn on fail.
    
    Instead of --patches-applied now we always attempt patches applied.
    If the --patches-applied-fatal flag is seen, then failure to apply
    patches will result failure.  Other wise, the error will just be
    logged and the import will continue.

diff --git a/usd/importer.py b/usd/importer.py
index 73de6a6..5e236d8 100755
--- a/usd/importer.py
+++ b/usd/importer.py
@@ -87,9 +87,10 @@ class USDImport:
                                  'Will create the local repository if needed.',
                             default=argparse.SUPPRESS
                            )
-        parser.add_argument('--patches-applied', action='store_true',
-                            help='Also import patches-applied history '
-                                 'the specified source package')
+        parser.add_argument('--patches-applied-fatal', action='store_true',
+                            help='Fail rather than warn if applying patches '
+                                 'fails.',
+                            default=False)
         if not subparsers:
             return parser.parse_args()
         return 'import - %s' % kwargs['description']
@@ -827,9 +828,23 @@ class USDImport:
                                             )
 
         # only import patches-applied publishes if explicitly specified
-        if not self.patches_applied:
-            return
+        try:
+            self.commit_patches_applied(
+                spi, unapplied_import_tree_hash,
+                unapplied_publish_parent_commit,
+                unapplied_changelog_parent_commit,
+                upload_parent_commit)
+        except Exception as e:
+            if self.patches_applied_fatal:
+                raise
+            logging.error('Applying patches failed: %s', e)
 
+        return
+
+    def commit_patches_applied(self, spi, unapplied_import_tree_hash
+            unapplied_publish_parent_commit,
+            unapplied_changelog_parent_commit,
+            upload_parent_commit)
         # Could also obtain this from the above
         unapplied_parent_commit = str(self.local_repo.get_import_tag(spi.version).peel().id)
         # Assume no patches to apply
@@ -885,7 +900,7 @@ class USDImport:
             dl_cache = args.dl_cache
         except AttributeError:
             dl_cache = None
-        self.patches_applied = args.patches_applied
+        self.patches_applied_fatal = args.patches_applied_fatal
 
         print('Ubuntu Server Team importer v%s' % VERSION)
 
Download as text