From 4b7d29097d3f189aac129dca76d4e6012cf67f31 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 11 Jan 2021 12:05:02 +0100 Subject: [PATCH 1/3] gitlab-ci: new job to test plugins API + `fdroid fetchsrclibs` --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++ examples/fdroid_fetchsrclibs.py | 1 - 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d6b95c3b..e843ab6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -293,6 +293,44 @@ fdroid build: - fdroid build --verbose --on-server --no-tarball --latest org.fdroid.fdroid +plugin_fetchsrclibs: + image: debian:buster + <<: *apt-template + only: + refs: + - branches + - pipelines + changes: + - .gitlab-ci.yml + - examples/fdroid_fetchsrclibs.py + - fdroidserver/__main__.py + script: + - apt-get install + curl + git + python3-pip + python3-venv + - python3 -m venv env + - . env/bin/activate + - export PATH="$CI_PROJECT_DIR:$PATH" + - export PYTHONPATH="$CI_PROJECT_DIR/examples" + - $pip install wheel # to make this go away: "error: invalid command 'bdist_wheel'" + - $pip install -e . + - fdroid | grep fetchsrclibs + + - mkdir fdroiddata + - curl https://gitlab.com/fdroid/fdroiddata/repository/b9e9a077d720c86ff6fff4dbb341254cc4370b1a/archive.tar.gz + | tar -xz --directory=fdroiddata --strip-components=1 + - cd fdroiddata + - fdroid fetchsrclibs freemap.opentrail:9 --verbose + - test -d build/freemap.opentrail/.git + - test -d build/srclib/andromaps/.git + - test -d build/srclib/freemaplib/.git + - test -d build/srclib/freemaplibProj/.git + - test -d build/srclib/JCoord/.git + - test -d build/srclib/javaproj/.git + + # test a full update and deploy cycle to gitlab.com servergitmirrors: image: debian diff --git a/examples/fdroid_fetchsrclibs.py b/examples/fdroid_fetchsrclibs.py index 213a05c5..0a093edf 100644 --- a/examples/fdroid_fetchsrclibs.py +++ b/examples/fdroid_fetchsrclibs.py @@ -15,7 +15,6 @@ 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) From d36f71e048c51fc3fbc935abda4e0049b3fb957e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 11 Jan 2021 13:15:33 +0100 Subject: [PATCH 2/3] make config optional when using common.set_FDroidPopen_env() common.set_FDroidPopen_env() is used to call git and other tools that are not part of the Android SDK nor require Java, so the items that are being set from the config are optional. This lets plugins do quite a bit without ever setting up a config. --- examples/fdroid_fetchsrclibs.py | 4 ---- fdroidserver/common.py | 10 ++++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/fdroid_fetchsrclibs.py b/examples/fdroid_fetchsrclibs.py index 0a093edf..3dc4e423 100644 --- a/examples/fdroid_fetchsrclibs.py +++ b/examples/fdroid_fetchsrclibs.py @@ -14,10 +14,6 @@ fdroid_summary = 'prepare the srclibs for `fdroid build --on-server`' def main(): - common.config = { - '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]")) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 4aebe275..1de841c1 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2741,10 +2741,12 @@ def set_FDroidPopen_env(build=None): if env is None: env = os.environ orig_path = env['PATH'] - for n in ['ANDROID_HOME', 'ANDROID_SDK']: - env[n] = config['sdk_path'] - for k, v in config['java_paths'].items(): - env['JAVA%s_HOME' % k] = v + if config: + if config.get('sdk_path'): + for n in ['ANDROID_HOME', 'ANDROID_SDK']: + env[n] = config['sdk_path'] + for k, v in config.get('java_paths', {}).items(): + env['JAVA%s_HOME' % k] = v missinglocale = True for k, v in env.items(): From 40197295ae3879ceb7047f73f63774f2965d9d03 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 11 Jan 2021 12:05:02 +0100 Subject: [PATCH 3/3] gitlab-ci: remove refs: section to hopefully get reliable job starts "fdroid build" and "plugin_fetchsrclibs" totally failed to run here: https://gitlab.com/eighthave/fdroidserver/-/pipelines/240160903 --- .gitlab-ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e843ab6e..c2adc989 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -247,9 +247,6 @@ gradle: fdroid build: image: registry.gitlab.com/fdroid/ci-images-client only: - refs: - - branches - - pipelines changes: - .gitlab-ci.yml - buildserver/provision-apt-get-install @@ -297,9 +294,6 @@ plugin_fetchsrclibs: image: debian:buster <<: *apt-template only: - refs: - - branches - - pipelines changes: - .gitlab-ci.yml - examples/fdroid_fetchsrclibs.py