mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-04 02:00:11 +02:00
Allow archive policy override for indivudual apps
This commit is contained in:
parent
ded019291e
commit
25ae0e8d79
@ -472,6 +472,7 @@ The following sections describe the fields recognised within the file.
|
|||||||
* AntiFeatures::
|
* AntiFeatures::
|
||||||
* Disabled::
|
* Disabled::
|
||||||
* Requires Root::
|
* Requires Root::
|
||||||
|
* Archive Policy::
|
||||||
* Update Check Mode::
|
* Update Check Mode::
|
||||||
* Update Check Data::
|
* Update Check Data::
|
||||||
* Auto Update Mode::
|
* Auto Update Mode::
|
||||||
@ -1123,6 +1124,19 @@ again, rather than retrieving a different one.
|
|||||||
|
|
||||||
Used in conjunction with @code{Update Check Mode} for certain modes.
|
Used in conjunction with @code{Update Check Mode} for certain modes.
|
||||||
|
|
||||||
|
@node Archive Policy
|
||||||
|
@section Archive Policy
|
||||||
|
|
||||||
|
@cindex Archive Policy
|
||||||
|
|
||||||
|
This determines the policy for moving old versions of an app to the archive
|
||||||
|
repo, if one is configured. The configuration sets a default maximum number
|
||||||
|
of versions kept in the main repo, after which older ones are moved to the
|
||||||
|
archive. This app-specific policy setting can override that.
|
||||||
|
|
||||||
|
Currently the only supported format is "n versions", where n is the number
|
||||||
|
of versions to keep.
|
||||||
|
|
||||||
@node Auto Update Mode
|
@node Auto Update Mode
|
||||||
@section Auto Update Mode
|
@section Auto Update Mode
|
||||||
|
|
||||||
|
@ -485,6 +485,7 @@ def parse_metadata(metafile, **kw):
|
|||||||
thisinfo['Litecoin'] = None
|
thisinfo['Litecoin'] = None
|
||||||
thisinfo['Disabled'] = None
|
thisinfo['Disabled'] = None
|
||||||
thisinfo['AntiFeatures'] = None
|
thisinfo['AntiFeatures'] = None
|
||||||
|
thisinfo['Archive Policy'] = None
|
||||||
thisinfo['Update Check Mode'] = 'None'
|
thisinfo['Update Check Mode'] = 'None'
|
||||||
thisinfo['Auto Update Mode'] = 'None'
|
thisinfo['Auto Update Mode'] = 'None'
|
||||||
thisinfo['Current Version'] = ''
|
thisinfo['Current Version'] = ''
|
||||||
@ -578,6 +579,17 @@ def parse_metadata(metafile, **kw):
|
|||||||
if len(thisinfo['Description']) == 0:
|
if len(thisinfo['Description']) == 0:
|
||||||
thisinfo['Description'].append('No description available')
|
thisinfo['Description'].append('No description available')
|
||||||
|
|
||||||
|
# Validate archive policy...
|
||||||
|
if thisinfo['Archive Policy']:
|
||||||
|
if not thisinfo['Archive Policy'].endswith(' versions'):
|
||||||
|
raise MetaDataException("Invalid archive policy")
|
||||||
|
try:
|
||||||
|
versions = int(thisinfo['Archive Policy'][:-9])
|
||||||
|
if versions < 1 or versions > 20:
|
||||||
|
raise MetaDataException("Silly number of days for archive policy")
|
||||||
|
except:
|
||||||
|
raise MetaDataException("Incomprehensible number of days for archive policy")
|
||||||
|
|
||||||
# Ensure all AntiFeatures are recognised...
|
# Ensure all AntiFeatures are recognised...
|
||||||
if thisinfo['AntiFeatures']:
|
if thisinfo['AntiFeatures']:
|
||||||
parts = thisinfo['AntiFeatures'].split(",")
|
parts = thisinfo['AntiFeatures'].split(",")
|
||||||
@ -659,6 +671,8 @@ def write_metadata(dest, app):
|
|||||||
mf.write('\n')
|
mf.write('\n')
|
||||||
if len(app['builds']) > 0:
|
if len(app['builds']) > 0:
|
||||||
mf.write('\n')
|
mf.write('\n')
|
||||||
|
if app['Archive Policy']:
|
||||||
|
writefield('Archive Policy')
|
||||||
writefield('Auto Update Mode')
|
writefield('Auto Update Mode')
|
||||||
writefield('Update Check Mode')
|
writefield('Update Check Mode')
|
||||||
if 'Update Check Data' in app:
|
if 'Update Check Data' in app:
|
||||||
|
@ -644,7 +644,7 @@ def make_index(apps, apks, repodir, archive, categories):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def archive_old_apks(apps, apks, repodir, archivedir, keepversions):
|
def archive_old_apks(apps, apks, repodir, archivedir, defaultkeepversions):
|
||||||
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
|
|
||||||
@ -657,6 +657,11 @@ def archive_old_apks(apps, apks, repodir, archivedir, keepversions):
|
|||||||
# Sort the apk list into version order...
|
# Sort the apk list into version order...
|
||||||
apklist = sorted(apklist, key=lambda apk: apk['versioncode'], reverse=True)
|
apklist = sorted(apklist, key=lambda apk: apk['versioncode'], reverse=True)
|
||||||
|
|
||||||
|
if app['Archive Policy']:
|
||||||
|
keepversions = int(app['Archive Policy'][:-9])
|
||||||
|
else:
|
||||||
|
keepversions = defaultkeepversions
|
||||||
|
|
||||||
if len(apklist) > keepversions:
|
if len(apklist) > keepversions:
|
||||||
for apk in apklist[keepversions:]:
|
for apk in apklist[keepversions:]:
|
||||||
print "Moving " + apk['apkname'] + " to archive"
|
print "Moving " + apk['apkname'] + " to archive"
|
||||||
|
Loading…
Reference in New Issue
Block a user