1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-05 18:50:09 +02:00

New metadata field: Vercode Operation

This commit is contained in:
Daniel Martí 2013-11-01 13:25:50 +01:00
parent 0c8283bc1a
commit d507b2e894
3 changed files with 36 additions and 13 deletions

View File

@ -476,6 +476,7 @@ The following sections describe the fields recognised within the file.
* Requires Root:: * Requires Root::
* Archive Policy:: * Archive Policy::
* Update Check Mode:: * Update Check Mode::
* Vercode Operation::
* Update Check Data:: * Update Check Data::
* Auto Update Mode:: * Auto Update Mode::
* Current Version:: * Current Version::
@ -1136,6 +1137,20 @@ 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 Vercode Operation
@section Vercode Operation
@cindex Vercode Operation
Operation to be applied to the vercode obtained by the defined @code{Update
Check Mode}. @code{%c} will be replaced by the actual vercode, and the whole
string will be passed to python's @code{eval} function.
Especially useful with apps that we want to compile for different ABIs, but
whose vercodes don't always have trailing zeros. With @code{Vercode Operation}
set at something like @code{%c*10 + 4}, we will be able to track updates and
build three different versions of every upstream version.
@node Archive Policy @node Archive Policy
@section Archive Policy @section Archive Policy

View File

@ -333,6 +333,7 @@ def main():
logmsg = None logmsg = None
tag = None tag = None
msg = None
mode = app['Update Check Mode'] mode = app['Update Check Mode']
if mode == 'Tags': if mode == 'Tags':
(version, vercode, tag) = check_tags(app, config['sdk_path']) (version, vercode, tag) = check_tags(app, config['sdk_path'])
@ -346,17 +347,21 @@ def main():
(version, vercode) = check_http(app) (version, vercode) = check_http(app)
elif mode == 'Static': elif mode == 'Static':
version = None version = None
vercode = 'Checking disabled' msg = 'Checking disabled'
elif mode == 'None': elif mode == 'None':
version = None version = None
vercode = 'Checking disabled' msg = 'Checking disabled'
else: else:
version = None version = None
vercode = 'Invalid update check method' msg = 'Invalid update check method'
if vercode and app['Vercode Operation']:
op = app['Vercode Operation'].replace("%c", str(int(vercode)))
vercode = str(eval(op))
updating = False updating = False
if not version: if not version:
print "..." + vercode print "...%s" % msg
elif vercode == app['Current Version Code']: elif vercode == app['Current Version Code']:
print "...up to date" print "...up to date"
else: else:

View File

@ -197,7 +197,7 @@ class vcs_git(vcs):
self.refreshed = True self.refreshed = True
# Check out the appropriate revision... # Check out the appropriate revision...
rev = str(rev if rev else 'origin/master') rev = str(rev if rev else 'origin/master')
if subprocess.call(['git', 'checkout', '-f', rev], cwd=self.local) != 0: if subprocess.call(['git', 'checkout', '-f', rev], cwd=self.local) != 0:
raise VCSException("Git checkout failed") raise VCSException("Git checkout failed")
# Get rid of any uncontrolled files left behind... # Get rid of any uncontrolled files left behind...
if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0: if subprocess.call(['git', 'clean', '-dffx'], cwd=self.local) != 0:
@ -211,14 +211,14 @@ class vcs_git(vcs):
if subprocess.call(['git', 'submodule', 'update'], if subprocess.call(['git', 'submodule', 'update'],
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Git submodule update failed") raise VCSException("Git submodule update failed")
if subprocess.call(['git', 'submodule', 'foreach', if subprocess.call(['git', 'submodule', 'foreach',
'git', 'reset', '--hard'], 'git', 'reset', '--hard'],
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Git submodule reset failed") raise VCSException("Git submodule reset failed")
if subprocess.call(['git', 'submodule', 'foreach', if subprocess.call(['git', 'submodule', 'foreach',
'git', 'clean', '-dffx'], 'git', 'clean', '-dffx'],
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Git submodule clean failed") raise VCSException("Git submodule clean failed")
def gettags(self): def gettags(self):
self.checkrepo() self.checkrepo()
@ -566,6 +566,7 @@ def parse_metadata(metafile, verbose=False):
thisinfo['AntiFeatures'] = None thisinfo['AntiFeatures'] = None
thisinfo['Archive Policy'] = None thisinfo['Archive Policy'] = None
thisinfo['Update Check Mode'] = 'None' thisinfo['Update Check Mode'] = 'None'
thisinfo['Vercode Operation'] = None
thisinfo['Auto Update Mode'] = 'None' thisinfo['Auto Update Mode'] = 'None'
thisinfo['Current Version'] = '' thisinfo['Current Version'] = ''
thisinfo['Current Version Code'] = '0' thisinfo['Current Version Code'] = '0'
@ -829,6 +830,8 @@ def write_metadata(dest, app, verbose=False):
writefield('Archive Policy') writefield('Archive Policy')
writefield('Auto Update Mode') writefield('Auto Update Mode')
writefield('Update Check Mode') writefield('Update Check Mode')
if app['Vercode Operation']:
writefield('Vercode Operation')
if 'Update Check Data' in app: if 'Update Check Data' in app:
writefield('Update Check Data') writefield('Update Check Data')
if len(app['Current Version']) > 0: if len(app['Current Version']) > 0: