diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/prservice.py | 18 |
1 files changed, 17 insertions, 1 deletions
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 @@ | |||
1 | import bb | 1 | import bb |
2 | 2 | ||
3 | def prserv_make_conn(d): | 3 | def 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 | |||
118 | def 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) | ||