Skip to contentSkip to conversation

improve recovery when something goes horribly wrong

PATCH New Peter Seebach 1 participant 3 messages Nov 20, 2013

lore
Share & tools
lore
#0 lore raw

cover improve recovery when something goes horribly wrong

Certain early failures can result in things going wrong in ways that prevent "bitbake -e" from running, creating strange or cryptic failures, and even when they're not all that cryptic, lack of include tracking or variable history tracking can be a significant disadvantage.

These patches address one of the failure modes, and make it possible for an oe-core change to address another.

The first patch makes run.* scripts work even when the path name generated contains unexpanded variable names, by quoting the argument to cd. The second provides an isTracking() to DataSmart to allow the sanity checks to be normal errors rather than fatal errors when trying to run with tracking enabled (which only occurs when you want to dump the results of the tracking).

The following changes since commit a66ee0994645aa5658b2f5ea134ed17d89f8751a:

fetch2: Fix handling of SCM mirrors in MIRRORS (2013-11-19 13:22:10 +0000)

are available in the git repository at:
git://git.yoctoproject.org/poky-contrib seebs/warning_helper
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/warning_helper

Peter Seebach (2):
build.py: add single-quotes around already-expanded directory name data_smart.py: Add isTracking() to datasmart

 lib/bb/build.py      |    2 +-
 lib/bb/data_smart.py |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/2 build.py: add single-quotes around already-expanded directory name

If the computed name of a directory contains an undefined variable reference, bitbake dutifully creates a directory with a name that has ${...} in it. However, the actual task script created then tries to cd to that directory, and the cd command fails, because no such directory exists -- because the shell has helpfully removed the ${...} which did not match any actual variables.

Since we want the name to be used exactly-as-is, add single quotes around the name so this doesn't cause strange failures running tasks, which allows us to progress past such failures and get to a point where they can be diagnosed.

---
 lib/bb/build.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/bb/build.py +1 -1
index f9aca42..92c45a3 100644
@@ -288,7 +288,7 @@ set -e
         if bb.msg.loggerVerboseLogs:
             script.write("set -x\n")
         if cwd:
-            script.write("cd %s\n" % cwd)
+            script.write("cd '%s'\n" % cwd)
         script.write("%s\n" % func)
         script.write('''
 # cleanup
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 data_smart.py: Add isTracking() to datasmart

In reply to Peter Seebach

It would be awesome to have "bitbake -e" work even when sanity failures occur. But you can't do that if you can't tell whether tracking is enabled. We add a trivial accessor.

---
 lib/bb/data_smart.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
lib/bb/data_smart.py +3 -0
index a1cbaba..4ff2717 100644
@@ -309,6 +309,9 @@ class DataSmart(MutableMapping):
     def disableTracking(self):
         self._tracking = False
 
+    def isTracking(self):
+        return self._tracking
+
     def expandWithRefs(self, s, varname):
 
         if not isinstance(s, basestring): # sanity check
Signature · 1 line
1.7.1