From f7fb1fe078ac330f306156ab1668388a10bac814 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sun, 4 Sep 2022 22:45:22 +0200 Subject: [PATCH] pmb.parse.kconfig: rename anbox check to waydroid (MR 2204) Change the naming to fit what software is actually used in postmarketOS. --- pmb/build/menuconfig.py | 3 ++- pmb/config/__init__.py | 14 ++++++------- pmb/helpers/frontend.py | 4 ++-- pmb/parse/arguments.py | 4 ++-- pmb/parse/kconfig.py | 20 +++++++++---------- test/test_kconfig_check.py | 12 +++++------ .../{good-anbox => good-waydroid} | 0 7 files changed, 29 insertions(+), 28 deletions(-) rename test/testdata/kconfig_check/{good-anbox => good-waydroid} (100%) diff --git a/pmb/build/menuconfig.py b/pmb/build/menuconfig.py index 032ff062..55688126 100644 --- a/pmb/build/menuconfig.py +++ b/pmb/build/menuconfig.py @@ -153,7 +153,8 @@ def menuconfig(args, pkgname, use_oldconfig): pmb.build.checksum.update(args, pkgname) # Check config - pmb.parse.kconfig.check(args, apkbuild["_flavor"], force_anbox_check=False, + pmb.parse.kconfig.check(args, apkbuild["_flavor"], + force_waydroid_check=False, force_nftables_check=False, force_containers_check=False, force_zram_check=False, diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 85102cb3..ce925e61 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -329,8 +329,8 @@ necessary_kconfig_options = { } } -# Necessary anbox/waydroid kernel config options (android app support) -necessary_kconfig_options_anbox = { +# Necessary waydroid kernel config options (android app support) +necessary_kconfig_options_waydroid = { ">=0.0.0": { # all versions "all": { # all arches "SQUASHFS": True, @@ -354,12 +354,12 @@ necessary_kconfig_options_anbox = { }, ">=3.5": { "all": { - "CROSS_MEMORY_ATTACH": True, # required by Waydroid + "CROSS_MEMORY_ATTACH": True, } }, ">=4.20.0": { "all": { - "PSI": True, # required by userspace OOM killer in Waydroid + "PSI": True, # required by userspace OOM killer "PSI_DEFAULT_DISABLED": False, } }, @@ -450,7 +450,7 @@ necessary_kconfig_options_containers = { "CPUSETS": True, "KEYS": True, "VETH": True, - "BRIDGE": True, # (also needed for anbox) + "BRIDGE": True, # (also needed for waydroid) "BRIDGE_NETFILTER": True, "IP_NF_FILTER": True, "IP_NF_TARGET_MASQUERADE": True, @@ -517,7 +517,7 @@ necessary_kconfig_options_containers = { }, ">=3.9": { "all": { # all arches - "BRIDGE_VLAN_FILTERING": True, # Network Drivers (also for anbox) + "BRIDGE_VLAN_FILTERING": True, # Network Drivers (also for waydroid) "MACVLAN": True, # Network Drivers } }, @@ -655,7 +655,7 @@ apkbuild_attributes = { apkbuild_custom_valid_options = [ "!pmb:crossdirect", "!pmb:kconfig-check", - "pmb:kconfigcheck-anbox", + "pmb:kconfigcheck-waydroid", "pmb:kconfigcheck-containers", "pmb:kconfigcheck-nftables", "pmb:cross-native", diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 50c7fb44..77735cfb 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -379,7 +379,7 @@ def kconfig(args): # Handle passing a file directly if args.file: if pmb.parse.kconfig.check_file(args.package, - anbox=args.anbox, + waydroid=args.waydroid, nftables=args.nftables, containers=args.containers, zram=args.zram, @@ -415,7 +415,7 @@ def kconfig(args): continue if not pmb.parse.kconfig.check( args, package, - force_anbox_check=args.anbox, + force_waydroid_check=args.waydroid, force_iwd_check=args.iwd, force_nftables_check=args.nftables, force_containers_check=args.containers, diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index ab9b54fa..dcfbd001 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -464,8 +464,8 @@ def arguments_kconfig(subparser): check.add_argument("--arch", choices=arch_choices, dest="arch") check.add_argument("--file", action="store_true", help="check a file" " directly instead of a config in a package") - check.add_argument("--anbox", action="store_true", help="check" - " options needed for anbox too") + check.add_argument("--waydroid", action="store_true", help="check" + " options needed for waydroid too") check.add_argument("--iwd", action="store_true", help="check" " options needed for iwd too") check.add_argument("--nftables", action="store_true", help="check" diff --git a/pmb/parse/kconfig.py b/pmb/parse/kconfig.py index d1f5b169..6a625d33 100644 --- a/pmb/parse/kconfig.py +++ b/pmb/parse/kconfig.py @@ -85,7 +85,7 @@ def check_option(component, details, config, config_path_pretty, option, def check_config(config_path, config_path_pretty, config_arch, pkgver, - anbox=False, + waydroid=False, iwd=False, nftables=False, containers=False, @@ -99,8 +99,8 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver, config = handle.read() components = {"postmarketOS": pmb.config.necessary_kconfig_options} - if anbox: - components["anbox"] = pmb.config.necessary_kconfig_options_anbox + if waydroid: + components["waydroid"] = pmb.config.necessary_kconfig_options_waydroid if iwd: components["iwd"] = pmb.config.necessary_kconfig_options_iwd if nftables: @@ -113,7 +113,7 @@ def check_config(config_path, config_path_pretty, config_arch, pkgver, if netboot: components["netboot"] = pmb.config.necessary_kconfig_options_netboot if community: - components["anbox"] = pmb.config.necessary_kconfig_options_anbox + components["waydroid"] = pmb.config.necessary_kconfig_options_waydroid components["iwd"] = pmb.config.necessary_kconfig_options_iwd components["nftables"] = pmb.config.necessary_kconfig_options_nftables components["containers"] = \ @@ -165,7 +165,7 @@ def check_config_options_set(config, config_path_pretty, config_arch, options, def check(args, pkgname, - force_anbox_check=False, + force_waydroid_check=False, force_iwd_check=False, force_nftables_check=False, force_containers_check=False, @@ -194,8 +194,8 @@ def check(args, pkgname, return None apkbuild = pmb.parse.apkbuild(f"{aport}/APKBUILD") pkgver = apkbuild["pkgver"] - check_anbox = force_anbox_check or ( - "pmb:kconfigcheck-anbox" in apkbuild["options"]) + check_waydroid = force_waydroid_check or ( + "pmb:kconfigcheck-waydroid" in apkbuild["options"]) check_iwd = force_iwd_check or ( "pmb:kconfigcheck-iwd" in apkbuild["options"]) check_nftables = force_nftables_check or ( @@ -228,7 +228,7 @@ def check(args, pkgname, config_path_pretty = f"linux-{flavor}/{os.path.basename(config_path)}" ret &= check_config(config_path, config_path_pretty, config_arch, pkgver, - anbox=check_anbox, + waydroid=check_waydroid, iwd=check_iwd, nftables=check_nftables, containers=check_containers, @@ -272,7 +272,7 @@ def extract_version(config_file): return "unknown" -def check_file(config_file, anbox=False, nftables=False, +def check_file(config_file, waydroid=False, nftables=False, containers=False, zram=False, netboot=False, community=False, uefi=False, details=False): """ @@ -285,7 +285,7 @@ def check_file(config_file, anbox=False, nftables=False, logging.debug(f"Check kconfig: parsed arch={arch}, version={version} from " f"file: {config_file}") return check_config(config_file, config_file, arch, version, - anbox=anbox, + waydroid=waydroid, nftables=nftables, containers=containers, zram=zram, diff --git a/test/test_kconfig_check.py b/test/test_kconfig_check.py index da8ebd51..13f24620 100644 --- a/test/test_kconfig_check.py +++ b/test/test_kconfig_check.py @@ -31,11 +31,11 @@ def test_kconfig_check(args): "bad-missing-required-option") assert pmb.parse.kconfig.check_file(dir + "good") assert not pmb.parse.kconfig.check_file(dir + "bad-wrong-option-set") - assert pmb.parse.kconfig.check_file(dir + "good-anbox", - anbox=True) + assert pmb.parse.kconfig.check_file(dir + "good-waydroid", + waydroid=True) assert not pmb.parse.kconfig.check_file(dir + "bad-array-missing-some-options", - anbox=True) + waydroid=True) assert pmb.parse.kconfig.check_file(dir + "good-nftables", nftables=True) assert not pmb.parse.kconfig.check_file(dir + "bad-nftables", @@ -56,12 +56,12 @@ def test_kconfig_check(args): # supports nftables (with pmb:kconfigcheck-nftables) assert pmb.parse.kconfig.check(args, "nokia-n900") - # supports Anbox (with pmb:kconfigcheck-anbox) + # supports Waydroid (with pmb:kconfigcheck-waydroid) assert pmb.parse.kconfig.check(args, "postmarketos-allwinner") - # testing the force param: nokia-n900 will never have anbox support + # testing the force param: nokia-n900 will never have waydroid support assert not pmb.parse.kconfig.check(args, "nokia-n900", - force_anbox_check=True) + force_waydroid_check=True) # supports zram (with pmb:kconfigcheck-zram), nftables assert pmb.parse.kconfig.check(args, "linux-purism-librem5") diff --git a/test/testdata/kconfig_check/good-anbox b/test/testdata/kconfig_check/good-waydroid similarity index 100% rename from test/testdata/kconfig_check/good-anbox rename to test/testdata/kconfig_check/good-waydroid