[yocto] [PATCH 08/12] upgradehelper.py: clean repo only once when recipes are specified

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


E.g.:
$ upgradehelper.py less strace bash git

The commit is removed when failed, and kept when succeed, but it would be
removed when next recipe runs, so only run clean_repo once can keep the commit,
which is helpful for the user.

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

diff --git a/upgradehelper.py b/upgradehelper.py
index e38a281..ff27b97 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -57,6 +57,7 @@ from utils.emailhandler import Email
 from statistics import Statistics
 from steps import upgrade_steps
 from steps import compile
+from steps import clean_repo
 from testimage import TestImage
 
 help_text = """Usage examples:
@@ -419,6 +420,10 @@ class Updater(object):
                 else:
                     I(" %s: Save patch in directory: %s." %
                         (pkg_ctx['PN'], pkg_ctx['workdir']))
+                    if pkg_ctx['error']:
+                        I(" %s: Remove it from repo since failed!" % pkg_ctx['PN'])
+                        self.git.reset_hard(1)
+
         except Error as e:
             msg = ''
 
@@ -569,6 +574,7 @@ class Updater(object):
         succeeded_pkgs_ctx = []
         failed_pkgs_ctx = []
         attempted_pkgs = 0
+        repo_cleaned = False
         for pn, _, _ in pkgs_to_upgrade:
             pkg_ctx = pkgs_ctx[pn]
             pkg_ctx['error'] = None
@@ -581,6 +587,12 @@ class Updater(object):
                     if step == compile and self.args.skip_compilation:
                         W(" %s: Skipping compile by user choice" % pkg_ctx['PN'])
                         continue
+                    if step == clean_repo and self.recipes:
+                        if repo_cleaned:
+                            I(" %s: Skipping clean_repo since it had been run by previous recipe" % pkg_ctx['PN'])
+                            continue
+                        else:
+                            repo_cleaned = True
                     if msg is not None:
                         I(" %s: %s" % (pkg_ctx['PN'], msg))
                     step(self.bb, self.git, self.opts, pkg_ctx)
-- 
2.7.4




More information about the yocto mailing list