This commit is contained in:
Adam Lamar 2025-04-11 22:30:08 +02:00 committed by GitHub
commit f600654a04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 64 additions and 31 deletions

View File

@ -42,10 +42,10 @@ class NeutralEnv:
def detect_platform(self):
_platform = platform.system()
self.distname = _platform
self.codename = ""
if _platform == "Linux":
self.distname = distro.id()
if self.distname == "ubuntu":
self.distname = "debian"
self.codename = distro.codename()
def download(self, what, where=None):
where = where or self.archive_dir

View File

@ -124,19 +124,16 @@ class Builder:
def _get_packages(self):
packages_list = []
for config in ConfigInfo.all_running_configs.values():
mapper_name = "{host}_{config}".format(
host=neutralEnv("distname"), config=config
)
for runningConfig in ConfigInfo.all_running_configs.values():
for mapper_name in self._get_mapper_names_for_config(runningConfig):
package_name_mapper = PACKAGE_NAME_MAPPERS.get(mapper_name, {})
packages_list += package_name_mapper.get("COMMON", [])
to_drop = []
for builderDef in self._targets:
configName, builderName = builderDef
mapper_name = "{host}_{config}".format(
host=neutralEnv("distname"), config=configName
)
builderConfig, builderName = builderDef
for mapper_name in self._get_mapper_names_for_config(builderConfig):
package_name_mapper = PACKAGE_NAME_MAPPERS.get(mapper_name, {})
packages = package_name_mapper.get(builderName)
if packages:
@ -144,10 +141,16 @@ class Builder:
if packages is not True:
# True means "assume the dependency is install but do not try to install anything for it"
packages_list += packages
for dep in to_drop:
del self._targets[dep]
return packages_list
def _get_mapper_names_for_config(self, config):
host = neutralEnv("distname")
codename = neutralEnv("codename")
return ( f"{host}_{config}", f"{host}_{codename}_{config}" )
def install_packages(self):
packages_to_have = self._get_packages()
packages_to_have = remove_duplicates(packages_to_have)
@ -160,7 +163,7 @@ class Builder:
if distname in ("fedora", "redhat", "centos"):
package_installer = "sudo dnf install {}"
package_checker = "rpm -q --quiet {}"
elif distname in ("debian", "Ubuntu"):
elif distname in ("debian", "ubuntu"):
package_installer = "sudo apt-get install {}"
package_checker = 'LANG=C dpkg -s {} 2>&1 | grep Status | grep "ok installed" 1>/dev/null 2>&1'
elif distname == "Darwin":

View File

@ -7,7 +7,7 @@ class AndroidConfigInfo(ConfigInfo):
build = "android"
static = True
toolchain_names = ["android-ndk"]
compatible_hosts = ["fedora", "debian"]
compatible_hosts = ["fedora", "debian", "ubuntu"]
def __str__(self):
return "android"

View File

@ -6,7 +6,7 @@ from kiwixbuild._global import get_target_step
# Base config for arm
class ArmConfigInfo(ConfigInfo):
compatible_hosts = ["fedora", "debian", "almalinux"]
compatible_hosts = ["fedora", "debian", "ubuntu", "almalinux"]
def get_cross_config(self):
return {

View File

@ -8,7 +8,7 @@ class FlatpakConfigInfo(ConfigInfo):
build = "flatpak"
static = ""
toolchain_names = ["org.kde", "io.qt.qtwebengine"]
compatible_hosts = ["debian", "fedora"]
compatible_hosts = ["debian", "ubuntu", "fedora"]
def __str__(self):
return "flatpak"

View File

@ -7,7 +7,7 @@ from kiwixbuild.utils import which, pj
class I586ConfigInfo(ConfigInfo):
build = "i586"
arch_full = "i586-linux-gnu"
compatible_hosts = ["fedora", "debian"]
compatible_hosts = ["fedora", "debian", "ubuntu"]
def get_cross_config(self):
return {

View File

@ -5,7 +5,7 @@ from kiwixbuild._global import get_target_step
class MuslConfigInfo(ConfigInfo):
compatible_hosts = ["fedora", "debian"]
compatible_hosts = ["fedora", "debian", "ubuntu"]
def get_cross_config(self):
return {

View File

@ -29,16 +29,16 @@ class NativeConfigInfo(ConfigInfo):
class NativeDyn(NativeConfigInfo):
name = "native_dyn"
static = False
compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"]
compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"]
class NativeStatic(NativeConfigInfo):
name = "native_static"
static = True
compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"]
compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"]
class NativeMixed(MixedMixin("native_static"), NativeConfigInfo):
name = "native_mixed"
static = False
compatible_hosts = ["fedora", "debian", "Darwin", "almalinux", "Windows"]
compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin", "almalinux", "Windows"]

View File

@ -5,7 +5,7 @@ class NeutralConfigInfo(ConfigInfo):
name = "neutral"
arch_name = "neutral"
static = ""
compatible_hosts = ["fedora", "debian", "Darwin"]
compatible_hosts = ["fedora", "debian", "ubuntu", "Darwin"]
def __str__(self):
return "neutral"

View File

@ -12,7 +12,7 @@ class WasmConfigInfo(ConfigInfo):
libdir = "lib"
# arch_full = 'wasm64-linux'
toolchain_names = ["emsdk"]
compatible_hosts = ["fedora", "debian"]
compatible_hosts = ["fedora", "debian", "ubuntu"]
exe_wrapper_def = ""
def get_cross_config(self):

View File

@ -18,7 +18,7 @@ class Win64ConfigInfo(ConfigInfo):
"-lkernel32",
]
build = "win64"
compatible_hosts = ["fedora", "debian"]
compatible_hosts = ["fedora", "debian", "ubuntu"]
arch_full = "x86_64-w64-mingw32"
def get_cross_config(self):

View File

@ -91,6 +91,36 @@ PACKAGE_NAME_MAPPERS = {
"debian_android": {
"COMMON": _debian_common,
},
"ubuntu_jammy_native_dyn": {
"COMMON": _debian_common,
"zlib": ["zlib1g-dev"],
"uuid": ["uuid-dev"],
"libmicrohttpd": ["libmicrohttpd-dev", "ccache"],
"qt": ["qt6-base-dev", "qt6-base-dev-tools", "libqt6webenginecore6-bin", "libqt6svg6", "qtchooser"],
"qtwebengine": ["qt6-webengine-dev"],
"aria2": ["aria2"],
},
"ubuntu_noble_native_dyn": {
"COMMON": _debian_common,
"zlib": ["zlib1g-dev"],
"uuid": ["uuid-dev"],
"libmicrohttpd": ["libmicrohttpd-dev", "ccache"],
"qt": ["qt6-base-dev", "qt6-base-dev-tools", "libqt6webenginecore6-bin", "libqt6svg6", "qtchooser"],
"qtwebengine": ["qt6-webengine-dev"],
"aria2": ["aria2"],
},
"ubuntu_oracular_native_dyn": {
"COMMON": _debian_common,
"zlib": ["zlib1g-dev"],
"uuid": ["uuid-dev"],
"libmicrohttpd": ["libmicrohttpd-dev", "ccache"],
"qt": ["qt6-base-dev", "qt6-base-dev-tools", "libqt6webenginecore6-bin", "libqt6svg6", "qtchooser"],
"qtwebengine": ["qt6-webengine-dev"],
"aria2": ["aria2"],
},
"ubuntu_native_static": {
"COMMON": _debian_common + ["libbz2-dev", "libmagic-dev"],
},
"Darwin_native_dyn": {
"COMMON": ["autoconf", "automake", "libtool", "cmake", "pkg-config"],
"file": ["libmagic"],