[oe] [meta-java][PATCH 3/3] ca-certificates-java: Distinguish between SYSROOT and D

Yevgeny Popovych yevgenyp at pointgrab.com
Fri Sep 7 18:10:10 UTC 2018


This fixes ca-certificates-java-hook invocation via
update-ca-certificates on build host and as a native tool.
Provide SYSROOT variable in the postinst and consume it in the script,
like ca-certificates recipe does.

SYSROOT is set whenever the script is executed on the build host
(do_rootfs, or as native dependency).
D is only set during do_rootfs.

Change-Id: Ifbf50ca705a98012e1357ebf5afa33c07ea6cd87
Signed-off-by: Yevgeny Popovych <yevgenyp at pointgrab.com>
---
 .../ca-certificates-java/ca-certificates-java.hook.in   | 17 ++++++++---------
 .../ca-certificates-java_20180516.bb                    |  2 +-
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in b/recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in
index 611a4ef..5e89dd9 100755
--- a/recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in
+++ b/recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in
@@ -8,20 +8,21 @@
 # and package update in OE, so the distinction between cases 2)
 # and 3) isn't perfect.
 
+# SYSROOT is set whenever the script is executed on the build host
+# (do_rootfs, or as native dependency).
+# D is only set during do_rootfs.
+
 self=$(basename $0)
-jvm_libdir="@@libdir_jvm@@"
+jvm_libdir="${JVM_LIBDIR:-@@libdir_jvm@@}"
 
-if [ -n "${D:-}" ] ; then
-    # called from postinst as part of image build on host
+if [ -n "${SYSROOT:-}" ] ; then
+    # called on build host - from postinst (directly or as a hook) or as a native tool
     if [ -z "${JVM_LIBDIR:-}" ] ; then
         # if JVM_LIBDIR is not present - we were called as a hook
         echo "called as a hook of ca-certificates on do_rootfs, exiting"
         exit 0
     fi
 fi
-if [ -n "${JVM_LIBDIR:-}" ] ; then
-    jvm_libdir="${JVM_LIBDIR}"
-fi
 
 for JAVA in icedtea7-native/bin/java \
             openjdk-8-native/bin/java openjdk-8/bin/java openjre-8/bin/java \
@@ -58,6 +59,4 @@ else
     while read filename ; do
         echo "+${filename}"
     done
-fi | SYSROOT="${D:-}" ${JAVA} -Xmx64m \
-                              -jar ${D:-}@@datadir_java@@/@@JARFILENAME@@ \
-                              -storepass changeit
+fi | ${JAVA} -Xmx64m -jar ${D:-}@@datadir_java@@/@@JARFILENAME@@ -storepass changeit
diff --git a/recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb
index 7db5110..2f2536d 100644
--- a/recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb
+++ b/recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb
@@ -100,7 +100,7 @@ pkg_postinst_${PN} () {
 	    fi
 	    JVM_LIBDIR=$NATIVE_ROOT${libdir_jvm}
 	fi
-	JVM_LIBDIR=$JVM_LIBDIR $D${sbindir}/create-ca-certificates-java
+	SYSROOT=$D JVM_LIBDIR=$JVM_LIBDIR $D${sbindir}/create-ca-certificates-java
 }
 
 RDEPENDS_${PN} = "ca-certificates"
-- 
2.7.4




More information about the Openembedded-devel mailing list