From 11bff68d98ab32031b1a3b7941c894b08b6d919a Mon Sep 17 00:00:00 2001 From: ivk Date: Tue, 14 Jan 2025 16:01:00 +0100 Subject: [PATCH] Add Dockerfile for local F-Droid builds --- ci/containers/README.md | 8 ++++++- ci/containers/fdroid-build.dockerfile | 5 +++++ ci/containers/fdroid-build.sh | 31 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 ci/containers/fdroid-build.dockerfile create mode 100644 ci/containers/fdroid-build.sh diff --git a/ci/containers/README.md b/ci/containers/README.md index c4fc11fc22ea..3bf487fe5db2 100644 --- a/ci/containers/README.md +++ b/ci/containers/README.md @@ -10,4 +10,10 @@ You're going to have to do this as root unless you have rootless containers set * remove the container: ```podman rm linux-build``` * remove the image: - ```podman image rm linux-build:latest``` \ No newline at end of file + ```podman image rm linux-build:latest``` + +## F-Droid container +* building the image + ``` podman build -t fdroid --network=host -f ci/containers/fdroid-build.dockerfile``` +* run a build against the latest metadata version (run in fdroiddata repo) + ``` podman run --rm -v $(pwd):/repo -v /opt/android-sdk-linux:/opt/android-sdk -e ANDROID_HOME:/opt/android-sdk fdroid``` \ No newline at end of file diff --git a/ci/containers/fdroid-build.dockerfile b/ci/containers/fdroid-build.dockerfile new file mode 100644 index 000000000000..aa112818a427 --- /dev/null +++ b/ci/containers/fdroid-build.dockerfile @@ -0,0 +1,5 @@ +FROM registry.gitlab.com/fdroid/docker-executable-fdroidserver:master + +COPY fdroid-build.sh / + +ENTRYPOINT ["bash", "/fdroid-build.sh"] \ No newline at end of file diff --git a/ci/containers/fdroid-build.sh b/ci/containers/fdroid-build.sh new file mode 100644 index 000000000000..0d76c6abc636 --- /dev/null +++ b/ci/containers/fdroid-build.sh @@ -0,0 +1,31 @@ +#!/bin/env bash + +set -x; + +echo "Building latest de.tutao.tutanota" +VERCODE=$(grep CurrentVersionCode metadata/de.tutao.tutanota.yml | awk '{print $2}') +echo "Version: $VERCODE" + +# get all those good env vars that we need (like $fdroidserver and $home_vagrant) +source /etc/profile.d/bsenv.sh; + +# PYTHONPATH is needed to find the plugins, we need fetchsrclibs. +export fdroid="sudo --preserve-env --user vagrant + env PATH=$fdroidserver:$PATH + env PYTHONPATH=$fdroidserver:$fdroidserver/examples + env PYTHONUNBUFFERED=true + env TERM=$TERM + env HOME=$home_vagrant + fdroid"; + +# We move the data we need into vagrant home. There are some guards against just running in the data repo. +ln -s $PWD/srclibs/ $home_vagrant/srclibs; +mkdir $home_vagrant/metadata; +cp metadata/de.tutao.tutanota.yml $home_vagrant/metadata/; + +# Start the build in home dir. +cd $home_vagrant; +# This will fetch rustup for us but not actually install anything. +$fdroid fetchsrclibs de.tutao.tutanota:$VERCODE --verbose; +# Run the actual build. +$fdroid build --verbose --test --on-server --no-tarball de.tutao.tutanota:$VERCODE; \ No newline at end of file