2020-06-23 21:56:15 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
|
|
|
# an fdroid plugin for setting up srclibs
|
|
|
|
#
|
|
|
|
# The 'fdroid build' gitlab-ci job uses --on-server, which does not
|
|
|
|
# set up the srclibs. This plugin does the missing setup.
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
import pprint
|
|
|
|
from fdroidserver import _, common, metadata
|
|
|
|
|
|
|
|
fdroid_summary = 'prepare the srclibs for `fdroid build --on-server`'
|
|
|
|
|
|
|
|
|
|
|
|
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 = parser.parse_args()
|
|
|
|
common.options = options
|
|
|
|
pkgs = common.read_pkg_args(options.appid, True)
|
2021-03-16 09:22:55 +01:00
|
|
|
allapps = metadata.read_metadata(pkgs)
|
2020-06-23 21:56:15 +02:00
|
|
|
apps = common.read_app_args(options.appid, allapps, True)
|
2021-03-26 15:49:37 +01:00
|
|
|
common.read_config(options)
|
2020-06-23 21:56:15 +02:00
|
|
|
srclib_dir = os.path.join('build', 'srclib')
|
|
|
|
os.makedirs(srclib_dir, exist_ok=True)
|
|
|
|
srclibpaths = []
|
|
|
|
for appid, app in apps.items():
|
2021-03-16 09:22:55 +01:00
|
|
|
vcs, _ignored = common.setup_vcs(app)
|
2020-06-23 21:56:15 +02:00
|
|
|
for build in app.get('Builds', []):
|
2023-11-16 07:58:55 +01:00
|
|
|
vcs.gotorevision(build.commit, refresh=False)
|
|
|
|
if build.submodules:
|
|
|
|
vcs.initsubmodules()
|
|
|
|
else:
|
|
|
|
vcs.deinitsubmodules()
|
2020-06-23 21:56:15 +02:00
|
|
|
for lib in build.srclibs:
|
2021-04-12 22:11:07 +02:00
|
|
|
srclibpaths.append(common.getsrclib(lib, srclib_dir, prepare=False, build=build))
|
2020-06-23 21:56:15 +02:00
|
|
|
print('Set up srclibs:')
|
|
|
|
pprint.pprint(srclibpaths)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|