mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 19:10:11 +01:00
break out categories.txt generation to standalone method
This is to clean up the code for the introduction of a new index format. This also makes it so that only repo/categories.txt is generated, and not archive/categories.txt. Currently, the only thing that I can find that reads categories.txt is the wordpress plugin, e.g. wp-fdroid. And it only reads repo/categories.txt not archive/categories.txt.
This commit is contained in:
parent
d54ad41938
commit
78a3e35ef7
@ -961,8 +961,8 @@ def extract_pubkey():
|
|||||||
return hexlify(pubkey)
|
return hexlify(pubkey)
|
||||||
|
|
||||||
|
|
||||||
def make_index(apps, sortedids, apks, repodir, archive, categories):
|
def make_index(apps, sortedids, apks, repodir, archive):
|
||||||
"""Make a repo index.
|
"""Generate the repo index files.
|
||||||
|
|
||||||
:param apps: fully populated apps list
|
:param apps: fully populated apps list
|
||||||
:param apks: full populated apks list
|
:param apks: full populated apks list
|
||||||
@ -1297,7 +1297,9 @@ def make_index(apps, sortedids, apks, repodir, archive, categories):
|
|||||||
iconfilename = os.path.join(icon_dir, os.path.basename(config['repo_icon']))
|
iconfilename = os.path.join(icon_dir, os.path.basename(config['repo_icon']))
|
||||||
shutil.copyfile(config['repo_icon'], iconfilename)
|
shutil.copyfile(config['repo_icon'], iconfilename)
|
||||||
|
|
||||||
# Write a category list in the repo to allow quick access...
|
|
||||||
|
def make_categories_txt(repodir, categories):
|
||||||
|
'''Write a category list in the repo to allow quick access'''
|
||||||
catdata = ''
|
catdata = ''
|
||||||
for cat in categories:
|
for cat in categories:
|
||||||
catdata += cat + '\n'
|
catdata += cat + '\n'
|
||||||
@ -1612,7 +1614,7 @@ def main():
|
|||||||
appdict = dict()
|
appdict = dict()
|
||||||
appdict[appid] = app
|
appdict[appid] = app
|
||||||
if os.path.isdir(repodir):
|
if os.path.isdir(repodir):
|
||||||
make_index(appdict, [appid], apks, repodir, False, categories)
|
make_index(appdict, [appid], apks, repodir, False)
|
||||||
else:
|
else:
|
||||||
logging.info('Skipping index generation for ' + appid)
|
logging.info('Skipping index generation for ' + appid)
|
||||||
return
|
return
|
||||||
@ -1621,12 +1623,13 @@ def main():
|
|||||||
archive_old_apks(apps, apks, archapks, repodirs[0], repodirs[1], config['archive_older'])
|
archive_old_apks(apps, apks, archapks, repodirs[0], repodirs[1], config['archive_older'])
|
||||||
|
|
||||||
# Make the index for the main repo...
|
# Make the index for the main repo...
|
||||||
make_index(apps, sortedids, apks, repodirs[0], False, categories)
|
make_index(apps, sortedids, apks, repodirs[0], False)
|
||||||
|
make_categories_txt(repodirs[0], categories)
|
||||||
|
|
||||||
# If there's an archive repo, make the index for it. We already scanned it
|
# If there's an archive repo, make the index for it. We already scanned it
|
||||||
# earlier on.
|
# earlier on.
|
||||||
if len(repodirs) > 1:
|
if len(repodirs) > 1:
|
||||||
make_index(apps, sortedids, archapks, repodirs[1], True, categories)
|
make_index(apps, sortedids, archapks, repodirs[1], True)
|
||||||
|
|
||||||
if config['update_stats']:
|
if config['update_stats']:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user