diff options
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/prservice.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py index 15ce060ff6..339f7aebca 100644 --- a/meta/lib/oe/prservice.py +++ b/meta/lib/oe/prservice.py | |||
@@ -11,7 +11,6 @@ def prserv_make_conn(d, check = False): | |||
11 | if check: | 11 | if check: |
12 | if not conn.ping(): | 12 | if not conn.ping(): |
13 | raise Exception('service not available') | 13 | raise Exception('service not available') |
14 | d.setVar("__PRSERV_CONN",conn) | ||
15 | except Exception as exc: | 14 | except Exception as exc: |
16 | bb.fatal("Connecting to PR service %s:%s failed: %s" % (host_params[0], host_params[1], str(exc))) | 15 | bb.fatal("Connecting to PR service %s:%s failed: %s" % (host_params[0], host_params[1], str(exc))) |
17 | 16 | ||
@@ -22,31 +21,29 @@ def prserv_dump_db(d): | |||
22 | bb.error("Not using network based PR service") | 21 | bb.error("Not using network based PR service") |
23 | return None | 22 | return None |
24 | 23 | ||
25 | conn = d.getVar("__PRSERV_CONN") | 24 | conn = prserv_make_conn(d) |
26 | if conn is None: | 25 | if conn is None: |
27 | conn = prserv_make_conn(d) | 26 | bb.error("Making connection failed to remote PR service") |
28 | if conn is None: | 27 | return None |
29 | bb.error("Making connection failed to remote PR service") | ||
30 | return None | ||
31 | 28 | ||
32 | #dump db | 29 | #dump db |
33 | opt_version = d.getVar('PRSERV_DUMPOPT_VERSION') | 30 | opt_version = d.getVar('PRSERV_DUMPOPT_VERSION') |
34 | opt_pkgarch = d.getVar('PRSERV_DUMPOPT_PKGARCH') | 31 | opt_pkgarch = d.getVar('PRSERV_DUMPOPT_PKGARCH') |
35 | opt_checksum = d.getVar('PRSERV_DUMPOPT_CHECKSUM') | 32 | opt_checksum = d.getVar('PRSERV_DUMPOPT_CHECKSUM') |
36 | opt_col = ("1" == d.getVar('PRSERV_DUMPOPT_COL')) | 33 | opt_col = ("1" == d.getVar('PRSERV_DUMPOPT_COL')) |
37 | return conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col) | 34 | d = conn.export(opt_version, opt_pkgarch, opt_checksum, opt_col) |
35 | conn.close() | ||
36 | return d | ||
38 | 37 | ||
39 | def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None): | 38 | def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksum=None): |
40 | if not d.getVar('PRSERV_HOST'): | 39 | if not d.getVar('PRSERV_HOST'): |
41 | bb.error("Not using network based PR service") | 40 | bb.error("Not using network based PR service") |
42 | return None | 41 | return None |
43 | 42 | ||
44 | conn = d.getVar("__PRSERV_CONN") | 43 | conn = prserv_make_conn(d) |
45 | if conn is None: | 44 | if conn is None: |
46 | conn = prserv_make_conn(d) | 45 | bb.error("Making connection failed to remote PR service") |
47 | if conn is None: | 46 | return None |
48 | bb.error("Making connection failed to remote PR service") | ||
49 | return None | ||
50 | #get the entry values | 47 | #get the entry values |
51 | imported = [] | 48 | imported = [] |
52 | prefix = "PRAUTO$" | 49 | prefix = "PRAUTO$" |
@@ -70,6 +67,7 @@ def prserv_import_db(d, filter_version=None, filter_pkgarch=None, filter_checksu | |||
70 | bb.error("importing(%s,%s,%s,%d) failed. DB may have larger value %d" % (version,pkgarch,checksum,value,ret)) | 67 | bb.error("importing(%s,%s,%s,%d) failed. DB may have larger value %d" % (version,pkgarch,checksum,value,ret)) |
71 | else: | 68 | else: |
72 | imported.append((version,pkgarch,checksum,value)) | 69 | imported.append((version,pkgarch,checksum,value)) |
70 | conn.close() | ||
73 | return imported | 71 | return imported |
74 | 72 | ||
75 | def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False): | 73 | def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False): |
@@ -125,4 +123,5 @@ def prserv_check_avail(d): | |||
125 | except TypeError: | 123 | except TypeError: |
126 | bb.fatal('Undefined/incorrect PRSERV_HOST value. Format: "host:port"') | 124 | bb.fatal('Undefined/incorrect PRSERV_HOST value. Format: "host:port"') |
127 | else: | 125 | else: |
128 | prserv_make_conn(d, True) | 126 | conn = prserv_make_conn(d, True) |
127 | conn.close() | ||