Adjust the structure of the RHEL JSON files to list the arches available as well
This commit is contained in:
parent
3a8e6b687f
commit
8f61ea7095
1 changed files with 11 additions and 6 deletions
|
@ -187,7 +187,7 @@ def main():
|
||||||
|
|
||||||
for el in PATHS:
|
for el in PATHS:
|
||||||
|
|
||||||
output = {}
|
output = {'packages': {}, 'arches': []}
|
||||||
|
|
||||||
dbfiles = find_primary_sqlite(PATHS[el])
|
dbfiles = find_primary_sqlite(PATHS[el])
|
||||||
|
|
||||||
|
@ -208,14 +208,18 @@ def main():
|
||||||
cnt = 0
|
cnt = 0
|
||||||
new = 0
|
new = 0
|
||||||
for pkg in session.query(Package).all():
|
for pkg in session.query(Package).all():
|
||||||
if pkg.basename in output:
|
if pkg.basename in output['packages']:
|
||||||
if pkg.arch not in output[pkg.basename]['arch']:
|
if pkg.arch not in output['packages'][
|
||||||
output[pkg.basename]['arch'].append(pkg.arch)
|
pkg.basename]['arch']:
|
||||||
|
output['packages'][pkg.basename]['arch'].append(
|
||||||
|
pkg.arch)
|
||||||
|
if pkg.arch not in output['arches']:
|
||||||
|
output['arches'].append(pkg.arch)
|
||||||
# TODO: checks if the evr is more recent or not
|
# TODO: checks if the evr is more recent or not
|
||||||
# (and update if it is)
|
# (and update if it is)
|
||||||
else:
|
else:
|
||||||
new += 1
|
new += 1
|
||||||
output[pkg.basename] = {
|
output['packages'][pkg.basename] = {
|
||||||
'arch': [pkg.arch],
|
'arch': [pkg.arch],
|
||||||
'epoch': pkg.epoch,
|
'epoch': pkg.epoch,
|
||||||
'version': pkg.version,
|
'version': pkg.version,
|
||||||
|
@ -225,7 +229,8 @@ def main():
|
||||||
print '%s packages in %s' % (cnt, cur_fold)
|
print '%s packages in %s' % (cnt, cur_fold)
|
||||||
print '%s packages were new packages' % (new)
|
print '%s packages were new packages' % (new)
|
||||||
|
|
||||||
print '\n%s packages retrieved in %s' % (len(output), el)
|
print '\n%s packages retrieved in %s' % (len(output['packages']), el)
|
||||||
|
print '%s arches for in %s' % (len(output['arches']), el)
|
||||||
outputfile = 'pkg_%s.json' % el
|
outputfile = 'pkg_%s.json' % el
|
||||||
with open(outputfile, 'w') as stream:
|
with open(outputfile, 'w') as stream:
|
||||||
stream.write(json.dumps(output))
|
stream.write(json.dumps(output))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue