From ca219527378ad765797dfb713f002e57a34289bb Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Tue, 23 Aug 2022 22:53:45 +0200
Subject: [PATCH] scripts: target_config_lib: add aliases for virtual default
 packages

OpenWrt's default package list contains the package "nftables", which is
a virtual package provided by "nftables-json" and "nftables-nojson".
Explicitly handle this case, otherwise our config check will fail when
we extend our default package list with the one from OpenWrt.
---
 scripts/target_config_lib.lua | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/target_config_lib.lua b/scripts/target_config_lib.lua
index 863915ec7..7e41f8838 100644
--- a/scripts/target_config_lib.lua
+++ b/scripts/target_config_lib.lua
@@ -123,6 +123,14 @@ local enabled_packages = {}
 -- Arguments: package name and config value (true: y, nil: m, false: unset)
 -- Ensures precedence of y > m > unset
 local function config_package(pkg, v)
+	-- HACK: Handle virtual default packages
+	local subst = {
+		nftables = 'nftables-nojson'
+	}
+	if subst[pkg] then
+		pkg = subst[pkg]
+	end
+
 	if v == false then
 		if not enabled_packages[pkg] then
 			lib.try_config('PACKAGE_' .. pkg, false)
-- 
GitLab