It currently only works for git, hg and git-svn repositories. In the case of
the latter, the repo URL must encode the path to the trunk and tags or else no
tags will be found.
+@item
+@code{HTTP} - An HTTP request is performed, and the resulting document is
+scanned for two regular expressions, the first specifying the version name
+and the second the version code. The expression for the version name can be
+blank, but the version code must always be correct.
+
+The @code{Update Check Data} field is used to provide the url and the two
+regular expressions, in the form @code{url|ex1|ex2}.
@end itemize
+@node Update Check Data
+@section Update Check Data
+
+@cindex Update Check Data
+
+Used in conjunction with @code{Update Check Mode} for certain modes.
+
@node Auto Update Mode
@section Auto Update Mode
from common import VCSException
+# Check for a new version by looking at a document retrieved via HTTP.
+# The app's Update Check Data field is used to provide the information
+# required.
+def check_http(app):
+
+ try:
+
+ if not 'Update Check Data' in app:
+ raise Exception('Missing Update Check Data')
+
+ url, verex, codeex = app['Update Check Data'].split('|')
+
+ req = urllib2.Request(url, None)
+ resp = urllib2.urlopen(req, None, 20)
+ page = resp.read()
+
+ if len(verex) > 0:
+ m = re.search(verex, page)
+ if not m:
+ raise Exception("No RE match for version")
+ version = m.group(1)
+ else:
+ version = "??"
+
+ if len(codeex) > 0:
+ m = re.search(codeex, page)
+ if not m:
+ raise Exception("No RE match for version code")
+ vercode = m.group(1)
+ else:
+ vercode = "99999999"
+
+ return (version, vercode)
+
+ except Exception:
+ msg = "Could not complete http check for app %s due to unknown error: %s" % (app['id'], traceback.format_exc())
+ return (None, msg)
# Check for a new version by looking at the tags in the source repo.
# Whether this can be used reliably or not depends on
(version, vercode) = check_repomanifest(app, sdk_path)
elif mode.startswith('RepoManifest/'):
(version, vercode) = check_repomanifest(app, sdk_path, mode[13:])
+ elif mode == 'HTTP':
+ (version, vercode) = check_http(app)
elif mode == 'Static':
version = None
vercode = 'Checking disabled'
mf.write('\n')
writefield('Auto Update Mode')
writefield('Update Check Mode')
+ if 'Update Check Data' in app:
+ writefield('Update Check Data')
if len(app['Current Version']) > 0:
writefield('Current Version')
writefield('Current Version Code')