summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oe/prservice.py65
1 files changed, 32 insertions, 33 deletions
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index b1132ccb11..fcdbe66c19 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -79,41 +79,40 @@ def prserv_export_tofile(d, metainfo, datainfo, lockdown, nomax=False):
79 df = d.getVar('PRSERV_DUMPFILE') 79 df = d.getVar('PRSERV_DUMPFILE')
80 #write data 80 #write data
81 lf = bb.utils.lockfile("%s.lock" % df) 81 lf = bb.utils.lockfile("%s.lock" % df)
82 f = open(df, "a") 82 with open(df, "a") as f:
83 if metainfo: 83 if metainfo:
84 #dump column info 84 #dump column info
85 f.write("#PR_core_ver = \"%s\"\n\n" % metainfo['core_ver']); 85 f.write("#PR_core_ver = \"%s\"\n\n" % metainfo['core_ver']);
86 f.write("#Table: %s\n" % metainfo['tbl_name']) 86 f.write("#Table: %s\n" % metainfo['tbl_name'])
87 f.write("#Columns:\n") 87 f.write("#Columns:\n")
88 f.write("#name \t type \t notn \t dflt \t pk\n") 88 f.write("#name \t type \t notn \t dflt \t pk\n")
89 f.write("#----------\t --------\t --------\t --------\t ----\n") 89 f.write("#----------\t --------\t --------\t --------\t ----\n")
90 for i in range(len(metainfo['col_info'])): 90 for i in range(len(metainfo['col_info'])):
91 f.write("#%10s\t %8s\t %8s\t %8s\t %4s\n" % 91 f.write("#%10s\t %8s\t %8s\t %8s\t %4s\n" %
92 (metainfo['col_info'][i]['name'], 92 (metainfo['col_info'][i]['name'],
93 metainfo['col_info'][i]['type'], 93 metainfo['col_info'][i]['type'],
94 metainfo['col_info'][i]['notnull'], 94 metainfo['col_info'][i]['notnull'],
95 metainfo['col_info'][i]['dflt_value'], 95 metainfo['col_info'][i]['dflt_value'],
96 metainfo['col_info'][i]['pk'])) 96 metainfo['col_info'][i]['pk']))
97 f.write("\n") 97 f.write("\n")
98 98
99 if lockdown: 99 if lockdown:
100 f.write("PRSERV_LOCKDOWN = \"1\"\n\n") 100 f.write("PRSERV_LOCKDOWN = \"1\"\n\n")
101 101
102 if datainfo: 102 if datainfo:
103 idx = {} 103 idx = {}
104 for i in range(len(datainfo)): 104 for i in range(len(datainfo)):
105 pkgarch = datainfo[i]['pkgarch'] 105 pkgarch = datainfo[i]['pkgarch']
106 value = datainfo[i]['value'] 106 value = datainfo[i]['value']
107 if pkgarch not in idx: 107 if pkgarch not in idx:
108 idx[pkgarch] = i 108 idx[pkgarch] = i
109 elif value > datainfo[idx[pkgarch]]['value']: 109 elif value > datainfo[idx[pkgarch]]['value']:
110 idx[pkgarch] = i 110 idx[pkgarch] = i
111 f.write("PRAUTO$%s$%s$%s = \"%s\"\n" % 111 f.write("PRAUTO$%s$%s$%s = \"%s\"\n" %
112 (str(datainfo[i]['version']), pkgarch, str(datainfo[i]['checksum']), str(value))) 112 (str(datainfo[i]['version']), pkgarch, str(datainfo[i]['checksum']), str(value)))
113 if not nomax: 113 if not nomax:
114 for i in idx: 114 for i in idx:
115 f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value']))) 115 f.write("PRAUTO_%s_%s = \"%s\"\n" % (str(datainfo[idx[i]]['version']),str(datainfo[idx[i]]['pkgarch']),str(datainfo[idx[i]]['value'])))
116 f.close()
117 bb.utils.unlockfile(lf) 116 bb.utils.unlockfile(lf)
118 117
119def prserv_check_avail(d): 118def prserv_check_avail(d):