[meta-java] java-library: make packages overriding PACKAGE_ARCH work again

Submitted by André Draszik on Nov. 17, 2018, 9:57 a.m. | Patch ID: 156358


Message ID 20181117095738.2217-1-git@andred.net
State Under Review
Delegated to: Richard Leitner
Headers show

Commit Message

André Draszik Nov. 17, 2018, 9:57 a.m.
From: André Draszik <andre.draszik@jci.com>

Recent changes is OE have caused the traditional approach of inheriting
allarch and setting PACKAGE_ARCH not work anymore. Once allarch is
inherited, PACKAGE_ARCH can not be overridden afterwards.
See commit a23c482cab4f ("allarch: only enable allarch when multilib
is not used") d9ba0219b2f6 in poky.

The error manifests itself with configure trying to
   --host=allarch-poky-linux --target=allarch-poky-linux
which fails.

To work around this we can make java-library's allarch inherit
conditional, as is done e.g. in OE-core for packagegroup.bbclass

So this commit does exactly that, and fixes the two users of this to
follow the new approach.

Signed-off-by: André Draszik <andre.draszik@jci.com>
 classes/java-library.bbclass           | 8 ++++++--
 recipes-core/libmatthew/libmatthew.inc | 2 +-
 recipes-extended/rxtx/rxtx_2.2.0.bb    | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/classes/java-library.bbclass b/classes/java-library.bbclass
index ce1cd28..e0159ba 100644
--- a/classes/java-library.bbclass
+++ b/classes/java-library.bbclass
@@ -10,9 +10,13 @@ 
 # package archs are set to all, if the recipe builds also packages which
 # can not be used for all archs, then set the PACKAGE_ARCH of that package
-# manually, see rxtx_xx.bb for an example.
+# manually *before* inheriting the class, see rxtx_xx.bb for an example.
-inherit java allarch
+inherit java
+PACKAGE_ARCH ?= "all"
+# Fully expanded - so it applies the overrides as well
+inherit ${@oe.utils.ifelse(d.getVar('PACKAGE_ARCH_EXPANDED') == 'all', 'allarch', '')}
 # use java_stage for native packages
diff --git a/recipes-core/libmatthew/libmatthew.inc b/recipes-core/libmatthew/libmatthew.inc
index 7db979b..2119c0b 100644
--- a/recipes-core/libmatthew/libmatthew.inc
+++ b/recipes-core/libmatthew/libmatthew.inc
@@ -7,8 +7,8 @@  DEPENDS = "virtual/java-native classpath-native classpath"
 S = "${WORKDIR}/libmatthew-java-${PV}"
-inherit java-library
+inherit java-library
 # Some internal version numbers which change from time to time.
 # Allowing to override them makes this include file more
diff --git a/recipes-extended/rxtx/rxtx_2.2.0.bb b/recipes-extended/rxtx/rxtx_2.2.0.bb
index e54dad7..d4fbb9d 100644
--- a/recipes-extended/rxtx/rxtx_2.2.0.bb
+++ b/recipes-extended/rxtx/rxtx_2.2.0.bb
@@ -28,8 +28,8 @@  S = "${WORKDIR}/rxtx-2.2pre2"
 INSANE_SKIP_${JPN} += "dev-so"
-inherit autotools-brokensep java-library remove-libtool
+inherit autotools-brokensep java-library remove-libtool
 EXTRA_OEMAKE += "RXTX_PATH=${D}${libdir_jni} \