From 4329629f970306d2ccae9dca139f953e17bf8293 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 15 Jan 2019 11:16:48 +0100 Subject: [PATCH 1/4] [Travis] Allow the desktop appimage build to fail. `linuxqtdeploy` recently add a test on the running system (libc version) and refuse to run if the libc is too recent. So we would need to run `linuxqtdeploy` only on ubuntu 14.04. However, we also need `qtwebengine5-dev` package whom is available only since ubuntu 18.04. While we find a solution (see comments in the linuxdeployqt issue), we have to allow the appimage build to fail. See probonopd/linuxdeployqt#340 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2e0e152..b001a4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,6 +76,7 @@ addons: - libmagic-dev matrix: allow_failures: + - env: PLATFORM="native_dyn" DESKTOP_ONLY=1 - env: PLATFORM="android_arm" - env: PLATFORM="android_arm64" - env: PLATFORM="android_mips" From 961076bb87686c6449e485dd28170dabb88f93d3 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 15 Jan 2019 11:26:11 +0100 Subject: [PATCH 2/4] [ANDROID] Build only the apk, not everything. It seems that build everything on android side is a bit too expensive. Let's do as is done on android CI, build only the apk. --- kiwixbuild/dependencies/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiwixbuild/dependencies/base.py b/kiwixbuild/dependencies/base.py index dfec6fa..bee1e9a 100644 --- a/kiwixbuild/dependencies/base.py +++ b/kiwixbuild/dependencies/base.py @@ -470,7 +470,7 @@ class MesonBuilder(Builder): class GradleBuilder(Builder): - gradle_target = "build" + gradle_target = "assembleKiwixRelease assembleKiwixDebug" gradle_option = "-i --no-daemon --build-cache" def build(self): From c4a3da03c3661862c9501a93ca328638ef40f558 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 15 Jan 2019 14:44:02 +0100 Subject: [PATCH 3/4] Correctly install mustache in flatpak. We need a simple buildsystem to "build" mustache" as we simply need to copy the header. --- kiwixbuild/dependencies/base.py | 15 +++++++++++++++ kiwixbuild/dependencies/mustache.py | 3 +++ kiwixbuild/flatpak_builder.py | 11 +---------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/kiwixbuild/dependencies/base.py b/kiwixbuild/dependencies/base.py index bee1e9a..feb8d03 100644 --- a/kiwixbuild/dependencies/base.py +++ b/kiwixbuild/dependencies/base.py @@ -263,6 +263,12 @@ class Builder: self.command('configure', self._configure) self.command('make_dist', self._make_dist) + def set_flatpak_buildsystem(self, module): + if getattr(self, 'flatpak_buildsystem', None): + module['buildsystem'] = self.flatpak_buildsystem + if getattr(self, 'configure_option', ''): + module['config-opts'] = self.configure_option.split(' ') + class NoopBuilder(Builder): def build(self): @@ -283,6 +289,7 @@ class MakeBuilder(Builder): configure_env = None make_target = "" make_install_target = "install" + flatpak_buildsystem = None @property def all_configure_option(self): @@ -337,6 +344,8 @@ class MakeBuilder(Builder): class CMakeBuilder(MakeBuilder): + flatpak_buildsystem = 'cmake' + def _configure(self, context): context.try_skip(self.build_path) cross_option = "" @@ -367,9 +376,14 @@ class CMakeBuilder(MakeBuilder): env.update(self.configure_env) run_command(command, self.build_path, context, env=env, buildEnv=self.buildEnv, cross_env_only=True) + def set_flatpak_buildsystem(self, module): + super().set_flatpak_buildsystem( module) + module['buildir'] = True + class QMakeBuilder(MakeBuilder): qmake_target = "" + flatpak_buildsystem = 'qmake' @property def env_option(self): @@ -416,6 +430,7 @@ class QMakeBuilder(MakeBuilder): class MesonBuilder(Builder): configure_option = "" test_option = "" + flatpak_buildsystem = 'meson' @property def library_type(self): diff --git a/kiwixbuild/dependencies/mustache.py b/kiwixbuild/dependencies/mustache.py index 625cb50..820e901 100644 --- a/kiwixbuild/dependencies/mustache.py +++ b/kiwixbuild/dependencies/mustache.py @@ -24,3 +24,6 @@ class Mustache(Dependency): copy2(pj(self.source_path, 'mustache.hpp'), pj(self.buildEnv.install_dir, 'include')) + def set_flatpak_buildsystem(self, module): + module['buildsystem'] = 'simple' + module['build-commands'] = ['cp mustache.hpp /app/include'] diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index 50bdba0..1fb2c0a 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -171,17 +171,8 @@ class FlatpakBuilder: else: builder = get_target_step(stepDef) - if isinstance(builder, MesonBuilder): - module['buildsystem'] = 'meson' - elif isinstance(builder, CMakeBuilder): - module['buildsystem'] = 'cmake' - module['builddir'] = True - elif isinstance(builder, QMakeBuilder): - module['buildsystem'] = 'qmake' - # config-opts + builder.set_flatpak_buildsystem(module) print(module['name']) - if getattr(builder, 'configure_option', ''): - module['config-opts'] = builder.configure_option.split(' ') manifest = MANIFEST.copy() modules = [m for m in modules.values() if m.get('sources')] From 4160673c3a5f853d01a7e5de299e643d3561d7d3 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 15 Jan 2019 14:50:06 +0100 Subject: [PATCH 4/4] Correctly raise StopBuild in case of error when building flatpak. --- kiwixbuild/flatpak_builder.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index 1fb2c0a..bc0c727 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -208,12 +208,9 @@ class FlatpakBuilder: run_command(command, self.platform.buildEnv.build_dir, context, self.platform.buildEnv) context._finalise() except subprocess.CalledProcessError: - try: - with open(log, 'r') as f: - print(f.read()) - raise StopBuild() - except: - pass + with open(log, 'r') as f: + print(f.read()) + raise StopBuild() def bundle(self): log = pj(self.platform.buildEnv.log_dir, 'cmd_bundle_flatpak.log') @@ -224,12 +221,9 @@ class FlatpakBuilder: run_command(command, self.platform.buildEnv.build_dir, context, self.platform.buildEnv) context._finalise() except subprocess.CalledProcessError: - try: - with open(log, 'r') as f: - print(f.read()) - raise StopBuild() - except: - pass + with open(log, 'r') as f: + print(f.read()) + raise StopBuild() def _get_packages(self):