On 4/29/24 05:32, Peter Kjellerstedt wrote:
-----Original Message-----
From: openembedded-devel@lists.openembedded.org 
<openembedded-devel@lists.openembedded.org> On Behalf Of Kai Kang
Sent: den 25 april 2024 05:07
To: openembedded-devel@lists.openembedded.org
Subject: [oe] [PATCH v2] apache2: fix multilib files confliction

From: Kai Kang <kai.k...@windriver.com>

There are files confliction of apache2 when multilib enabled:

Error: Transaction test error:
   file /usr/share/apache2/build/config.nice conflicts between attempted
     installs of apache2-dev-2.4.58-r0.cortexa57 and 
lib32-apache2-dev-2.4.58-r0.armv7vet2hf_vfp
   file /usr/share/apache2/build/config_vars.mk conflicts between
     attempted installs of apache2-dev-2.4.58-r0.cortexa57 and 
lib32-apache2-dev-2.4.58-r0.armv7vet2hf_vfp

Install the 'build' directory to ${libexecdir} to fix the confliction by
setting 'installbuilddir'. ${libexecdir} is not populated to sysroot by
default, but command apxs requires these files, then add the dir to
SYSROOT_DIRS to populate them.

And inherit bbclasses multilib_script and multilib_header to fix follow
up conflictions:

   file /usr/bin/apxs conflicts between attempted installs of
     apache2-dev-2.4.58-r0.cortexa57 and 
lib32-apache2-dev-2.4.58-r0.armv7vet2hf_vfp
   file /usr/include/apache2/ap_config_layout.h conflicts between
     attempted installs of apache2-dev-2.4.58-r0.cortexa57 and 
lib32-apache2-dev-2.4.58-r0.armv7vet2hf_vfp

Since multilib_script inherits update-alternatives, remove it from
inherit line for beautification.

Fix buildpaths warning as well:

   WARNING: lib32-apache2-2.4.58-r0 do_package_qa: QA Issue: File 
/usr/share/apache2/build/config.nice
            in package lib32-apache2-dev contains reference to TMPDIR 
[buildpaths]

Signed-off-by: Kai Kang <kai.k...@windriver.com>
---
v2:
* still populate `.../build` directory after installed to ${libexecdir}
* fix buildpaths warning

  .../recipes-httpd/apache2/apache2_2.4.59.bb   | 38 ++++++++++++-------
  1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/meta-webserver/recipes-httpd/apache2/apache2_2.4.59.bb 
b/meta-webserver/recipes-httpd/apache2/apache2_2.4.59.bb
index b96e8b4e1..5b170fac3 100644
--- a/meta-webserver/recipes-httpd/apache2/apache2_2.4.59.bb
+++ b/meta-webserver/recipes-httpd/apache2/apache2_2.4.59.bb
@@ -31,7 +31,7 @@ SRC_URI[sha256sum] = 
"ec51501ec480284ff52f637258135d333230a7d229c3afa6f6c2f9040e

  S = "${WORKDIR}/httpd-${PV}"

-inherit autotools update-rc.d pkgconfig systemd update-alternatives
+inherit autotools update-rc.d pkgconfig systemd multilib_script multilib_header

  DEPENDS = "openssl expat pcre apr apr-util apache2-native "

@@ -80,7 +80,10 @@ EXTRA_OECONF:class-native = "\
      "

  do_configure:prepend() {
-    sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libexecdir}/cgi-bin:g' 
${S}/config.layout
+    # only modify layout Debian which is adopted
+    sed -i -e '/Layout Debian/,/\Layout/ 
s#\(cgidir:\s*\).*#\1${libexecdir}/cgi-bin#g' \
+        -e '/Layout Debian/,/\Layout/ 
s#\(installbuilddir:\s*\).*#\1${libexecdir}/${PN}/build#g' \
+        ${S}/config.layout
  }

  do_install:append:class-target() {
@@ -119,14 +122,15 @@ do_install:append:class-target() {
             -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; 
s,-ffile-prefix-map[^ ]*,,g' \
             -e 's,${HOSTTOOLS_DIR}/,,g' \
             -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
-           -e 's,APU_CONFIG = .*,APU_CONFIG = ,g' 
${D}${datadir}/apache2/build/config_vars.mk
+           -e 's,APU_CONFIG = .*,APU_CONFIG = ,g' 
${D}${libexecdir}/${PN}/build/config_vars.mk

      sed -i -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
             -e 's,${DEBUG_PREFIX_MAP},,g' \
             -e 's,${RECIPE_SYSROOT},,g' \
             -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; 
s,-fmacro-prefix-map[^ ]*,,g' \
             -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
-           -e 's,".*/configure","configure",g' 
${D}${datadir}/apache2/build/config.nice
+           -e 's,${WORKDIR}/recipe-sysroot/,,g' \
+           -e 's,".*/configure","configure",g' 
${D}${libexecdir}/${PN}/build/config.nice

      if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', 
d)}; then
          install -d ${D}${sysconfdir}/tmpfiles.d/
@@ -143,6 +147,8 @@ do_install:append:class-target() {

      rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars*
      chown -R root:root ${D}
+
+    oe_multilib_header apache2/ap_config_layout.h
  }

  do_install:append:class-native() {
@@ -152,20 +158,22 @@ do_install:append:class-native() {

  SYSROOT_PREPROCESS_FUNCS:append:class-target = " apache_sysroot_preprocess"

+SYSROOT_DIRS += "${libexecdir}/${PN}/build"
+
  apache_sysroot_preprocess() {
      install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
      install -m 755 ${D}${bindir}/apxs ${SYSROOT_DESTDIR}${bindir_crossscripts}
      install -d ${SYSROOT_DESTDIR}${sbindir}
      install -m 755 ${D}${sbindir}/apachectl ${SYSROOT_DESTDIR}${sbindir}
-    sed -i 's!my $installbuilddir = .*!my $installbuilddir = 
"${STAGING_DIR_HOST}/${datadir}/${BPN}/build";!' 
${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
-
-    sed -i 's!^APR_CONFIG = .*!APR_CONFIG = 
${STAGING_BINDIR_CROSS}/apr-1-config!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!^APU_CONFIG = .*!APU_CONFIG = 
${STAGING_BINDIR_CROSS}/apu-1-config!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!^includedir = .*!includedir = ${STAGING_INCDIR}/apache2!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!^CFLAGS = -I[^ ]*!CFLAGS = -I${STAGING_INCDIR}/openssl!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!^EXTRA_LDFLAGS = .*!EXTRA_LDFLAGS = -L${STAGING_LIBDIR}!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!^EXTRA_INCLUDES = .*!EXTRA_INCLUDES = -I$(includedir) -I. 
-I${STAGING_INCDIR}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
-    sed -i 's!--sysroot=[^ ]*!--sysroot=${STAGING_DIR_HOST}!' 
${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
+    sed -i 's!\(my $installbuilddir = \)"\(.*\)"!\1"${STAGING_DIR_HOST}\2"!' 
${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
+
+    sed -i 's!^APR_CONFIG = .*!APR_CONFIG = 
${STAGING_BINDIR_CROSS}/apr-1-config!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!^APU_CONFIG = .*!APU_CONFIG = 
${STAGING_BINDIR_CROSS}/apu-1-config!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!^includedir = .*!includedir = ${STAGING_INCDIR}/apache2!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!^CFLAGS = -I[^ ]*!CFLAGS = -I${STAGING_INCDIR}/openssl!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!^EXTRA_LDFLAGS = .*!EXTRA_LDFLAGS = -L${STAGING_LIBDIR}!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!^EXTRA_INCLUDES = .*!EXTRA_INCLUDES = -I$(includedir) -I. 
-I${STAGING_INCDIR}!' ${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
+    sed -i 's!--sysroot=[^ ]*!--sysroot=${STAGING_DIR_HOST}!' 
${SYSROOT_DESTDIR}${libexecdir}/${PN}/build/config_vars.mk
  }

  # Implications - used by update-rc.d scripts
@@ -178,6 +186,8 @@ SYSTEMD_AUTO_ENABLE:${PN} = "enable"
  ALTERNATIVE:${PN}-doc = "htpasswd.1"
  ALTERNATIVE_LINK_NAME[htpasswd.1] = "${mandir}/man1/htpasswd.1"

+MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/apxs"
+
  PACKAGES = "${PN}-utils ${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"

  CONFFILES:${PN} = "${sysconfdir}/${BPN}/httpd.conf \
@@ -200,7 +210,7 @@ FILES:${PN}-utils = "${bindir}/ab \
  # We override here rather than append so that .so links are
  # included in the runtime package rather than here (-dev)
  # and to get build, icons, error into the -dev package
-FILES:${PN}-dev = "${datadir}/${BPN}/build \
+FILES:${PN}-dev = "${libexecdir}/${PN}/build \
                     ${datadir}/${BPN}/icons \
                     ${datadir}/${BPN}/error \
                     ${includedir}/${BPN} \
--
2.34.1
The above breaks if you use another layout than Debian. We have the following
in our apache2_%.bbappend:

EXTRA_OECONF:remove = "--enable-layout=Debian --prefix=${base_prefix}"

EXTRA_OECONF:append:class-target = " \
     --enable-layout=RedHat \
     --sysconfdir=/run/${BPN} \
     --libexecdir=${libdir}/${BPN}/modules \
     ...
"

and with the above patch it now results in:

| sed: can't read 
.../tmp/work/cortexa9hf-neon-poky-linux-gnueabi/apache2/2.4.58/image/usr/libexec/apache2/build/config_vars.mk:
 No such file or directory

Due to the fact that these changes are done using sed with an
:append:class-target, it is hard to override them in a subsequent bbappend.

Do you think you could introduce a variable for this path, e.g.,
installbuilddir = "${libexecdir}/${PN}/build"
(which should be ${libexecdir}/${BPN}/build to match the other paths) so
that it can easily be corrected if using another layout than Debian?

I am sorry that I didn't consider other layout than Debian. I'll fix it with v3.

Regards,
Kai


//Peter


--
Kai Kang
Wind River Linux

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#110165): 
https://lists.openembedded.org/g/openembedded-devel/message/110165
Mute This Topic: https://lists.openembedded.org/mt/105724108/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to