[yocto] [PATCH 05/12] modules/steps.py: fix warn when skip compilation

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


* The previous code lacks a "% var" in the end:
  W(" %s: Compilation was skipped by user choice!")

* Move the skipping steps to upgradehelper.py rather than
  modules/steps.py, do not run compile is more straight-forward  than
  return early from it when skipping.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 modules/steps.py | 4 ----
 upgradehelper.py | 7 +++++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/steps.py b/modules/steps.py
index 677d101..c78cabc 100644
--- a/modules/steps.py
+++ b/modules/steps.py
@@ -136,10 +136,6 @@ def unpack_original_workdir(bb, git, opts, pkg_ctx):
         pass
 
 def compile(bb, git, opts, pkg_ctx):
-    if opts['skip_compilation']:
-        W(" %s: Compilation was skipped by user choice!" % pkg_ctx['PN'])
-        return
-
     for machine in opts['machines']:
         I(" %s: compiling for %s ..." % (pkg_ctx['PN'], machine))
         pkg_ctx['recipe'].compile(machine)
diff --git a/upgradehelper.py b/upgradehelper.py
index 4a3f3f0..605114b 100755
--- a/upgradehelper.py
+++ b/upgradehelper.py
@@ -56,6 +56,7 @@ from utils.emailhandler import Email
 
 from statistics import Statistics
 from steps import upgrade_steps
+from steps import compile
 from testimage import TestImage
 
 help_text = """Usage examples:
@@ -179,7 +180,6 @@ class Updater(object):
         self.opts['send_email'] = self.args.send_emails
         self.opts['author'] = "Upgrade Helper <%s>" % \
                 settings.get('from', 'uh at not.set')
-        self.opts['skip_compilation'] = self.args.skip_compilation
         self.opts['buildhistory'] = self._buildhistory_is_enabled()
         self.opts['testimage'] = self._testimage_is_enabled()
 
@@ -231,7 +231,7 @@ class Updater(object):
                       " but need BUILDHISTORY_COMMIT=1 please set.")
                     exit(1)
 
-                if self.opts['skip_compilation']:
+                if self.args.skip_compilation:
                     W(" Buildhistory disabled because user" \
                             " skip compilation!")
                 else:
@@ -577,6 +577,9 @@ class Updater(object):
             try:
                 I(" %s: Upgrading to %s" % (pkg_ctx['PN'], pkg_ctx['NPV']))
                 for step, msg in upgrade_steps:
+                    if step == compile and self.args.skip_compilation:
+                        W(" %s: Skipping compile by user choice" % pkg_ctx['PN'])
+                        continue
                     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