Patchwork [1/1] classes/sanity: enhance the network connectivity test

login
register
mail settings
Submitter Joshua Lock
Date Aug. 25, 2011, 3:29 p.m.
Message ID <452876f08ee6516713d5a7198e8589953cd35f4b.1314286007.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/10537/
State New, archived
Headers show

Comments

Joshua Lock - Aug. 25, 2011, 3:29 p.m.
Switch to use the checkstatus fetcher API for the network connectivity test,
this has several advantages:
* we no longer print any messages to the console whilst the check is
being run
* we don't actually download anything, removing the need for tidy up and
making the code more concise

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 meta/classes/sanity.bbclass |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
Richard Purdie - Aug. 25, 2011, 3:50 p.m.
On Thu, 2011-08-25 at 08:29 -0700, Joshua Lock wrote:
> Switch to use the checkstatus fetcher API for the network connectivity test,
> this has several advantages:
> * we no longer print any messages to the console whilst the check is
> being run
> * we don't actually download anything, removing the need for tidy up and
> making the code more concise
> 
> Signed-off-by: Joshua Lock <josh@linux.intel.com>

Merged to master, thanks.

Richard

Patch

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 16af029..cefe6a4 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -95,15 +95,9 @@  def check_connectivity(d):
     network_enabled = not bb.data.getVar('BB_NO_NETWORK', d, True)
     check_enabled = len(test_uris)
     if check_enabled and network_enabled:
-        data = bb.data.createCopy(d)
-        bookmark = os.getcwd()
-        dldir = bb.data.expand('${TMPDIR}/sanity', data)
-        bb.data.setVar('DL_DIR', dldir, data)
-
         try:
-            fetcher = bb.fetch2.Fetch(test_uris, data)
-            fetcher.download()
-            fetcher.clean(test_uris)
+            fetcher = bb.fetch2.Fetch(test_uris, d)
+            fetcher.checkstatus()
         except Exception:
             # Allow the message to be configured so that users can be
             # pointed to a support mechanism.
@@ -111,10 +105,6 @@  def check_connectivity(d):
             if len(msg) == 0:
                 msg = "Failed to fetch test data from the network. Please ensure your network is configured correctly.\n"
             retval = msg
-        finally:
-            # Make sure we tidy up the cruft
-            oe.path.remove(dldir)
-            os.chdir(bookmark)
 
     return retval