mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 19:10:11 +01:00
include push install/uninstall requests in index-v1
Since the index-v1 is generated straight from the internal dict, this just moves the generation earlier, and feeds it into the apps dict.
This commit is contained in:
parent
6c2cf2ccdd
commit
ab7e85c951
@ -1105,11 +1105,24 @@ def make_index(apps, sortedids, apks, repodir, archive):
|
|||||||
appsWithPackages[packageName] = newapp
|
appsWithPackages[packageName] = newapp
|
||||||
break
|
break
|
||||||
|
|
||||||
make_index_v0(appsWithPackages, apks, repodir, repodict)
|
requestsdict = dict()
|
||||||
make_index_v1(appsWithPackages, apks, repodir, repodict)
|
for command in ('install', 'uninstall'):
|
||||||
|
packageNames = []
|
||||||
|
key = command + '_list'
|
||||||
|
if key in config:
|
||||||
|
if isinstance(config[key], str):
|
||||||
|
packageNames = [config[key]]
|
||||||
|
elif all(isinstance(item, str) for item in config[key]):
|
||||||
|
packageNames = config[key]
|
||||||
|
else:
|
||||||
|
raise TypeError('only accepts strings, lists, and tuples')
|
||||||
|
requestsdict[command] = packageNames
|
||||||
|
|
||||||
|
make_index_v0(appsWithPackages, apks, repodir, repodict, requestsdict)
|
||||||
|
make_index_v1(appsWithPackages, apks, repodir, repodict, requestsdict)
|
||||||
|
|
||||||
|
|
||||||
def make_index_v1(apps, packages, repodir, repodict):
|
def make_index_v1(apps, packages, repodir, repodict, requestsdict):
|
||||||
|
|
||||||
def _index_encoder_default(obj):
|
def _index_encoder_default(obj):
|
||||||
if isinstance(obj, set):
|
if isinstance(obj, set):
|
||||||
@ -1120,6 +1133,7 @@ def make_index_v1(apps, packages, repodir, repodict):
|
|||||||
|
|
||||||
output = collections.OrderedDict()
|
output = collections.OrderedDict()
|
||||||
output['repo'] = repodict
|
output['repo'] = repodict
|
||||||
|
output['requests'] = requestsdict
|
||||||
|
|
||||||
appslist = []
|
appslist = []
|
||||||
output['apps'] = appslist
|
output['apps'] = appslist
|
||||||
@ -1184,7 +1198,7 @@ def make_index_v1(apps, packages, repodir, repodict):
|
|||||||
os.remove(index_file)
|
os.remove(index_file)
|
||||||
|
|
||||||
|
|
||||||
def make_index_v0(apps, apks, repodir, repodict):
|
def make_index_v0(apps, apks, repodir, repodict, requestsdict):
|
||||||
'''aka index.jar aka index.xml'''
|
'''aka index.jar aka index.xml'''
|
||||||
|
|
||||||
doc = Document()
|
doc = Document()
|
||||||
@ -1231,16 +1245,7 @@ def make_index_v0(apps, apks, repodir, repodict):
|
|||||||
root.appendChild(repoel)
|
root.appendChild(repoel)
|
||||||
|
|
||||||
for command in ('install', 'uninstall'):
|
for command in ('install', 'uninstall'):
|
||||||
packageNames = []
|
for packageName in requestsdict[command]:
|
||||||
key = command + '_list'
|
|
||||||
if key in config:
|
|
||||||
if isinstance(config[key], str):
|
|
||||||
packageNames = [config[key]]
|
|
||||||
elif all(isinstance(item, str) for item in config[key]):
|
|
||||||
packageNames = config[key]
|
|
||||||
else:
|
|
||||||
raise TypeError('only accepts strings, lists, and tuples')
|
|
||||||
for packageName in packageNames:
|
|
||||||
element = doc.createElement(command)
|
element = doc.createElement(command)
|
||||||
root.appendChild(element)
|
root.appendChild(element)
|
||||||
element.setAttribute('packageName', packageName)
|
element.setAttribute('packageName', packageName)
|
||||||
|
Loading…
Reference in New Issue
Block a user