systemd: change pni-names logic to something less confusing

Using bb.utils.contains in negative logic leads to either overly verbose
or plain confusing code, so harness the power of Ross and Antonin to
make this less verbose and slightly clearer.

This moves the negative logic from the inline python ('true if not') to
bash ('if !').

(From OE-Core rev: 52ea4612f9262a9e607fb3eee08906ec687197ee)

Signed-off-by: Koen Kooi <koen.kooi@oss.qualcomm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Koen Kooi
2025-09-09 13:24:48 +02:00
committed by Richard Purdie
parent b499241d85
commit b734181952

View File

@@ -401,7 +401,7 @@ do_install() {
fi
# Actively disable Predictable Network Interface Names
if ${@ 'true' if not bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d) else 'false'}; then
if ! ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then
sed -i 's/^NamePolicy=.*/NamePolicy=/;s/^AlternativeNamesPolicy=.*/AlternativeNamesPolicy=/' ${D}${nonarch_libdir}/systemd/network/99-default.link
fi
}