Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] Added sanity check for PRservice
@ 2012-03-07  7:36 Lianhao Lu
  2012-03-07  7:36 ` [PATCH 1/1] prservice: Added sanity check for prservice connection Lianhao Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Lianhao Lu @ 2012-03-07  7:36 UTC (permalink / raw)
  To: openembedded-core

This patch fixed yocto bug #2052 by adding sanity check of PRService 
related variables.

The following changes since commit d7b8c247227f3cc82f92292407f548927e9fde78:
  Richard Purdie (1):
        base.bbclass: Fix PACKAGECONFIG handling when no flags are set

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib llu/bug2052
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=llu/bug2052

Lianhao Lu (1):
  prservice: Added sanity check for prservice connection.

 meta/classes/prexport.bbclass |    4 +++-
 meta/classes/primport.bbclass |    3 +++
 meta/lib/oe/prservice.py      |   18 +++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)




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

* [PATCH 1/1] prservice: Added sanity check for prservice connection.
  2012-03-07  7:36 [PATCH 0/1] Added sanity check for PRservice Lianhao Lu
@ 2012-03-07  7:36 ` Lianhao Lu
  2012-03-08 20:17   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Lianhao Lu @ 2012-03-07  7:36 UTC (permalink / raw)
  To: openembedded-core

Fixed bug [YOCTO #2052]. Added sanity check for variables of PRSERV_HOST
and PRSERV_PORT, also for the connection availabity of prservice.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
 meta/classes/prexport.bbclass |    4 +++-
 meta/classes/primport.bbclass |    3 +++
 meta/lib/oe/prservice.py      |   18 +++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/meta/classes/prexport.bbclass b/meta/classes/prexport.bbclass
index 5b5b707..2b16a66 100644
--- a/meta/classes/prexport.bbclass
+++ b/meta/classes/prexport.bbclass
@@ -21,11 +21,13 @@ python prexport_handler () {
             bb.fatal("prexport_handler: export failed!")
         (metainfo, datainfo) = retval
         if not datainfo:
-            bb.error("prexport_handler: No AUROPR values found for %s" % ver)
+            bb.warn("prexport_handler: No AUROPR values found for %s" % ver)
             return
         oe.prservice.prserv_export_tofile(e.data, None, datainfo, False)
     elif isinstance(e, bb.event.ParseStarted):
         import bb.utils
+        import oe.prservice
+        oe.prservice.prserv_check_avail(e.data)
         #remove dumpfile
         bb.utils.remove(e.data.getVar('PRSERV_DUMPFILE', True))
     elif isinstance(e, bb.event.ParseCompleted):
diff --git a/meta/classes/primport.bbclass b/meta/classes/primport.bbclass
index 08e5a8f..37b0d6b 100644
--- a/meta/classes/primport.bbclass
+++ b/meta/classes/primport.bbclass
@@ -12,6 +12,9 @@ python primport_handler () {
 
         for (version, pkgarch, checksum, value) in imported:
             bb.note("imported (%s,%s,%s,%d)" % (version, pkgarch, checksum, value))
+    elif isinstance(e, bb.event.ParseStarted):
+        import oe.prservice
+        oe.prservice.prserv_check_avail(e.data)
 }
 
 addhandler primport_handler
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index fa6718e..16785ce 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -1,12 +1,15 @@
 import bb
 
-def prserv_make_conn(d):
+def prserv_make_conn(d, check = False):
     import prserv.serv
     host = d.getVar("PRSERV_HOST",True)
     port = d.getVar("PRSERV_PORT",True)
     try:
         conn = None
         conn = prserv.serv.PRServerConnection(host,int(port))
+        if check:
+            if not conn.ping():
+                raise Exception('service not available')
         d.setVar("__PRSERV_CONN",conn)
     except Exception, exc:
         bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc)))
@@ -111,3 +114,16 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False):
                 f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value'])))
     f.close()
     bb.utils.unlockfile(lf)
+
+def prserv_check_avail(d):
+    host = d.getVar("PRSERV_HOST",True)
+    port = d.getVar("PRSERV_PORT",True)
+    try:
+        if not host:
+            raise TypeError
+        else:
+            port = int(port)
+    except TypeError:
+        bb.fatal("Undefined or incorrect values of PRSERV_HOST or PRSERV_PORT")
+    else:
+        prserv_make_conn(d, True)
-- 
1.7.0.4




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

* Re: [PATCH 1/1] prservice: Added sanity check for prservice connection.
  2012-03-07  7:36 ` [PATCH 1/1] prservice: Added sanity check for prservice connection Lianhao Lu
@ 2012-03-08 20:17   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2012-03-08 20:17 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Wed, 2012-03-07 at 15:36 +0800, Lianhao Lu wrote:
> Fixed bug [YOCTO #2052]. Added sanity check for variables of PRSERV_HOST
> and PRSERV_PORT, also for the connection availabity of prservice.
> 
> Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
> ---
>  meta/classes/prexport.bbclass |    4 +++-
>  meta/classes/primport.bbclass |    3 +++
>  meta/lib/oe/prservice.py      |   18 +++++++++++++++++-
>  3 files changed, 23 insertions(+), 2 deletions(-)

Merged to master, thanks.

Richard




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

end of thread, other threads:[~2012-03-08 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07  7:36 [PATCH 0/1] Added sanity check for PRservice Lianhao Lu
2012-03-07  7:36 ` [PATCH 1/1] prservice: Added sanity check for prservice connection Lianhao Lu
2012-03-08 20:17   ` Richard Purdie

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