From 7b6ed275ed5ec41596cd70495ea1ce7a514b8386 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 12 May 2023 10:36:49 +0200 Subject: [PATCH] Remove code for kiwix-desktop workaround. As we don't use the workaround now, we can remove the code associated to it. It simplify our build definition. --- .github/scripts/build_definition.py | 88 +++++++++++++---------------- .github/scripts/common.py | 8 --- .github/scripts/compile_all_deps.py | 2 - 3 files changed, 40 insertions(+), 58 deletions(-) diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 9ab92cd..82901f0 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -3,7 +3,7 @@ import csv, io, re # Definition of what to build. # Array is read line by line. -# Empty cells under (OS_NAME, DESKTOP, PLATFORM_TARGET) mean "always match" (catch all, or `.*` regex) +# Empty cells under (OS_NAME, PLATFORM_TARGET) mean "always match" (catch all, or `.*` regex) # Once a cell doesn't match, skip to the next line. # Once a line matches, other lines are not read, so put more specific combination first. # Lines composed of `-` , or `=`, or starting by `#` are ignored. @@ -11,48 +11,45 @@ import csv, io, re # 'd' letter means that the project's dependencies are build and published to be used by the project's CI. # If a cell contains both, both are done. BUILD_DEF = """ - | OS_NAME | DESKTOP | PLATFORM_TARGET | libzim | libkiwix | zim-tools | kiwix-tools | kiwix-desktop | - ======================================================================================================= + | OS_NAME | PLATFORM_TARGET | libzim | libkiwix | zim-tools | kiwix-tools | kiwix-desktop | + ============================================================================================== # Bionic is a special case as we need to compile libzim on old arch for python - | bionic | | | B | | | | | - ------------------------------------------------------------------------------------------------------- + | bionic | | B | | | | | + ---------------------------------------------------------------------------------------------- # Osx builds, build binaries on native_dyn and native_static. On anyother things, build only the libraries - | osx | | native_dyn | d | d | dB | B | | - | osx | | native_static | | | B | B | | - | osx | | native_mixed | B | B | | | | - | osx | | iOS_arm64 | dB | B | | | | - | osx | | iOS_x86_64 | dB | B | | | | - | osx | | iOS_Mac_ABI | B | B | | | | - | osx | | macOS_arm64_static | B | B | | | | - | osx | | macOS_arm64_mixed | B | B | | | | - | osx | | macOS_x86_64 | B | B | | | | - ------------------------------------------------------------------------------------------------------- -# Build kiwix-desktop only on specific targets - | | eval'True | | | | | | B | - | | | flatpak | | | | | B | - ------------------------------------------------------------------------------------------------------- - | | | native_static | d | d | dB | dB | | - | | | native_dyn | d | d | dB | dB | B | - | | | native_mixed | B | B | | | | + | osx | native_dyn | d | d | dB | B | | + | osx | native_static | | | B | B | | + | osx | native_mixed | B | B | | | | + | osx | iOS_arm64 | dB | B | | | | + | osx | iOS_x86_64 | dB | B | | | | + | osx | iOS_Mac_ABI | B | B | | | | + | osx | macOS_arm64_static | B | B | | | | + | osx | macOS_arm64_mixed | B | B | | | | + | osx | macOS_x86_64 | B | B | | | | + ---------------------------------------------------------------------------------------------- + | | flatpak | | | | | B | + | | native_static | d | d | dB | dB | | + | | native_dyn | d | d | dB | dB | B | + | | native_mixed | B | B | | | | # libzim CI is building alpine_dyn but not us - | | | android_arm | dB | dB | | | | - | | | android_arm64 | dB | dB | | | | - | | | android_x86 | B | B | | | | - | | | android_x86_64 | B | B | | | | - | | | armv6_static | | | B | B | | - | | | armv6_dyn | | | B | B | | - | | | armv6_mixed | B | | | | | - | | | armv8_static | | | B | B | | - | | | armv8_dyn | | | B | B | | - | | | armv8_mixed | B | | | | | - | | | aarch64_static | | | B | B | | - | | | aarch64_dyn | d | | B | B | | - | | | aarch64_mixed | B | | | | | - | | | win32_static | d | dB | dB | dB | | - | | | win32_dyn | d | dB | dB | dB | | - | | | i586_static | | | B | B | | - | | | i586_dyn | | | B | B | | - | | | wasm | dB | | | | | + | | android_arm | dB | dB | | | | + | | android_arm64 | dB | dB | | | | + | | android_x86 | B | B | | | | + | | android_x86_64 | B | B | | | | + | | armv6_static | | | B | B | | + | | armv6_dyn | | | B | B | | + | | armv6_mixed | B | | | | | + | | armv8_static | | | B | B | | + | | armv8_dyn | | | B | B | | + | | armv8_mixed | B | | | | | + | | aarch64_static | | | B | B | | + | | aarch64_dyn | d | | B | B | | + | | aarch64_mixed | B | | | | | + | | win32_static | d | dB | dB | dB | | + | | win32_dyn | d | dB | dB | dB | | + | | i586_static | | | B | B | | + | | i586_dyn | | | B | B | | + | | wasm | dB | | | | | """ @@ -79,19 +76,15 @@ def strip_array(array_str): def selector_match(selector, value): if not selector: return True - if selector.startswith("eval'"): - selector = eval(selector[5:]) - return selector == value return re.fullmatch(selector, value) is not None class Context(NamedTuple): OS_NAME: str - DESKTOP: bool PLATFORM_TARGET: str def match(self, row): - for key in ["OS_NAME", "DESKTOP", "PLATFORM_TARGET"]: + for key in ["OS_NAME", "PLATFORM_TARGET"]: context_value = getattr(self, key) selector = row[key] if not selector_match(selector, context_value): @@ -102,11 +95,10 @@ class Context(NamedTuple): BUILD = "B" DEPS = "d" - def select_build_targets(criteria): - from common import PLATFORM_TARGET, DESKTOP, OS_NAME + from common import PLATFORM_TARGET, OS_NAME - context = Context(PLATFORM_TARGET=PLATFORM_TARGET, DESKTOP=DESKTOP, OS_NAME=OS_NAME) + context = Context(PLATFORM_TARGET=PLATFORM_TARGET, OS_NAME=OS_NAME) reader = csv.DictReader(strip_array(BUILD_DEF), dialect=TableDialect()) for row in reader: diff --git a/.github/scripts/common.py b/.github/scripts/common.py index 600ac2e..22eb754 100644 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -17,11 +17,6 @@ from kiwixbuild.versions import ( ) PLATFORM_TARGET = _environ["PLATFORM_TARGET"] -if PLATFORM_TARGET == "native_desktop": - PLATFORM_TARGET = "native_dyn" - DESKTOP = True -else: - DESKTOP = False OS_NAME = _environ["OS_NAME"] HOME = Path(os.path.expanduser("~")) @@ -32,9 +27,6 @@ INSTALL_DIR = BASE_DIR / "INSTALL" TMP_DIR = Path("/tmp") KBUILD_SOURCE_DIR = HOME / "kiwix-build" -# [TODO] -KIWIX_DESKTOP_ONLY = False - _ref = _environ.get("GITHUB_REF", "").split("/")[-1] MAKE_RELEASE = re.fullmatch(r"r_[0-9]+", _ref) is not None MAKE_RELEASE = MAKE_RELEASE and (_environ.get('GITHUB_EVENT_NAME') != 'schedule') diff --git a/.github/scripts/compile_all_deps.py b/.github/scripts/compile_all_deps.py index ac70bbe..87a0761 100755 --- a/.github/scripts/compile_all_deps.py +++ b/.github/scripts/compile_all_deps.py @@ -8,8 +8,6 @@ from common import ( upload, OS_NAME, PLATFORM_TARGET, - DESKTOP, - KIWIX_DESKTOP_ONLY, ) from build_definition import select_build_targets, DEPS