summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/prservice.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index c3fb76a338..57fb39a371 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -1,11 +1,10 @@
1 1
2def prserv_make_conn(d, check = False): 2def prserv_make_conn(d, check = False):
3 import prserv.serv 3 import prserv.serv
4 host = d.getVar("PRSERV_HOST",True) 4 host_params = filter(None, (d.getVar("PRSERV_HOST", True) or '').split(':'))
5 port = d.getVar("PRSERV_PORT",True)
6 try: 5 try:
7 conn = None 6 conn = None
8 conn = prserv.serv.PRServerConnection(host,int(port)) 7 conn = prserv.serv.PRServerConnection(host_params[0], int(host_params[1]))
9 if check: 8 if check:
10 if not conn.ping(): 9 if not conn.ping():
11 raise Exception('service not available') 10 raise Exception('service not available')
@@ -16,7 +15,7 @@ def prserv_make_conn(d, check = False):
16 return conn 15 return conn
17 16
18def prserv_dump_db(d): 17def prserv_dump_db(d):
19 if d.getVar('USE_PR_SERV', True) != "1": 18 if not d.getVar('PRSERV_HOST', True):
20 bb.error("Not using network based PR service") 19 bb.error("Not using network based PR service")
21 return None 20 return None
22 21
@@ -35,7 +34,7 @@ def prserv_dump_db(d):
35 return conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col) 34 return conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col)
36 35
37def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None): 36def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None):
38 if d.getVar('USE_PR_SERV', True) != "1": 37 if not d.getVar('PRSERV_HOST', True):
39 bb.error("Not using network based PR service") 38 bb.error("Not using network based PR service")
40 return None 39 return None
41 40
@@ -115,14 +114,13 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False):
115 bb.utils.unlockfile(lf) 114 bb.utils.unlockfile(lf)
116 115
117def prserv_check_avail(d): 116def prserv_check_avail(d):
118 host = d.getVar("PRSERV_HOST",True) 117 host_params = filter(None, (d.getVar("PRSERV_HOST", True) or '').split(':'))
119 port = d.getVar("PRSERV_PORT",True)
120 try: 118 try:
121 if not host: 119 if len(host_params) != 2:
122 raise TypeError 120 raise TypeError
123 else: 121 else:
124 port = int(port) 122 int(host_params[1])
125 except TypeError: 123 except TypeError:
126 bb.fatal("Undefined or incorrect values of PRSERV_HOST or PRSERV_PORT") 124 bb.fatal('Undefined/incorrect PRSERV_HOST value. Format: "host:port"')
127 else: 125 else:
128 prserv_make_conn(d, True) 126 prserv_make_conn(d, True)