How to set up srclibs when running a container

Hi, we are trying to use the provided container image for fdroidserver to test the app build locally.

There were few issues. One was that sudo commands would not run which we worked around with a --on-server argument. Another issue is that srclibs are not installed. There is an example script (/examples/fdroid_fetchsrclibs.py) but it’s not clear how to apply it in a container, at least easily.

We would appreciate any advice. Running build in a container could be a great opportunity to test app builds locally, if these obstacles were removed.

If you want to build com.example:1, then you can run fdroid fetchsrclibs com.example:1 first.

ah, thank you for the quick reply!

Unfortunately it does not seem to work:

$ podman run --rm -v $(pwd):/repo -v /opt/android-sdk-linux:/opt/android-sdk -e ANDROID_HOME:/opt/android-sdk registry.gitlab.com/fdroid/docker-executable-fdroidserver:master fetchsrclibs de.tutao.tutanota
Command 'fetchsrclibs' not recognised.

usage: fdroid [<command>] [-h|--help|--version|<args>]

Valid commands are:
   build          Build a package from source
   init           Quickly start a new repository
   publish        Sign and place packages in the repo
   gpgsign        Add PGP signatures using GnuPG for packages in repo
   update         Update repo information for new packages
   deploy         Interact with the repo HTTP server
   verify         Verify the integrity of downloaded packages
   checkupdates   Check for updates to applications
   import         Extract application metadata from a source repository
   install        Install built packages on devices
   readmeta       Read all the metadata files and exit
   rewritemeta    Rewrite all the metadata files
   lint           Warn about possible metadata errors
   scanner        Scan the source code of a package
   signindex      Sign indexes created using update --nosign
   btlog          Update the binary transparency log for a URL
   signatures     Extract signatures from APKs
   nightly        Set up an app build for a nightly build repo
   mirror         Download complete mirrors of small repos

could it be that the plugin is not installed in the provided image?

.gitlab-ci.yml · master · F-Droid / Data · GitLab This env var needs to be added.

1 Like

We ended up doing something like this:

podman run --rm -it -v $(pwd):/repo -v /opt/android-sdk-linux:/opt/android-sdk -e ANDROID_HOME:/opt/android-sdk --entrypoint=/bin/bash registry.gitlab.com/fdroid/docker-executable-fdroidserver:master

source /etc/profile.d/bsenv.sh;
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";
ln -s $PWD/srclibs/ $home_vagrant/srclibs;
mkdir $home_vagrant/metadata;
cp metadata/de.tutao.tutanota.yml $home_vagrant/metadata/;
pushd $home_vagrant;
$fdroid fetchsrclibs de.tutao.tutanota:396436 --verbose;
$fdroid build --verbose --test --on-server --no-tarball de.tutao.tutanota:396436;

could probably back it into another entrypoint or another image