fdroidserver.build_local_run module

Build one specific in app, assuming all required build tools are installed and configured.

fdroidserver.build_local_run.build_local_run_wrapper(appid, versionCode, config)

Run build for one specific version of an app localy.

Raises:

various exceptions in case and of the pre-required conditions for the requested build are not met

fdroidserver.build_local_run.check_build_success(app, build, p)
fdroidserver.build_local_run.collect_build_output(app, build, p, bindir)
fdroidserver.build_local_run.execute_build(app, build, config, gradletasks)
fdroidserver.build_local_run.execute_build_commands(app, build)

Execute bulid commands if present in metadata.

see: https://f-droid.org/docs/Build_Metadata_Reference/#build_build

Parameters:
app

metadata app object

build

metadata build object

fdroidserver.build_local_run.execute_buildjni_commands(app, build)
fdroidserver.build_local_run.execute_postbuild(app, build, src)
fdroidserver.build_local_run.get_build_root_dir(app, build)
fdroidserver.build_local_run.get_flavours_cmd(build)

Get flavor string, preformatted for gradle cli.

Reads build flavors form metadata if any and reformats and concatenates them to be ready for use as CLI arguments to gradle. This will treat the vlue ‘yes’ as if there were not particular build flavor selected.

Parameters:
build

The metadata build entry you’d like to read flavors from

Returns:
A string containing the build flavor for this build. If it’s the default
flavor (“yes” in metadata) this returns an empty string. Returns None if
it’s not a gradle build.
fdroidserver.build_local_run.get_metadata_from_apk(app, build, apkfile)

Get the required metadata from the built APK.

VersionName is allowed to be a blank string, i.e. ‘’

Parameters:
app

The app metadata used to build the APK.

build

The build that resulted in the APK.

apkfile

The path of the APK file.

Returns:
versionCode

The versionCode from the APK or from the metadata is build.novcheck is set.

versionName

The versionName from the APK or from the metadata is build.novcheck is set.

Raises:
BuildException

If native code should have been built but was not packaged, no version information or no package ID could be found or there is a mismatch between the package ID in the metadata and the one found in the APK.

fdroidserver.build_local_run.get_srclibpaths(app, build)

Get srclibpaths list of tuples.

This will just assemble the srclibpaths list of tuples, it won’t fetch or checkout any source code, identical to return value of common.prepare_souce().

Parameters:
app

metadata app object

build

metadata build object

Returns:
List of srclibpath tuples
fdroidserver.build_local_run.init_build(app, build, config)
fdroidserver.build_local_run.main()
fdroidserver.build_local_run.move_build_output(app, build, src, output_dir='unsigned')
fdroidserver.build_local_run.rlimit_check(apps_count=1)

Make sure Linux is configured to allow for enough simultaneously open files.

TODO: check if this is obsolete

Parameters:
apps_count

In the past this used to be len(apps) In this context we’re always buidling just one app so this is always 1

fdroidserver.build_local_run.sanitize_build_dir(app)

Delete build output directories.

This function deletes the default build/binary/target/… output directories for follwoing build tools: gradle, maven, ant, jni. It also deletes gradle-wrapper if present. It just uses parths, hardcoded here, it doesn’t call and build system clean routines.

Parameters:
app

The metadata of the app to sanitize

fdroidserver.build_local_run.transform_first_char(string, method)

Use method() on the first character of string.

fdroidserver.build_local_run.validate_build_artifacts(app, build, src)