[yocto] [auh][PATCH 20/20] upgradehelper.py: revert commits that failed to build

Alexander Kanavin alexander.kanavin at linux.intel.com
Thu Dec 14 08:36:00 PST 2017


From: Alexander Kanavin <alex.kanavin at gmail.com>

This helps avoid 'cascading build failures' where one failed update
holds up everything else.

Signed-off-by: Alexander Kanavin <alex.kanavin at gmail.com>
---
 modules/utils/git.py | 3 +++
 upgradehelper.py     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/modules/utils/git.py b/modules/utils/git.py
index 0e812b9..749d24d 100644
--- a/modules/utils/git.py
+++ b/modules/utils/git.py
@@ -61,6 +61,9 @@ class Git(object):
         else:
             return self._cmd("commit -a --author=\"" + author + "\" -m \"" + commit_message + "\"")
 
+    def revert(self, commit):
+        return self._cmd("revert --no-edit " + commit)
+
     def create_patch(self, out_dir):
         return self._cmd("format-patch -M10 -1 -o " + out_dir)
 
diff --git a/upgradehelper.py b/upgradehelper.py
index 58fa0a6..71ee0b0 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -414,6 +414,9 @@ class Updater(object):
             else:
                 I(" %s: Save patch in directory: %s." %
                     (pkg_ctx['PN'], pkg_ctx['workdir']))
+            if pkg_ctx['error'] is not None:
+                I("Due to build errors, the commit will also be reverted to avoid cascading upgrade failures.")
+                self.git.revert("HEAD")
         except Error as e:
             msg = ''
 
-- 
2.15.0




More information about the yocto mailing list