summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/prexport.bbclass4
-rw-r--r--meta/classes/primport.bbclass3
-rw-r--r--meta/lib/oe/prservice.py18
3 files changed, 23 insertions, 2 deletions
diff --git a/meta/classes/prexport.bbclass b/meta/classes/prexport.bbclass
index 5b5b707a88..2b16a66942 100644
--- a/meta/classes/prexport.bbclass
+++ b/meta/classes/prexport.bbclass
@@ -21,11 +21,13 @@ python prexport_handler () {
21 bb.fatal("prexport_handler: export failed!") 21 bb.fatal("prexport_handler: export failed!")
22 (metainfo, datainfo) = retval 22 (metainfo, datainfo) = retval
23 if not datainfo: 23 if not datainfo:
24 bb.error("prexport_handler: No AUROPR values found for %s" % ver) 24 bb.warn("prexport_handler: No AUROPR values found for %s" % ver)
25 return 25 return
26 oe.prservice.prserv_export_tofile(e.data, None, datainfo, False) 26 oe.prservice.prserv_export_tofile(e.data, None, datainfo, False)
27 elif isinstance(e, bb.event.ParseStarted): 27 elif isinstance(e, bb.event.ParseStarted):
28 import bb.utils 28 import bb.utils
29 import oe.prservice
30 oe.prservice.prserv_check_avail(e.data)
29 #remove dumpfile 31 #remove dumpfile
30 bb.utils.remove(e.data.getVar('PRSERV_DUMPFILE', True)) 32 bb.utils.remove(e.data.getVar('PRSERV_DUMPFILE', True))
31 elif isinstance(e, bb.event.ParseCompleted): 33 elif isinstance(e, bb.event.ParseCompleted):
diff --git a/meta/classes/primport.bbclass b/meta/classes/primport.bbclass
index 08e5a8f426..37b0d6b1b7 100644
--- a/meta/classes/primport.bbclass
+++ b/meta/classes/primport.bbclass
@@ -12,6 +12,9 @@ python primport_handler () {
12 12
13 for (version, pkgarch, checksum, value) in imported: 13 for (version, pkgarch, checksum, value) in imported:
14 bb.note("imported (%s,%s,%s,%d)" % (version, pkgarch, checksum, value)) 14 bb.note("imported (%s,%s,%s,%d)" % (version, pkgarch, checksum, value))
15 elif isinstance(e, bb.event.ParseStarted):
16 import oe.prservice
17 oe.prservice.prserv_check_avail(e.data)
15} 18}
16 19
17addhandler primport_handler 20addhandler primport_handler
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index fa6718e914..16785ce83d 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -1,12 +1,15 @@
1import bb 1import bb
2 2
3def prserv_make_conn(d): 3def prserv_make_conn(d, check = False):
4 import prserv.serv 4 import prserv.serv
5 host = d.getVar("PRSERV_HOST",True) 5 host = d.getVar("PRSERV_HOST",True)
6 port = d.getVar("PRSERV_PORT",True) 6 port = d.getVar("PRSERV_PORT",True)
7 try: 7 try:
8 conn = None 8 conn = None
9 conn = prserv.serv.PRServerConnection(host,int(port)) 9 conn = prserv.serv.PRServerConnection(host,int(port))
10 if check:
11 if not conn.ping():
12 raise Exception('service not available')
10 d.setVar("__PRSERV_CONN",conn) 13 d.setVar("__PRSERV_CONN",conn)
11 except Exception, exc: 14 except Exception, exc:
12 bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc))) 15 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):
111 f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value']))) 114 f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value'])))
112 f.close() 115 f.close()
113 bb.utils.unlockfile(lf) 116 bb.utils.unlockfile(lf)
117
118def prserv_check_avail(d):
119 host = d.getVar("PRSERV_HOST",True)
120 port = d.getVar("PRSERV_PORT",True)
121 try:
122 if not host:
123 raise TypeError
124 else:
125 port = int(port)
126 except TypeError:
127 bb.fatal("Undefined or incorrect values of PRSERV_HOST or PRSERV_PORT")
128 else:
129 prserv_make_conn(d, True)