Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] sanity.bbclass: check host tool dependencies on change in NATIVELBSSTRING
@ 2016-03-22 17:23 Bill Randle
  2016-03-22 17:26 ` Randle, William C
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Randle @ 2016-03-22 17:23 UTC (permalink / raw)
  To: openembedded-core

When a user upgrades their host distro, it may no longer have all the
required tools installed, but this won't be caught by bitbake resulting
in possible build errors. Rather than check for installed tools on every
startup, use the NATIVELBSSTRING change as indicator to rescan for host
tool dependencies. Store the NATIVELBSSTRING in the sanity_info file.

[YOCTO #8585]

Signed-off-by: Bill Randle <william.c.randle@intel.com>
---
 meta/classes/sanity.bbclass | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 597f3de..fadad1b 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -641,9 +641,9 @@ def check_sanity_sstate_dir_change(sstate_dir, data):
     return testmsg
        
 def check_sanity_version_change(status, d):
-    # Sanity checks to be done when SANITY_VERSION changes
+    # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
     # In other words, these tests run once in a given build directory and then 
-    # never again until the sanity version changes.
+    # never again until the sanity version or host distrubution id/version changes.
 
     # Check the python install is complete. glib-2.0-natives requries
     # xml.parsers.expat
@@ -937,6 +937,7 @@ def check_sanity(sanity_data):
     last_sanity_version = 0
     last_tmpdir = ""
     last_sstate_dir = ""
+    last_nativelsbstr = ""
     sanityverfile = sanity_data.expand("${TOPDIR}/conf/sanity_info")
     if os.path.exists(sanityverfile):
         with open(sanityverfile, 'r') as f:
@@ -947,12 +948,17 @@ def check_sanity(sanity_data):
                     last_tmpdir = line.split()[1]
                 if line.startswith('SSTATE_DIR'):
                     last_sstate_dir = line.split()[1]
+                if line.startswith('NATIVELSBSTRING'):
+                    last_nativelsbstr = line.split()[1]
 
     check_sanity_everybuild(status, sanity_data)
     
     sanity_version = int(sanity_data.getVar('SANITY_VERSION', True) or 1)
     network_error = False
-    if last_sanity_version < sanity_version: 
+    # NATIVELSBSTRING var may have been overridden with "universal", so
+    # get actual host distribution id and version
+    nativelsbstr = lsb_distro_identifier(sanity_data)
+    if last_sanity_version < sanity_version or last_nativelsbstr != nativelsbstr: 
         check_sanity_version_change(status, sanity_data)
         status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
     else: 
@@ -964,6 +970,7 @@ def check_sanity(sanity_data):
             f.write("SANITY_VERSION %s\n" % sanity_version) 
             f.write("TMPDIR %s\n" % tmpdir) 
             f.write("SSTATE_DIR %s\n" % sstate_dir) 
+            f.write("NATIVELSBSTRING %s\n" % nativelsbstr) 
 
     sanity_handle_abichanges(status, sanity_data)
 
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sanity.bbclass: check host tool dependencies on change in NATIVELBSSTRING
  2016-03-22 17:23 [PATCH] sanity.bbclass: check host tool dependencies on change in NATIVELBSSTRING Bill Randle
@ 2016-03-22 17:26 ` Randle, William C
  0 siblings, 0 replies; 2+ messages in thread
From: Randle, William C @ 2016-03-22 17:26 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

That should be "NATIVELSBSTRING", obviously. The patch is correct; it's just the subject line and intro text that I copied and pasted the typo.

    -Bill

On Tue, 2016-03-22 at 10:23 -0700, Bill Randle wrote:

When a user upgrades their host distro, it may no longer have all the
required tools installed, but this won't be caught by bitbake resulting
in possible build errors. Rather than check for installed tools on every
startup, use the NATIVELBSSTRING change as indicator to rescan for host
tool dependencies. Store the NATIVELBSSTRING in the sanity_info file.

[YOCTO #8585]

Signed-off-by: Bill Randle <william.c.randle@intel.com<mailto:william.c.randle@intel.com>>
---
 meta/classes/sanity.bbclass | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 597f3de..fadad1b 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -641,9 +641,9 @@ def check_sanity_sstate_dir_change(sstate_dir, data):
     return testmsg

 def check_sanity_version_change(status, d):
-    # Sanity checks to be done when SANITY_VERSION changes
+    # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
     # In other words, these tests run once in a given build directory and then
-    # never again until the sanity version changes.
+    # never again until the sanity version or host distrubution id/version changes.

     # Check the python install is complete. glib-2.0-natives requries
     # xml.parsers.expat
@@ -937,6 +937,7 @@ def check_sanity(sanity_data):
     last_sanity_version = 0
     last_tmpdir = ""
     last_sstate_dir = ""
+    last_nativelsbstr = ""
     sanityverfile = sanity_data.expand("${TOPDIR}/conf/sanity_info")
     if os.path.exists(sanityverfile):
         with open(sanityverfile, 'r') as f:
@@ -947,12 +948,17 @@ def check_sanity(sanity_data):
                     last_tmpdir = line.split()[1]
                 if line.startswith('SSTATE_DIR'):
                     last_sstate_dir = line.split()[1]
+                if line.startswith('NATIVELSBSTRING'):
+                    last_nativelsbstr = line.split()[1]

     check_sanity_everybuild(status, sanity_data)

     sanity_version = int(sanity_data.getVar('SANITY_VERSION', True) or 1)
     network_error = False
-    if last_sanity_version < sanity_version:
+    # NATIVELSBSTRING var may have been overridden with "universal", so
+    # get actual host distribution id and version
+    nativelsbstr = lsb_distro_identifier(sanity_data)
+    if last_sanity_version < sanity_version or last_nativelsbstr != nativelsbstr:
         check_sanity_version_change(status, sanity_data)
         status.addresult(check_sanity_sstate_dir_change(sstate_dir, sanity_data))
     else:
@@ -964,6 +970,7 @@ def check_sanity(sanity_data):
             f.write("SANITY_VERSION %s\n" % sanity_version)
             f.write("TMPDIR %s\n" % tmpdir)
             f.write("SSTATE_DIR %s\n" % sstate_dir)
+            f.write("NATIVELSBSTRING %s\n" % nativelsbstr)

     sanity_handle_abichanges(status, sanity_data)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-22 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 17:23 [PATCH] sanity.bbclass: check host tool dependencies on change in NATIVELBSSTRING Bill Randle
2016-03-22 17:26 ` Randle, William C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox