mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 22:40:12 +01:00
New Update Check Mode: RepoTrunk
This commit is contained in:
parent
efcf850247
commit
b75d8b7271
@ -1091,6 +1091,13 @@ in place of the default one. The default values are "master" for git,
|
||||
On the other hand, branch support hasn't been implemented yet in bzr and svn,
|
||||
but RepoManifest may still be used without it.
|
||||
@item
|
||||
@code{RepoTrunk} - For svn and git-svn repositories, especially those who
|
||||
don't have a bundled AndroidManifest.xml file, the Tags and RepoManifest
|
||||
checks will not work, since there is no version information to obtain. But,
|
||||
for those apps who automate their build process with the commit ref that HEAD
|
||||
points to, RepoTrunk will set the Current Version and Current Version Code to
|
||||
that number.
|
||||
@item
|
||||
@code{Tags} - The AndroidManifest.xml file in all tagged revisions in the
|
||||
source repository is checked, looking for the highest version code. The
|
||||
appropriateness of this method depends on the development process used by the
|
||||
|
@ -203,6 +203,35 @@ def check_repomanifest(app, sdk_path, branch=None):
|
||||
msg = "Could not scan app %s due to unknown error: %s" % (app['id'], traceback.format_exc())
|
||||
return (None, msg)
|
||||
|
||||
def check_repotrunk(app, sdk_path, branch=None):
|
||||
|
||||
try:
|
||||
if app['Repo Type'] == 'srclib':
|
||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||
repotype = common.getsrclibvcs(app['Repo'])
|
||||
else:
|
||||
build_dir = os.path.join('build/', app['id'])
|
||||
repotype = app['Repo Type']
|
||||
|
||||
if repotype not in ('svn', 'git-svn'):
|
||||
return (None, 'RepoTrunk update mode only makes sense in svn and git-svn repositories')
|
||||
|
||||
# Set up vcs interface and make sure we have the latest code...
|
||||
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir, sdk_path)
|
||||
|
||||
vcs.gotorevision(None)
|
||||
|
||||
ref = vcs.getref()
|
||||
return (ref, ref)
|
||||
except BuildException as be:
|
||||
msg = "Could not scan app %s due to BuildException: %s" % (app['id'], be)
|
||||
return (None, msg)
|
||||
except VCSException as vcse:
|
||||
msg = "VCS error while scanning app %s: %s" % (app['id'], vcse)
|
||||
return (None, msg)
|
||||
except Exception:
|
||||
msg = "Could not scan app %s due to unknown error: %s" % (app['id'], traceback.format_exc())
|
||||
return (None, msg)
|
||||
|
||||
# Check for a new version by looking at the Google Play Store.
|
||||
# Returns (None, "a message") if this didn't work, or (version, None) for
|
||||
@ -307,6 +336,8 @@ def main():
|
||||
(version, vercode) = check_repomanifest(app, sdk_path)
|
||||
elif mode.startswith('RepoManifest/'):
|
||||
(version, vercode) = check_repomanifest(app, sdk_path, mode[13:])
|
||||
elif mode == 'RepoTrunk':
|
||||
(version, vercode) = check_repotrunk(app, sdk_path)
|
||||
elif mode == 'HTTP':
|
||||
(version, vercode) = check_http(app)
|
||||
elif mode == 'Static':
|
||||
|
@ -126,6 +126,10 @@ class vcs:
|
||||
def gettags(self):
|
||||
raise VCSException('gettags not supported for this vcs type')
|
||||
|
||||
# Get current commit reference (hash, revision, etc)
|
||||
def getref(self):
|
||||
raise VCSException('getref not supported for this vcs type')
|
||||
|
||||
# Returns the srclib (name, path) used in setting up the current
|
||||
# revision, or None.
|
||||
def getsrclib(self):
|
||||
@ -287,6 +291,12 @@ class vcs_gitsvn(vcs):
|
||||
self.checkrepo()
|
||||
return os.listdir(os.path.join(self.local, '.git/svn/refs/remotes/tags'))
|
||||
|
||||
def getref(self):
|
||||
self.checkrepo()
|
||||
p = subprocess.Popen(['git', 'svn', 'find-rev', 'HEAD'],
|
||||
stdout=subprocess.PIPE, cwd=self.local)
|
||||
return p.communicate()[0]
|
||||
|
||||
class vcs_svn(vcs):
|
||||
|
||||
def repotype(self):
|
||||
@ -321,6 +331,12 @@ class vcs_svn(vcs):
|
||||
self.userargs(), cwd=self.local) != 0:
|
||||
raise VCSException("Svn update failed")
|
||||
|
||||
def getref(self):
|
||||
p = subprocess.Popen(['svn', 'info'],
|
||||
stdout=subprocess.PIPE, cwd=self.local)
|
||||
for line in p.communicate()[0].splitlines():
|
||||
if line is not None and line.startswith('Last Changed Rev: '):
|
||||
return line[18:]
|
||||
|
||||
class vcs_hg(vcs):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user