mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01:00
Simplify/unify checkupdates file write and commit message
This commit is contained in:
parent
e6842d0078
commit
44e9ee436b
@ -346,8 +346,9 @@ def main():
|
|||||||
|
|
||||||
logging.info("Processing " + app['id'] + '...')
|
logging.info("Processing " + app['id'] + '...')
|
||||||
|
|
||||||
writeit = False
|
# If a change is made, commitmsg should be set to a description of it.
|
||||||
logmsg = None
|
# Only if this is set will changes be written back to the metadata.
|
||||||
|
commitmsg = None
|
||||||
|
|
||||||
tag = None
|
tag = None
|
||||||
msg = None
|
msg = None
|
||||||
@ -391,7 +392,6 @@ def main():
|
|||||||
app['Current Version'] = version
|
app['Current Version'] = version
|
||||||
app['Current Version Code'] = str(int(vercode))
|
app['Current Version Code'] = str(int(vercode))
|
||||||
updating = True
|
updating = True
|
||||||
writeit = True
|
|
||||||
|
|
||||||
# Do the Auto Name thing as well as finding the CV real name
|
# Do the Auto Name thing as well as finding the CV real name
|
||||||
if len(app["Repo Type"]) > 0 and mode not in ('None', 'Static'):
|
if len(app["Repo Type"]) > 0 and mode not in ('None', 'Static'):
|
||||||
@ -416,17 +416,15 @@ def main():
|
|||||||
new_name = common.fetch_real_name(app_dir, flavour)
|
new_name = common.fetch_real_name(app_dir, flavour)
|
||||||
if new_name != app['Auto Name']:
|
if new_name != app['Auto Name']:
|
||||||
app['Auto Name'] = new_name
|
app['Auto Name'] = new_name
|
||||||
writeit = True
|
if not commitmsg:
|
||||||
if not logmsg:
|
commitmsg = "Set autoname of {0}".format(common.getappname(app))
|
||||||
logmsg = "Set autoname of {0}".format(common.getappname(app))
|
|
||||||
|
|
||||||
if app['Current Version'].startswith('@string/'):
|
if app['Current Version'].startswith('@string/'):
|
||||||
cv = common.version_name(app['Current Version'], app_dir, flavour)
|
cv = common.version_name(app['Current Version'], app_dir, flavour)
|
||||||
if app['Current Version'] != cv:
|
if app['Current Version'] != cv:
|
||||||
app['Current Version'] = cv
|
app['Current Version'] = cv
|
||||||
writeit = True
|
if not commitmsg:
|
||||||
if not logmsg:
|
commitmsg = "Fix CV of {0}".format(common.getappname(app))
|
||||||
logmsg = "Fix CV of {0}".format(common.getappname(app))
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.error("Auto Name or Current Version failed for {0} due to exception: {1}".format(app['id'], traceback.format_exc()))
|
logging.error("Auto Name or Current Version failed for {0} due to exception: {1}".format(app['id'], traceback.format_exc()))
|
||||||
|
|
||||||
@ -434,7 +432,7 @@ def main():
|
|||||||
name = common.getappname(app)
|
name = common.getappname(app)
|
||||||
ver = common.getcvname(app)
|
ver = common.getcvname(app)
|
||||||
logging.info('...updating to version %s' % ver)
|
logging.info('...updating to version %s' % ver)
|
||||||
logmsg = 'Update CV of %s to %s' % (name, ver)
|
commitmsg = 'Update CV of %s to %s' % (name, ver)
|
||||||
|
|
||||||
if options.auto:
|
if options.auto:
|
||||||
mode = app['Auto Update Mode']
|
mode = app['Auto Update Mode']
|
||||||
@ -470,20 +468,19 @@ def main():
|
|||||||
commit = commit.replace('%c', newbuild['vercode'])
|
commit = commit.replace('%c', newbuild['vercode'])
|
||||||
newbuild['commit'] = commit
|
newbuild['commit'] = commit
|
||||||
app['builds'].append(newbuild)
|
app['builds'].append(newbuild)
|
||||||
writeit = True
|
|
||||||
name = common.getappname(app)
|
name = common.getappname(app)
|
||||||
ver = common.getcvname(app)
|
ver = common.getcvname(app)
|
||||||
logmsg = "Update %s to %s" % (name, ver)
|
commitmsg = "Update %s to %s" % (name, ver)
|
||||||
else:
|
else:
|
||||||
logging.warn('Invalid auto update mode "' + mode + '" on ' + app['id'])
|
logging.warn('Invalid auto update mode "' + mode + '" on ' + app['id'])
|
||||||
|
|
||||||
if writeit:
|
if commitmsg:
|
||||||
metafile = os.path.join('metadata', app['id'] + '.txt')
|
metafile = os.path.join('metadata', app['id'] + '.txt')
|
||||||
metadata.write_metadata(metafile, app)
|
metadata.write_metadata(metafile, app)
|
||||||
if options.commit and logmsg:
|
if options.commit:
|
||||||
logging.info("Commiting update for " + metafile)
|
logging.info("Commiting update for " + metafile)
|
||||||
gitcmd = ["git", "commit", "-m",
|
gitcmd = ["git", "commit", "-m",
|
||||||
logmsg]
|
commitmsg]
|
||||||
if 'auto_author' in config:
|
if 'auto_author' in config:
|
||||||
gitcmd.extend(['--author', config['auto_author']])
|
gitcmd.extend(['--author', config['auto_author']])
|
||||||
gitcmd.extend(["--", metafile])
|
gitcmd.extend(["--", metafile])
|
||||||
|
Loading…
Reference in New Issue
Block a user