mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Wait a sec before snapshot
This commit is contained in:
parent
7f43aa376b
commit
73c3a78fc6
2 changed files with 108 additions and 96 deletions
|
|
@ -147,6 +147,8 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||||
print "Saving clean state of new build server"
|
print "Saving clean state of new build server"
|
||||||
if subprocess.call(['vagrant', 'suspend'], cwd='builder') != 0:
|
if subprocess.call(['vagrant', 'suspend'], cwd='builder') != 0:
|
||||||
raise BuildException("Failed to suspend build server")
|
raise BuildException("Failed to suspend build server")
|
||||||
|
print "...waiting a sec..."
|
||||||
|
time.sleep(10)
|
||||||
if subprocess.call(['VBoxManage', 'snapshot', get_builder_vm_id(), 'take', 'fdroidclean'],
|
if subprocess.call(['VBoxManage', 'snapshot', get_builder_vm_id(), 'take', 'fdroidclean'],
|
||||||
cwd='builder') != 0:
|
cwd='builder') != 0:
|
||||||
raise BuildException("Failed to take snapshot")
|
raise BuildException("Failed to take snapshot")
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,8 @@ def main():
|
||||||
help="Check only the specified package")
|
help="Check only the specified package")
|
||||||
parser.add_option("--auto", action="store_true", default=False,
|
parser.add_option("--auto", action="store_true", default=False,
|
||||||
help="Process auto-updates")
|
help="Process auto-updates")
|
||||||
|
parser.add_option("--autoonly", action="store_true", default=False,
|
||||||
|
help="Only process apps with auto-updates")
|
||||||
parser.add_option("--commit", action="store_true", default=False,
|
parser.add_option("--commit", action="store_true", default=False,
|
||||||
help="Commit changes")
|
help="Commit changes")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
@ -235,110 +237,118 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
print "Processing " + app['id'] + '...'
|
|
||||||
|
|
||||||
writeit = False
|
process = True
|
||||||
logmsg = None
|
|
||||||
|
|
||||||
mode = app['Update Check Mode']
|
if options.autoonly and app['Auto Update Mode'] == 'None':
|
||||||
if mode == 'Market':
|
process = False
|
||||||
(version, vercode) = check_market(app)
|
|
||||||
elif mode == 'Tags':
|
|
||||||
(version, vercode) = check_tags(app, sdk_path)
|
|
||||||
elif mode == 'RepoManifest':
|
|
||||||
(version, vercode) = check_repomanifest(app, sdk_path)
|
|
||||||
elif mode.startswith('RepoManifest/'):
|
|
||||||
(version, vercode) = check_repomanifest(app, sdk_path, mode[13:])
|
|
||||||
elif mode == 'Static':
|
|
||||||
version = None
|
|
||||||
vercode = 'Checking disabled'
|
|
||||||
elif mode == 'None':
|
|
||||||
version = None
|
|
||||||
vercode = 'Checking disabled'
|
|
||||||
else:
|
|
||||||
version = None
|
|
||||||
vercode = 'Invalid update check method'
|
|
||||||
|
|
||||||
if not version:
|
if process:
|
||||||
print "..." + vercode
|
|
||||||
elif vercode == app['Current Version Code'] and version == app['Current Version']:
|
|
||||||
print "...up to date"
|
|
||||||
else:
|
|
||||||
print '...updating to version:' + version + ' vercode:' + vercode
|
|
||||||
app['Current Version'] = version
|
|
||||||
app['Current Version Code'] = str(int(vercode))
|
|
||||||
writeit = True
|
|
||||||
logmsg = "Update current version of " + app['id'] + " to " + version
|
|
||||||
|
|
||||||
# Do the Auto Name thing...
|
print "Processing " + app['id'] + '...'
|
||||||
if len(app["Repo Type"]) > 0:
|
|
||||||
|
|
||||||
try:
|
writeit = False
|
||||||
|
logmsg = None
|
||||||
|
|
||||||
if app['Repo Type'] == 'srclib':
|
mode = app['Update Check Mode']
|
||||||
app_dir = os.path.join('build', 'srclib', app['Repo'])
|
if mode == 'Market':
|
||||||
else:
|
(version, vercode) = check_market(app)
|
||||||
app_dir = os.path.join('build/', app['id'])
|
elif mode == 'Tags':
|
||||||
|
(version, vercode) = check_tags(app, sdk_path)
|
||||||
vcs = common.getvcs(app["Repo Type"], app["Repo"], app_dir, sdk_path)
|
elif mode == 'RepoManifest':
|
||||||
vcs.gotorevision(None)
|
(version, vercode) = check_repomanifest(app, sdk_path)
|
||||||
|
elif mode.startswith('RepoManifest/'):
|
||||||
if len(app['builds']) > 0:
|
(version, vercode) = check_repomanifest(app, sdk_path, mode[13:])
|
||||||
if 'subdir' in app['builds'][-1]:
|
elif mode == 'Static':
|
||||||
app_dir = os.path.join(app_dir, app['builds'][-1]['subdir'])
|
version = None
|
||||||
|
vercode = 'Checking disabled'
|
||||||
new_name = common.fetch_real_name(app_dir)
|
elif mode == 'None':
|
||||||
if new_name != app['Auto Name']:
|
version = None
|
||||||
app['Auto Name'] = new_name
|
vercode = 'Checking disabled'
|
||||||
if not writeit:
|
|
||||||
writeit = True
|
|
||||||
except Exception:
|
|
||||||
msg = "Auto Name failed for %s due to exception: %s" % (app['id'], traceback.format_exc())
|
|
||||||
|
|
||||||
if options.auto:
|
|
||||||
mode = app['Auto Update Mode']
|
|
||||||
if mode == 'None':
|
|
||||||
pass
|
|
||||||
elif mode.startswith('Version '):
|
|
||||||
pattern = mode[8:]
|
|
||||||
if pattern.startswith('+'):
|
|
||||||
o = pattern.find(' ')
|
|
||||||
suffix = pattern[1:o]
|
|
||||||
pattern = pattern[o + 1:]
|
|
||||||
else:
|
|
||||||
suffix = ''
|
|
||||||
gotcur = False
|
|
||||||
latest = None
|
|
||||||
for build in app['builds']:
|
|
||||||
if build['vercode'] == app['Current Version Code']:
|
|
||||||
gotcur = True
|
|
||||||
if not latest or int(build['vercode']) > int(latest['vercode']):
|
|
||||||
latest = build
|
|
||||||
if not gotcur:
|
|
||||||
newbuild = latest.copy()
|
|
||||||
del newbuild['origlines']
|
|
||||||
newbuild['vercode'] = app['Current Version Code']
|
|
||||||
newbuild['version'] = app['Current Version'] + suffix
|
|
||||||
print "...auto-generating build for " + newbuild['version']
|
|
||||||
commit = pattern.replace('%v', newbuild['version'])
|
|
||||||
commit = commit.replace('%c', newbuild['vercode'])
|
|
||||||
newbuild['commit'] = commit
|
|
||||||
app['builds'].append(newbuild)
|
|
||||||
writeit = True
|
|
||||||
logmsg = "Update " + app['id'] + " to " + newbuild['version']
|
|
||||||
else:
|
else:
|
||||||
print 'Invalid auto update mode'
|
version = None
|
||||||
|
vercode = 'Invalid update check method'
|
||||||
|
|
||||||
if writeit:
|
if not version:
|
||||||
metafile = os.path.join('metadata', app['id'] + '.txt')
|
print "..." + vercode
|
||||||
common.write_metadata(metafile, app)
|
elif vercode == app['Current Version Code'] and version == app['Current Version']:
|
||||||
if options.commit and logmsg:
|
print "...up to date"
|
||||||
if subprocess.call("git add " + metafile, shell=True) != 0:
|
else:
|
||||||
print "Git add failed"
|
print '...updating to version:' + version + ' vercode:' + vercode
|
||||||
sys.exit(1)
|
app['Current Version'] = version
|
||||||
if subprocess.call("git commit -m '" + logmsg.replace("'", "\\'") + "'", shell=True) != 0:
|
app['Current Version Code'] = str(int(vercode))
|
||||||
print "Git commit failed"
|
writeit = True
|
||||||
sys.exit(1)
|
logmsg = "Update current version of " + app['id'] + " to " + version
|
||||||
|
|
||||||
|
# Do the Auto Name thing...
|
||||||
|
if len(app["Repo Type"]) > 0:
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
if app['Repo Type'] == 'srclib':
|
||||||
|
app_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
|
else:
|
||||||
|
app_dir = os.path.join('build/', app['id'])
|
||||||
|
|
||||||
|
vcs = common.getvcs(app["Repo Type"], app["Repo"], app_dir, sdk_path)
|
||||||
|
vcs.gotorevision(None)
|
||||||
|
|
||||||
|
if len(app['builds']) > 0:
|
||||||
|
if 'subdir' in app['builds'][-1]:
|
||||||
|
app_dir = os.path.join(app_dir, app['builds'][-1]['subdir'])
|
||||||
|
|
||||||
|
new_name = common.fetch_real_name(app_dir)
|
||||||
|
if new_name != app['Auto Name']:
|
||||||
|
app['Auto Name'] = new_name
|
||||||
|
if not writeit:
|
||||||
|
writeit = True
|
||||||
|
except Exception:
|
||||||
|
msg = "Auto Name failed for %s due to exception: %s" % (app['id'], traceback.format_exc())
|
||||||
|
|
||||||
|
if options.auto:
|
||||||
|
mode = app['Auto Update Mode']
|
||||||
|
if mode == 'None':
|
||||||
|
pass
|
||||||
|
elif mode.startswith('Version '):
|
||||||
|
pattern = mode[8:]
|
||||||
|
if pattern.startswith('+'):
|
||||||
|
o = pattern.find(' ')
|
||||||
|
suffix = pattern[1:o]
|
||||||
|
pattern = pattern[o + 1:]
|
||||||
|
else:
|
||||||
|
suffix = ''
|
||||||
|
gotcur = False
|
||||||
|
latest = None
|
||||||
|
for build in app['builds']:
|
||||||
|
if build['vercode'] == app['Current Version Code']:
|
||||||
|
gotcur = True
|
||||||
|
if not latest or int(build['vercode']) > int(latest['vercode']):
|
||||||
|
latest = build
|
||||||
|
if not gotcur:
|
||||||
|
newbuild = latest.copy()
|
||||||
|
del newbuild['origlines']
|
||||||
|
newbuild['vercode'] = app['Current Version Code']
|
||||||
|
newbuild['version'] = app['Current Version'] + suffix
|
||||||
|
print "...auto-generating build for " + newbuild['version']
|
||||||
|
commit = pattern.replace('%v', newbuild['version'])
|
||||||
|
commit = commit.replace('%c', newbuild['vercode'])
|
||||||
|
newbuild['commit'] = commit
|
||||||
|
app['builds'].append(newbuild)
|
||||||
|
writeit = True
|
||||||
|
logmsg = "Update " + app['id'] + " to " + newbuild['version']
|
||||||
|
else:
|
||||||
|
print 'Invalid auto update mode'
|
||||||
|
|
||||||
|
if writeit:
|
||||||
|
metafile = os.path.join('metadata', app['id'] + '.txt')
|
||||||
|
common.write_metadata(metafile, app)
|
||||||
|
if options.commit and logmsg:
|
||||||
|
if subprocess.call("git add " + metafile, shell=True) != 0:
|
||||||
|
print "Git add failed"
|
||||||
|
sys.exit(1)
|
||||||
|
if subprocess.call("git commit -m '" + logmsg.replace("'", "\\'") + "'", shell=True) != 0:
|
||||||
|
print "Git commit failed"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
print "Finished."
|
print "Finished."
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue