[yocto] [PATCH 10/12] upgradehelper.py: add --apply-failed option

Robert Yang liezhi.yang at windriver.com
Wed Dec 6 23:37:15 PST 2017


  -f, --apply-failed    Apply failed patch in the repo after upgrade is done

And add "FAILED:" in subject when failed. So that the user can go on
working based on the commit.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 upgradehelper.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/upgradehelper.py b/upgradehelper.py
index 0678c58..3ad33ae 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -94,6 +94,8 @@ def parse_cmdline():
                         help="do not compile, just change the checksums, remove PR, and commit")
     parser.add_argument("-c", "--config-file", default=None,
                         help="Path to the configuration file. Default is $BUILDDIR/upgrade-helper/upgrade-helper.conf")
+    parser.add_argument("-f", "--apply-failed", action="store_true", default=False,
+                        help="Apply failed patch in the repo after upgrade is done")
     return parser.parse_args()
 
 def parse_config_file(config_file):
@@ -407,7 +409,10 @@ class Updater(object):
 
             if 'recipe' in pkg_ctx:
                 I(" %s: Auto commit changes ..." % pkg_ctx['PN'])
-                commit_msg = pkg_ctx['recipe'].commit_msg
+                if pkg_ctx['error']:
+                    commit_msg = "FAILED: %s" % pkg_ctx['recipe'].commit_msg
+                else:
+                    commit_msg = pkg_ctx['recipe'].commit_msg
                 if self.recipes:
                     self.git.commit(commit_msg)
                 else:
@@ -655,6 +660,11 @@ class Updater(object):
                     pkg_ctx['MAINTAINER'], pkg_ctx['error'])
             self.pkg_upgrade_handler(pkg_ctx)
 
+            if self.args.apply_failed and pkg_ctx in failed_pkgs_ctx:
+                if pkg_ctx['patch_file']:
+                    I(" %s: Applying failed patch" % pn)
+                    self.git.apply_patch(pkg_ctx['patch_file'])
+
         if attempted_pkgs > 0:
             publish_work_url = settings.get('publish_work_url', '')
             work_tarball = os.path.join(self.uh_base_work_dir,
-- 
2.7.4




More information about the yocto mailing list