diff mbox series

[meta-networking,1/5] ufw: make usrmerge setup.py sed idempotent

Message ID 20260722184939.495321-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-networking,1/5] ufw: make usrmerge setup.py sed idempotent | expand

Commit Message

Khem Raj July 22, 2026, 6:49 p.m. UTC
do_package failed with a fatal QA error:

  QA Issue: ufw: Files/directories were installed but not shipped in
  any package: /usr/usr/lib/ufw/... (and on repeated rebuilds
  /usr/usr/usr/lib/ufw/...) [installed-vs-shipped]

Under the usrmerge DISTRO_FEATURE, do_configure:prepend rewrites the
single os.path.join('/lib', 'ufw') in setup.py to nonarch_base_libdir
(/usr/lib) with an in-place sed. The pattern '/lib' is not anchored, so
when do_configure re-runs against an already-patched ${S} (cached
unpack/patch, as happens on world rebuilds) it matches the '/lib' inside
the previously substituted '/usr/lib' and prepends another /usr, giving
/usr/usr/lib and then /usr/usr/usr/lib. FILES:${PN} ships
${nonarch_base_libdir}/ufw (/usr/lib/ufw), so the doubled paths are
unshipped and QA fails.

Anchor the substitution to the quoted literal '/lib'. After the first
run the text is '/usr/lib', which no longer contains '/lib', so
re-running do_configure is a no-op. Verified two forced do_configure
runs leave os.path.join('/usr/lib', 'ufw') and do_package succeeds.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta-networking/recipes-connectivity/ufw/ufw_0.36.2.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-networking/recipes-connectivity/ufw/ufw_0.36.2.bb b/meta-networking/recipes-connectivity/ufw/ufw_0.36.2.bb
index 171d0f6285..c6e106f934 100644
--- a/meta-networking/recipes-connectivity/ufw/ufw_0.36.2.bb
+++ b/meta-networking/recipes-connectivity/ufw/ufw_0.36.2.bb
@@ -41,7 +41,11 @@  RRECOMMENDS:${PN} = " \

 do_configure:prepend() {
     if ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','true','false',d)}; then
-        sed -i -e 's|/lib|${nonarch_base_libdir}|' ${S}/setup.py
+        # setup.py has a single os.path.join('/lib', 'ufw'); anchor the match to
+        # the quoted literal so re-running do_configure on an already-patched
+        # ${S} (cached unpack/patch) is a no-op instead of prepending another
+        # /usr each time (which produced /usr/usr/lib/ufw and QA failures).
+        sed -i -e "s|'/lib'|'${nonarch_base_libdir}'|" ${S}/setup.py
     fi
 }