ca-certificates-java: Fix usage as a native tool, do_rootfs failure
cover ca-certificates-java: Fix usage as a native tool, do_rootfs failure
This series fixes several issues with ca-certificates-java:
* when used as a native tool
* failure on do_rootfs
This doesn't fix all the issues and there is definitely a room for improvement. I presume that running it on the target doesn't work - at least ${sysconfdir} is not expanded in the hook.
I also think that will be best to drop create-ca-certificates-java usage in the postinst and let it be called as a hook of ca-certificates. This will allow us to remove some code and simplify both script and recipe.
It would be great if others could test their use cases; and clarify them - is create-ca-certificates-java really needed?.
Yevgeny Popovych (3):
ca-certificates-java: Fix sysconfdir for -native recipe
ca-certificates-java: Don't fail when called via hook on do_rootfs
ca-certificates-java: Distinguish between SYSROOT and D
.../ca-certificates-java.hook.in | 23 +++++++++++----------- .../ca-certificates-java_20180516.bb | 11 ++++++++--- 2 files changed, 19 insertions(+), 15 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 ca-certificates-java: Fix sysconfdir for -native recipe
When ca-certificates-java-native is built, sysconfdir variable will be set to value that includes WORKDIR.
Avoid patching source with this value - use sysconfdir_native.
--- .../ca-certificates-java/ca-certificates-java_20180516.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +7 -2
@@ -41,9 +41,14 @@ do_patch_append () { bb.build.exec_func('do_fix_sysconfdir', d) } +# sysconfdir will include absolute native sysroot path in -native builds, avoid this +# (see 36.24 of https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#faq) +SYSCONFDIR_VALUE_class-target = "${sysconfdir}" +SYSCONFDIR_VALUE_class-native = "${sysconfdir_native}" + do_fix_sysconfdir () { - sed -e 's|/etc/ssl/certs/java|${sysconfdir}/ssl/certs/java|g' \ - -i ${S}/src/main/java/org/debian/security/UpdateCertificates.java + sed -e 's|/etc/ssl/certs/java|${SYSCONFDIR_VALUE}/ssl/certs/java|g' \ + -i ${S}/src/main/java/org/debian/security/UpdateCertificates.java } do_compile () {
Signature · 1 line
2.7.4
Re: [meta-java][PATCH 1/3] ca-certificates-java: Fix sysconfdir for -native recipe
Quoted 2 lines · Yevgeny Popovych
When ca-certificates-java-native is built, sysconfdir variable will be set to value that includes WORKDIR.
What is your use-case for a -native version of this?
Quoted 31 lines
Avoid patching source with this value - use
sysconfdir_native.Change-Id I8ac79c3cd5016a8139d9d8c8d58bc2976d0b6fa3Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java_20180516.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 2db1915..7db5110 100644recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-0@@ -41,9 +41,14 @@ do_patch_append () { bb.build.exec_func('do_fix_sysconfdir', d) } +# sysconfdir will include absolute native sysroot path in -native builds,avoid this
+# (see 36.24 of
https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#faq)recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +3
-2+SYSCONFDIR_VALUE_class-target = "${sysconfdir}" +SYSCONFDIR_VALUE_class-native = "${sysconfdir_native}" + do_fix_sysconfdir () { - sed -e 's|/etc/ssl/certs/java|${sysconfdir}/ssl/certs/java|g' \ - -i${S}/src/main/java/org/debian/security/UpdateCertificates.java
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb do_patch_append () { · line 52
Quoted 3 lines
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +2
-0+ sed -e 's|/etc/ssl/certs/java|${SYSCONFDIR_VALUE}/ssl/certs/java|g' \ + -i ${S}/src/main/java/org/debian/security/UpdateCertificates.java }
No.
It's probably best to remove the BBCLASSEXTEND statement in this recipe instead, as it was never tested, and is unlikely to be needed.
The whole idea is to make this independent of the build machine paths. If you want a -native version of this, you still need to make sure to point this into the yocto sysroot. Otherwise this will try to write to the *build machine's* /etc/ directory!
If you really want a -native version, you need to point this into the sysroot, and update this dynamically because of sstate usage, too.
Cheers,
Andre'
Re: [meta-java][PATCH 1/3] ca-certificates-java: Fix sysconfdir for -native recipe
Quoted 5 lines · André Draszik
Quoted 2 lines · Yevgeny Popovych
When ca-certificates-java-native is built, sysconfdir variable will be set to value that includes WORKDIR.
What is your use-case for a -native version of this?
I'm glad you asked as this should answer some questions..
I am building a package that contains prebuilt ca-certificates
(including what ca-certificates itself build and JKS),
for this package I need -native version of ca-certificates-java.
We have an immutable (readonly) rootfs, so running scripts at runtime is not an option. With patches I have recently sent it works pretty well.
The bottom line is that there is a use-case for -native version. Even if you don't have an immutable (readonly) rootfs - you might want to use it that way because running scripts is quite error prone.
Quoted 38 lines
Quoted 32 lines
Avoid patching source with this value - use
sysconfdir_native.Change-Id I8ac79c3cd5016a8139d9d8c8d58bc2976d0b6fa3Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java_20180516.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 2db1915..7db5110 100644recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-0@@ -41,9 +41,14 @@ do_patch_append () { bb.build.exec_func('do_fix_sysconfdir', d) } +# sysconfdir will include absolute native sysroot path in -native builds,avoid this
+# (see 36.24 of
https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#faq)recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +3
-2+SYSCONFDIR_VALUE_class-target = "${sysconfdir}" +SYSCONFDIR_VALUE_class-native = "${sysconfdir_native}" + do_fix_sysconfdir () { - sed -e 's|/etc/ssl/certs/java|${sysconfdir}/ssl/certs/java|g' \ - -i${S}/src/main/java/org/debian/security/UpdateCertificates.java
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb do_patch_append () { · line 52
Quoted 3 lines
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +2
-0+ sed -e 's|/etc/ssl/certs/java|${SYSCONFDIR_VALUE}/ssl/certs/java|g' \ + -i ${S}/src/main/java/org/debian/security/UpdateCertificates.java }No.
Quoted 2 lines
It's probably best to remove the BBCLASSEXTEND statement in this recipe instead, as it was never tested, and is unlikely to be needed.
We have a use-case for -native and this series fixes it.
Quoted 8 lines
The whole idea is to make this independent of the build machine paths. If you want a -native version of this, you still need to make sure to point this into the yocto sysroot. Otherwise this will try to write to the *build machine's*
/etc/directory!If you really want a -native version, you need to point this into the sysroot, and update this dynamically because of sstate usage, too.
Ok, I suppose that ${sysconfdir_native} has mislead you -
it does _not_ resolve to an absolute path into native sysroot.
The value of ${sysconfdir_native} is always "/etc", it does not mangle in any way (that's why I have used it). So this don't have any issue with sstate or else.
Quoted 6 lines
Cheers,
Andre'
Signature · 2 lines
Sincerely, Yevgeny Popovych
Re: [meta-java][PATCH 1/3] ca-certificates-java: Fix sysconfdir for -native recipe
Quoted 79 lines · Yevgeny Popovych
Quoted 5 lines · André Draszik
Quoted 2 lines · Yevgeny Popovych
When ca-certificates-java-native is built, sysconfdir variable will be set to value that includes WORKDIR.
What is your use-case for a -native version of this?
I'm glad you asked as this should answer some questions..
I am building a package that contains prebuilt ca-certificates (including what ca-certificates itself build and JKS),
for this package I need -native version of ca-certificates-java. We have an immutable (readonly) rootfs, so running scripts at runtime is not an option.
With patches I have recently sent it works pretty well.The bottom line is that there is a use-case for -native version. Even if you don't have an immutable (readonly) rootfs - you might want to use it
that way because running scripts is quite error prone.Quoted 44 lines
Quoted 34 lines
Avoid patching source with this value - use
sysconfdir_native.Change-Id I8ac79c3cd5016a8139d9d8c8d58bc2976d0b6fa3Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java_20180516.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 2db1915..7db5110 100644
--- a/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
+++ b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bbrecipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-0@@ -41,9 +41,14 @@ do_patch_append () { bb.build.exec_func('do_fix_sysconfdir', d) } +# sysconfdir will include absolute native sysroot path in -native builds,avoid this
+# (see 36.24 of
https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#faq
)recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +3
-2+SYSCONFDIR_VALUE_class-target = "${sysconfdir}" +SYSCONFDIR_VALUE_class-native = "${sysconfdir_native}" + do_fix_sysconfdir () { - sed -e 's|/etc/ssl/certs/java|${sysconfdir}/ssl/certs/java|g' \ - -iQuoted 7 lines
${S}/src/main/java/org/debian/security/UpdateCertificates.java
+ sed -e
's|/etc/ssl/certs/java|${SYSCONFDIR_VALUE}/ssl/certs/java|g' \
+ -i
${S}/src/main/java/org/debian/security/UpdateCertificates.java
}No.
Quoted 2 lines
It's probably best to remove the BBCLASSEXTEND statement in this recipe instead, as it was never tested, and is unlikely to be needed.
We have a use-case for -native and this series fixes it.
Quoted 8 lines
The whole idea is to make this independent of the build machine paths. If
you want a -native version of this, you still need to make sure to point this into the yocto sysroot. Otherwise this will try to write to the *build
machine's*/etc/directory!
Quoted 7 lines
Quoted 2 lines
If you really want a -native version, you need to point this into the sysroot, and update this dynamically because of sstate usage, too.
Ok, I suppose that ${sysconfdir_native} has mislead you -
it does _not_ resolve to an absolute path into native sysroot. The value of ${sysconfdir_native} is always "/etc", it does not mangle in any way (that's why I have used it).
Exactly, so the code in UpdateCertificates.java will try to access ${SYSCONFDIR_VALUE}/ssl/certs/java, i.e. /etc/ssl/certs/java, which is what your linux distro might or might not provide. It's not what yocto provides.
Cheers,
Andre'
Re: [meta-java][PATCH 1/3] ca-certificates-java: Fix sysconfdir for -native recipe
Quoted 83 lines · André Draszik
Quoted 82 lines · Yevgeny Popovych
Quoted 5 lines · André Draszik
Quoted 2 lines · Yevgeny Popovych
When ca-certificates-java-native is built, sysconfdir variable will be set to value that includes WORKDIR.
What is your use-case for a -native version of this?
I'm glad you asked as this should answer some questions..
I am building a package that contains prebuilt ca-certificates (including what ca-certificates itself build and JKS),
for this package I need -native version of ca-certificates-java. We have an immutable (readonly) rootfs, so running scripts at runtime is not an option.
With patches I have recently sent it works pretty well.The bottom line is that there is a use-case for -native version. Even if you don't have an immutable (readonly) rootfs - you might want to use it
that way because running scripts is quite error prone.Quoted 44 lines
Quoted 34 lines
Avoid patching source with this value - use
sysconfdir_native.Change-Id I8ac79c3cd5016a8139d9d8c8d58bc2976d0b6fa3Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java_20180516.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 2db1915..7db5110 100644
--- a/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
+++ b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bbrecipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-0@@ -41,9 +41,14 @@ do_patch_append () { bb.build.exec_func('do_fix_sysconfdir', d) } +# sysconfdir will include absolute native sysroot path in -native builds,avoid this
+# (see 36.24 of
https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#faq
)recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +3
-2+SYSCONFDIR_VALUE_class-target = "${sysconfdir}" +SYSCONFDIR_VALUE_class-native = "${sysconfdir_native}" + do_fix_sysconfdir () { - sed -e 's|/etc/ssl/certs/java|${sysconfdir}/ssl/certs/java|g' \ - -iQuoted 7 lines
${S}/src/main/java/org/debian/security/UpdateCertificates.java
+ sed -e
's|/etc/ssl/certs/java|${SYSCONFDIR_VALUE}/ssl/certs/java|g' \
+ -i
${S}/src/main/java/org/debian/security/UpdateCertificates.java
}No.
Quoted 2 lines
It's probably best to remove the BBCLASSEXTEND statement in this recipe instead, as it was never tested, and is unlikely to be needed.
We have a use-case for -native and this series fixes it.
Quoted 10 lines
The whole idea is to make this independent of the build machine paths. If
you want a -native version of this, you still need to make sure to point this into the yocto sysroot. Otherwise this will try to write to the *build
machine's*/etc/directory!If you really want a -native version, you need to point this into the sysroot, and update this dynamically because of sstate usage, too.
Quoted 8 lines
Quoted 4 lines
Ok, I suppose that ${sysconfdir_native} has mislead you -
it does _not_ resolve to an absolute path into native sysroot. The value of ${sysconfdir_native} is always "/etc", it does not mangle in any way (that's why I have used it).Exactly, so the code in UpdateCertificates.java will try to access ${SYSCONFDIR_VALUE}/ssl/certs/java, i.e.
/etc/ssl/certs/java, which is what your linux distro might or might not provide. It's not what yocto provides.
That's why we provide it with SYSROOT variable
(which is prepended to what becomes "/etc/ssl/certs/java")
because we want it to operate on a specific SYSROOT/file, not build host files. Even if you forgot to specify SYSROOT - you are not going to screw up your system because these files should be owned by root.
Quoted 5 lines
Quoted 1 line
Cheers,
Andre'
Signature · 2 lines
Sincerely, Yevgeny Popovych
PATCH 2/3 ca-certificates-java: Don't fail when called via hook on do_rootfs
In reply to Yevgeny PopovychIt is possible that ca-certificates-java hook will be called via update-ca-certificates hook during do_roofs (the case when D is set and JVM_LIBDIR is not).
This is a valid case so don't fail.
--- .../ca-certificates-java/ca-certificates-java.hook.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +3 -3
@@ -14,9 +14,9 @@ jvm_libdir="@@libdir_jvm@@" if [ -n "${D:-}" ] ; then # called from postinst as part of image build on host if [ -z "${JVM_LIBDIR:-}" ] ; then - # should never happen, this is supposed to be passed in - echo "$0: no JVM_LIBDIR specified" >&2 - false + # 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
Signature · 1 line
2.7.4
Re: [meta-java][PATCH 2/3] ca-certificates-java: Don't fail when called via hook on do_rootfs
Quoted 21 lines · Yevgeny Popovych
It is possible that ca-certificates-java hook will be called via update-ca-certificates hook during
do_roofs(the case when D is set andJVM_LIBDIRis not).
This is a valid case so don't fail.Change-Id I908e2f0acec487c41499543014014e29919bd6abSigned-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java.hook.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0certificates-java.hook.in b/recipes-core/ca-certificates-java/ca- certificates-java/ca-certificates-java.hook.in
index 89c764f..611a4ef 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
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in jvm_libdir="@@libdir_jvm@@" · line 19
Quoted 9 lines
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +3
-3@@ -14,9 +14,9 @@ jvm_libdir="@@libdir_jvm@@" if [ -n "${D:-}" ] ; then # called from postinst as part of image build on host if [ -z "${JVM_LIBDIR:-}" ] ; then - # should never happen, this is supposed to be passed in - echo "$0: no JVM_LIBDIR specified" >&2 - false + # 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
I don't understand how silently not creating / updating the Java certificate store any more is good? True, there is an issue here, but I'd say that this should actually do something useful, not just pretend to have done something.
Cheers,
Andre'
Re: [meta-java][PATCH 2/3] ca-certificates-java: Don't fail when called via hook on do_rootfs
Quoted 28 lines · André Draszik
Quoted 27 lines · Yevgeny Popovych
It is possible that ca-certificates-java hook will be called via update-ca-certificates hook during
do_roofs(the case when D is set andJVM_LIBDIRis not).
This is a valid case so don't fail.Change-Id I908e2f0acec487c41499543014014e29919bd6abSigned-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java.hook.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)(quoted diff) +0
-0certificates-java.hook.in b/recipes-core/ca-certificates-java/ca- certificates-java/ca-certificates-java.hook.in
index 89c764f..611a4ef 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.inrecipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +0
-3@@ -14,9 +14,9 @@ jvm_libdir="@@libdir_jvm@@" if [ -n "${D:-}" ] ; then # called from postinst as part of image build on host if [ -z "${JVM_LIBDIR:-}" ] ; then - # should never happen, this is supposed to be passed in - echo "$0: no JVM_LIBDIR specified" >&2 - false
Quoted 8 lines
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in jvm_libdir="@@libdir_jvm@@" · line 19
Quoted 3 lines
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +3
-0+ # 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 0I don't understand how silently not creating / updating the Java certificate store any more is good? True, there is an issue here, but I'd say that this should actually do something useful, not just pretend to have done something.
I have explained the issue in cover letter thread, quick summary:
I don't like how it is now, but this patch is just a fix.
IMO (as outlined in cover letter thread),
it would be nicer to have the ca-certificates call the hook,
and make postinst of this recipe a no-op.
I can implement this if you agree (either instead of this change or on top of it - I would prefer on top).
Quoted 5 lines
Cheers,
Andre'
Signature · 2 lines
Sincerely, Yevgeny Popovych
PATCH 3/3 ca-certificates-java: Distinguish between SYSROOT and D
In reply to Yevgeny PopovychThis 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.
--- .../ca-certificates-java/ca-certificates-java.hook.in | 17 ++++++++--------- .../ca-certificates-java_20180516.bb | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-)
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +8 -9
@@ -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
recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1 -1
@@ -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"
Signature · 1 line
2.7.4
Re: [meta-java][PATCH 3/3] ca-certificates-java: Distinguish between SYSROOT and D
Quoted 9 lines · Yevgeny Popovych
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 duringdo_rootfs.
I think I'm missing something...
It looks like this patch switches the hook script to use $SYSROOT instead of $D, and SYSROOT is set to $D in the postinst explicitly.
In both cases, the expansion of $SYSROOT or $D will yield the same. How is that fixing anything? What am I missing?
Cheers,
Andre'
Quoted 75 lines
Change-Id Ifbf50ca705a98012e1357ebf5afa33c07ea6cd87Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java.hook.in | 17 ++++++++-- ------- .../ca-certificates-java_20180516.bb | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-)(quoted diff) +0
-0certificates-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.inrecipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +7
-3@@ -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 asa native tool
if [ -z "${JVM_LIBDIR:-}" ] ; then
# ifJVM_LIBDIRis not present - we were called as a hook echo "called as a hook of ca-certificates ondo_rootfs, exiting" exit 0
fi
firecipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +0
-3-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 \
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +1
-4@@ -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(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 7db5110..2f2536d 100644recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-1@@ -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"
Signature · 1 line
2.7.4
Re: [meta-java][PATCH 3/3] ca-certificates-java: Distinguish between SYSROOT and D
Quoted 11 lines · André Draszik
Quoted 9 lines · Yevgeny Popovych
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 duringdo_rootfs.
Quoted 6 lines
I think I'm missing something...
It looks like this patch switches the hook script to use $SYSROOT instead of $D, and SYSROOT is set to $D in the postinst explicitly.In both cases, the expansion of $SYSROOT or $D will yield the same. How is that fixing anything? What am I missing?
The only difference would be between usage as a native tool and on do_rootfs. SYSROOT is always set when run on build host and it points to the files we want to modify. D is used only on do_rootfs and is used to find the hook (jar). On do_roofs these are equal.
Quoted 82 lines
Cheers,
Andre'Quoted 75 lines
Change-Id Ifbf50ca705a98012e1357ebf5afa33c07ea6cd87Signed-off-by Yevgeny Popovych <[email protected]>--- .../ca-certificates-java/ca-certificates-java.hook.in | 17 ++++++++-- ------- .../ca-certificates-java_20180516.bb | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-)(quoted diff) +0
-0certificates-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.inrecipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +7
-3@@ -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 asa native tool
if [ -z "${JVM_LIBDIR:-}" ] ; then
# ifJVM_LIBDIRis not present - we were called as a hook echo "called as a hook of ca-certificates ondo_rootfs, exiting" exit 0
fi
firecipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +0
-3-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 \
recipes-core/ca-certificates-java/ca-certificates-java/ca-certificates-java.hook.in +1
-4@@ -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(quoted diff) +0
-0java_20180516.bb b/recipes-core/ca-certificates-java/ca-certificates- java_20180516.bb
index 7db5110..2f2536d 100644recipes-core/ca-certificates-java/ca-certificates-java_20180516.bb +1
-1@@ -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"
Signature · 1 line
2.7.4
Signature · 2 lines
Sincerely, Yevgeny Popovych
Quoted 3 lines · Yevgeny Popovych
This series fixes several issues with ca-certificates-java:
* when used as a native tool
* failure ondo_rootfs
Can you share complete logs? I'd like to understand the do_rootfs issues you are seeing (I don't see any).
Quoted 2 lines
This doesn't fix all the issues and there is definitely a room for improvement.
What other issues?
Quoted 3 lines
I presume that running it on the target doesn't work - at least ${sysconfdir} is
not expanded in the hook.
True.
Quoted 5 lines
I also think that will be best to drop create-ca-certificates-java usage in
the postinst and let it be called as a hook of ca-certificates. This will allow
us to remove some code and simplify both script and recipe.
You can't do that, because ca-certificates could be installed before ca- certificates-java. In which case the hook will not be run.
Quoted 3 lines
It would be great if others could test their use cases; and clarify them - is create-ca-certificates-java really needed?.
As per above.
Cheers,
Andre'
Quoted 14 lines
Yevgeny Popovych (3):
ca-certificates-java: Fix sysconfdir for -native recipe
ca-certificates-java: Don't fail when called via hook ondo_rootfs
ca-certificates-java: Distinguish between SYSROOT and D.../ca-certificates-java.hook.in | 23 +++++++++++---- ------- .../ca-certificates-java_20180516.bb | 11 ++++++++--- 2 files changed, 19 insertions(+), 15 deletions(-)Signature · 1 line
2.7.4
Hi Andre,
Thanks for the feedback!
Quoted 7 lines · André Draszik
Quoted 3 lines · Yevgeny Popovych
This series fixes several issues with ca-certificates-java:
* when used as a native tool
* failure ondo_rootfsCan you share complete logs? I'd like to understand the
do_rootfsissues you are seeing (I don't see any).
The issue is that during do_rootfs, ca-certificates postinst calls
ca-certificates-java hook and the hook fails. (didn't save the log, sorry)
This is what patch #2 tries to fix (ca-certificates-java: Don't fail when called via hook on do_rootfs).
Richard also saw this issue when he tried another patch
(http://lists.openembedded.org/pipermail/openembedded-devel/2018-August/120066.html).
Although that doesn't matter IMO, I am using deb PACKAGE_CLASSES, and Richard supposedly uses ipk (the default one).
Quoted 5 lines
Quoted 3 lines
This doesn't fix all the issues and there is definitely a room for improvement.
What other issues?
At least the use case for the target (the one mentioned below) and some postinst issues that may appear (didn't test that).
Quoted 7 lines
Quoted 4 lines
I presume that running it on the target doesn't work - at least ${sysconfdir} is
not expanded in the hook.True.
Quoted 8 lines
Quoted 5 lines
I also think that will be best to drop create-ca-certificates-java usage in
the postinst and let it be called as a hook of ca-certificates. This will allow
us to remove some code and simplify both script and recipe.You can't do that, because ca-certificates could be installed before ca- certificates-java. In which case the hook will not be run.
This can't really happen.
In OE, all packages are first unpacked and only then, in a separate step, the postinst are run. This means that during do_rootfs, ca-certificates will always have the java hook present.
In addition to that, having the empty postinst in ca-certificates-java is desirable for target/runtime because on upgrades, the hook should be run by ca-certificates and our ca-certificates-java package should do nothing in this case. What I mean is that the package should just be a way to deliver the hook.
Quoted 25 lines
Quoted 4 lines
It would be great if others could test their use cases; and clarify them - is create-ca-certificates-java really needed?.
As per above.
Cheers,
Andre'Quoted 14 lines
Yevgeny Popovych (3):
ca-certificates-java: Fix sysconfdir for -native recipe
ca-certificates-java: Don't fail when called via hook ondo_rootfs
ca-certificates-java: Distinguish between SYSROOT and D.../ca-certificates-java.hook.in | 23 +++++++++++---- ------- .../ca-certificates-java_20180516.bb | 11 ++++++++--- 2 files changed, 19 insertions(+), 15 deletions(-)Signature · 1 line
2.7.4
Signature · 2 lines
Sincerely, Yevgeny Popovych