[yocto] [PATCH][AUH] Add a commit_revert_policy configuration setting

Alexander Kanavin alexander.kanavin at linux.intel.com
Fri Mar 16 10:53:19 PDT 2018


This helps in particular when a package upgrade builds fine, but then
causes other packages to fail. Depending on how close to the root
of dependency tree the failing packages are, this can badly subvert
the unattended upgrade process. So for that case, the better approach
is to revert every upgrade commit, so that each upgrade is effectively
built against master, which makes it less likely to fail.

Signed-off-by: Alexander Kanavin <alexander.kanavin at linux.intel.com>
---
 upgrade-helper.conf | 13 +++++++++++++
 upgradehelper.py    |  6 +++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/upgrade-helper.conf b/upgrade-helper.conf
index b84b407..98ef58f 100644
--- a/upgrade-helper.conf
+++ b/upgrade-helper.conf
@@ -74,6 +74,19 @@
 # about what has changed in the resulting packages, compared to previous version
 #buildhistory=yes
 
+# When AUH has built an upgraded recipe it then creates a commit with the upgrade.
+# This setting specifies whether to also revert the commit. Possible values are:
+# 'failed_to_build' (default) - revert if the recipe failed to build. This is useful
+# to prevent further upgrades in the batch from failing, if they're dependent on the
+# recipe.
+# 'all' - always revert. This is useful when running automatic, unattended upgrades,
+#  as it will effectively test each upgrade against the baseline, and will avoid the 
+# situation where one successful upgrade thwarts others due to newly introduced 
+# incompatibilities.
+# 'never' - never revert. Use in interactive upgrade sessions, where any issues can be
+# manually fixed.
+#commit_revert_policy=failed_to_build
+
 # If enabled, build and boots a test image, and runs integration tests on it
 # If upgraded packages have ptest support those are run as well
 #testimage=no
diff --git a/upgradehelper.py b/upgradehelper.py
index d868cde..b5e696e 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -376,9 +376,13 @@ class Updater(object):
             else:
                 I(" %s: Save patch in directory: %s." %
                     (pkg_ctx['PN'], pkg_ctx['workdir']))
-            if pkg_ctx['error'] is not None:
+            revert_policy = settings.get('commit_revert_policy', 'failed_to_build')
+            if (pkg_ctx['error'] is not None and revert_policy == 'failed_to_build'):
                 I("Due to build errors, the commit will also be reverted to avoid cascading upgrade failures.")
                 self.git.revert("HEAD")
+            elif revert_policy == 'all':
+                I("The commit will be reverted to follow the policy set in the configuration file.")
+                self.git.revert("HEAD")
         except Error as e:
             msg = ''
 
-- 
2.16.1




More information about the yocto mailing list