mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-10 17:30:11 +01:00
18f3acc32e
There is no longer any reason for these to be intertwined. This deliberately avoids touching some files as much as possible because they are super tangled and due to be replaced. Those files are: * fdroidserver/build.py * fdroidserver/update.py # Conflicts: # tests/testcommon.py # Conflicts: # fdroidserver/btlog.py # fdroidserver/import_subcommand.py
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# an fdroid plugin for resetting app VCSs to the latest version for the metadata
|
|
|
|
import argparse
|
|
import logging
|
|
|
|
from fdroidserver import _, common, metadata
|
|
|
|
from fdroidserver.exception import VCSException
|
|
|
|
fdroid_summary = 'reset app VCSs to the latest version'
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]"
|
|
)
|
|
common.setup_global_opts(parser)
|
|
parser.add_argument(
|
|
"appid",
|
|
nargs='*',
|
|
help=_("applicationId with optional versionCode in the form APPID[:VERCODE]"),
|
|
)
|
|
metadata.add_metadata_arguments(parser)
|
|
options = common.parse_args(parser)
|
|
pkgs = common.read_pkg_args(options.appid, True)
|
|
allapps = metadata.read_metadata(pkgs)
|
|
apps = common.read_app_args(options.appid, allapps, True)
|
|
common.read_config()
|
|
|
|
for appid, app in apps.items():
|
|
if "Builds" in app and len(app["Builds"]) > 0:
|
|
build = app.get('Builds')[-1]
|
|
logging.info(_("Cleaning up '{appid}' VCS").format(appid=appid))
|
|
try:
|
|
vcs, build_dir = common.setup_vcs(app)
|
|
vcs.gotorevision(build.commit)
|
|
if build.submodules:
|
|
vcs.initsubmodules()
|
|
|
|
except VCSException:
|
|
pass
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|