mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
example plugin for fetching srclibs
This is used in _fdroiddata_'s `fdroid build` CI job, and _issuebot_. This uses @uniqx's awesome new 'plugin' feature to create a 'fetchsrclibs` command. The 'fdroid build' gitlab-ci job uses --on-server, which does not set up the srclibs. This plugin does the missing setup. This is moved from _fdroiddata_ where it was _tools/fdroid_fetchsrclibs.py_.
This commit is contained in:
parent
03aba988b2
commit
330ca2319c
2 changed files with 44 additions and 1 deletions
43
examples/fdroid_fetchsrclibs.py
Normal file
43
examples/fdroid_fetchsrclibs.py
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/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():
|
||||||
|
common.config = {
|
||||||
|
'accepted_formats': 'yml',
|
||||||
|
'sdk_path': os.getenv('ANDROID_HOME'),
|
||||||
|
}
|
||||||
|
common.fill_config_defaults(common.config)
|
||||||
|
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)
|
||||||
|
allapps = metadata.read_metadata(pkgs)
|
||||||
|
apps = common.read_app_args(options.appid, allapps, True)
|
||||||
|
srclib_dir = os.path.join('build', 'srclib')
|
||||||
|
os.makedirs(srclib_dir, exist_ok=True)
|
||||||
|
srclibpaths = []
|
||||||
|
for appid, app in apps.items():
|
||||||
|
for build in app.get('Builds', []):
|
||||||
|
for lib in build.srclibs:
|
||||||
|
srclibpaths.append(common.getsrclib(lib, srclib_dir, build=build))
|
||||||
|
print('Set up srclibs:')
|
||||||
|
pprint.pprint(srclibpaths)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -8,7 +8,7 @@ exec 1>&2
|
||||||
|
|
||||||
files=`git diff-index --cached HEAD 2>&1 | sed 's/^:.* //' | uniq | cut -b100-500`
|
files=`git diff-index --cached HEAD 2>&1 | sed 's/^:.* //' | uniq | cut -b100-500`
|
||||||
if [ -z "$files" ]; then
|
if [ -z "$files" ]; then
|
||||||
PY_FILES="fdroid makebuildserver setup.py fdroidserver/*.py"
|
PY_FILES="fdroid makebuildserver setup.py fdroidserver/*.py examples/*.py"
|
||||||
PY_TEST_FILES="tests/*.TestCase"
|
PY_TEST_FILES="tests/*.TestCase"
|
||||||
SH_FILES="hooks/pre-commit"
|
SH_FILES="hooks/pre-commit"
|
||||||
BASH_FILES="gradlew-fdroid jenkins-build-all jenkins-setup-build-environment jenkins-test completion/bash-completion buildserver/provision-*"
|
BASH_FILES="gradlew-fdroid jenkins-build-all jenkins-setup-build-environment jenkins-test completion/bash-completion buildserver/provision-*"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue