mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
move getappname+getcvname to checkupdates, the only place they're used
This commit is contained in:
parent
fdede914cd
commit
3b5e3a62a3
2 changed files with 23 additions and 23 deletions
|
@ -358,6 +358,18 @@ def possible_subdirs(app):
|
||||||
yield subdir
|
yield subdir
|
||||||
|
|
||||||
|
|
||||||
|
def _getappname(app):
|
||||||
|
if app.Name:
|
||||||
|
return app.Name
|
||||||
|
if app.AutoName:
|
||||||
|
return app.AutoName
|
||||||
|
return app.id
|
||||||
|
|
||||||
|
|
||||||
|
def _getcvname(app):
|
||||||
|
return '%s (%s)' % (app.CurrentVersion, app.CurrentVersionCode)
|
||||||
|
|
||||||
|
|
||||||
def fetch_autoname(app, tag):
|
def fetch_autoname(app, tag):
|
||||||
|
|
||||||
if not app.RepoType or app.UpdateCheckMode in ('None', 'Static') \
|
if not app.RepoType or app.UpdateCheckMode in ('None', 'Static') \
|
||||||
|
@ -393,7 +405,7 @@ def fetch_autoname(app, tag):
|
||||||
if new_name != app.AutoName:
|
if new_name != app.AutoName:
|
||||||
app.AutoName = new_name
|
app.AutoName = new_name
|
||||||
if not commitmsg:
|
if not commitmsg:
|
||||||
commitmsg = "Set autoname of {0}".format(common.getappname(app))
|
commitmsg = "Set autoname of {0}".format(_getappname(app))
|
||||||
else:
|
else:
|
||||||
logging.debug("...couldn't get autoname")
|
logging.debug("...couldn't get autoname")
|
||||||
|
|
||||||
|
@ -472,8 +484,8 @@ def checkupdates_app(app):
|
||||||
commitmsg = fetch_autoname(app, tag)
|
commitmsg = fetch_autoname(app, tag)
|
||||||
|
|
||||||
if updating:
|
if updating:
|
||||||
name = common.getappname(app)
|
name = _getappname(app)
|
||||||
ver = common.getcvname(app)
|
ver = _getcvname(app)
|
||||||
logging.info('...updating to version %s' % ver)
|
logging.info('...updating to version %s' % ver)
|
||||||
commitmsg = 'Update CV of %s to %s' % (name, ver)
|
commitmsg = 'Update CV of %s to %s' % (name, ver)
|
||||||
|
|
||||||
|
@ -513,8 +525,8 @@ def checkupdates_app(app):
|
||||||
commit = commit.replace('%c', newbuild.versionCode)
|
commit = commit.replace('%c', newbuild.versionCode)
|
||||||
newbuild.commit = commit
|
newbuild.commit = commit
|
||||||
app.builds.append(newbuild)
|
app.builds.append(newbuild)
|
||||||
name = common.getappname(app)
|
name = _getappname(app)
|
||||||
ver = common.getcvname(app)
|
ver = _getcvname(app)
|
||||||
commitmsg = "Update %s to %s" % (name, ver)
|
commitmsg = "Update %s to %s" % (name, ver)
|
||||||
else:
|
else:
|
||||||
logging.warning('Invalid auto update mode "' + mode + '" on ' + app.id)
|
logging.warning('Invalid auto update mode "' + mode + '" on ' + app.id)
|
||||||
|
@ -610,24 +622,24 @@ def main():
|
||||||
version, reason = check_gplay(app)
|
version, reason = check_gplay(app)
|
||||||
if version is None:
|
if version is None:
|
||||||
if reason == '404':
|
if reason == '404':
|
||||||
logging.info("{0} is not in the Play Store".format(common.getappname(app)))
|
logging.info("{0} is not in the Play Store".format(_getappname(app)))
|
||||||
else:
|
else:
|
||||||
logging.info("{0} encountered a problem: {1}".format(common.getappname(app), reason))
|
logging.info("{0} encountered a problem: {1}".format(_getappname(app), reason))
|
||||||
if version is not None:
|
if version is not None:
|
||||||
stored = app.CurrentVersion
|
stored = app.CurrentVersion
|
||||||
if not stored:
|
if not stored:
|
||||||
logging.info("{0} has no Current Version but has version {1} on the Play Store"
|
logging.info("{0} has no Current Version but has version {1} on the Play Store"
|
||||||
.format(common.getappname(app), version))
|
.format(_getappname(app), version))
|
||||||
elif LooseVersion(stored) < LooseVersion(version):
|
elif LooseVersion(stored) < LooseVersion(version):
|
||||||
logging.info("{0} has version {1} on the Play Store, which is bigger than {2}"
|
logging.info("{0} has version {1} on the Play Store, which is bigger than {2}"
|
||||||
.format(common.getappname(app), version, stored))
|
.format(_getappname(app), version, stored))
|
||||||
else:
|
else:
|
||||||
if stored != version:
|
if stored != version:
|
||||||
logging.info("{0} has version {1} on the Play Store, which differs from {2}"
|
logging.info("{0} has version {1} on the Play Store, which differs from {2}"
|
||||||
.format(common.getappname(app), version, stored))
|
.format(_getappname(app), version, stored))
|
||||||
else:
|
else:
|
||||||
logging.info("{0} has the same version {1} on the Play Store"
|
logging.info("{0} has the same version {1} on the Play Store"
|
||||||
.format(common.getappname(app), version))
|
.format(_getappname(app), version))
|
||||||
update_wiki(gplaylog, None)
|
update_wiki(gplaylog, None)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -664,18 +664,6 @@ def getsrcname(app, build):
|
||||||
return "%s_%s_src.tar.gz" % (app.id, build.versionCode)
|
return "%s_%s_src.tar.gz" % (app.id, build.versionCode)
|
||||||
|
|
||||||
|
|
||||||
def getappname(app):
|
|
||||||
if app.Name:
|
|
||||||
return app.Name
|
|
||||||
if app.AutoName:
|
|
||||||
return app.AutoName
|
|
||||||
return app.id
|
|
||||||
|
|
||||||
|
|
||||||
def getcvname(app):
|
|
||||||
return '%s (%s)' % (app.CurrentVersion, app.CurrentVersionCode)
|
|
||||||
|
|
||||||
|
|
||||||
def get_build_dir(app):
|
def get_build_dir(app):
|
||||||
'''get the dir that this app will be built in'''
|
'''get the dir that this app will be built in'''
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue