* AntiFeatures::
* Disabled::
* Requires Root::
+* Archive Policy::
* Update Check Mode::
* Update Check Data::
* Auto Update Mode::
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
@section Auto Update Mode
thisinfo['Litecoin'] = None
thisinfo['Disabled'] = None
thisinfo['AntiFeatures'] = None
+ thisinfo['Archive Policy'] = None
thisinfo['Update Check Mode'] = 'None'
thisinfo['Auto Update Mode'] = 'None'
thisinfo['Current Version'] = ''
if len(thisinfo['Description']) == 0:
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...
if thisinfo['AntiFeatures']:
parts = thisinfo['AntiFeatures'].split(",")
mf.write('\n')
if len(app['builds']) > 0:
mf.write('\n')
+ if app['Archive Policy']:
+ writefield('Archive Policy')
writefield('Auto Update Mode')
writefield('Update Check Mode')
if 'Update Check Data' in app:
-def archive_old_apks(apps, apks, repodir, archivedir, keepversions):
+def archive_old_apks(apps, apks, repodir, archivedir, defaultkeepversions):
for app in apps:
# Sort the apk list into version order...
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:
for apk in apklist[keepversions:]:
print "Moving " + apk['apkname'] + " to archive"