Skip to contentSkip to conversation

Revert "base-files: Define JAVA_HOME by default"

PATCH In review Fang Jia 2 participants 7 messages Feb 21, 2019 – Jul 22, 2019

lore
Share & tools
lore

Fang Jia

author
#0 lore raw

PATCH 1/2 Revert "base-files: Define JAVA_HOME by default"

This reverts commit ada652564f09756a81f54495cbc2091125239625.

When enable multilib on a 64-bit system, probably both base-file and lib32-base-files are installed.
Then both packages want to modify the file "profile", there will be an error like:
"
Error: Transaction check error:
file /etc/profile conflicts between attempted installs of lib32-base-files-3.0.14-r148.gpb_virt and base-files-3.0.14-r148.gpb_virt
"

The task can be added by adding a file to ${sysconfdir}/profile.d/.

---
 recipes-core/base-files/base-files_3.0.14.bbappend | 13 -------------
 1 file changed, 13 deletions(-)
 delete mode 100644 recipes-core/base-files/base-files_3.0.14.bbappend
recipes-core/base-files/base-files_3.0.14.bbappend deleted +0 -13
deleted file mode 100644
index 4651185..0000000
@@ -1,13 +0,0 @@
-do_install_append() {
-	cat >> ${D}${sysconfdir}/profile << EOT
-JAVA_HOME=""
-for dir in ${libdir}/jvm/*; do
-	if [ -x "\${dir}/bin/java" ]; then
-		[ -z "\${JAVA_HOME}" ] && JAVA_HOME="\${dir}"
-	fi
-done
-if [ -n "\${JAVA_HOME}" ]; then
-	export JAVA_HOME=\${JAVA_HOME}
-fi
-EOT
-}
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 openjdk: add openjdk-config

* Create a new package openjdk-config which used to set variable value for openjdk.
* The LICENSE file of openjdk-config is COPYING.MIT.
* Allow JAVA_HOME to be configured via a variable of the same name.
* Define JAVA_HOME by default in openjdk-config.sh file.

---
 recipes-core/openjdk/openjdk-config.bb             | 24 ++++++++++++++++++++++
 recipes-core/openjdk/openjdk-config/COPYING.MIT    | 17 +++++++++++++++
 .../openjdk/openjdk-config/openjdk-config.sh       | 11 ++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 recipes-core/openjdk/openjdk-config.bb
 create mode 100644 recipes-core/openjdk/openjdk-config/COPYING.MIT
 create mode 100644 recipes-core/openjdk/openjdk-config/openjdk-config.sh
recipes-core/openjdk/openjdk-config.bb new file +24 -0
new file mode 100644
index 0000000..34f9356
@@ -0,0 +1,24 @@
+SUMMARY = "Configuration script to set variables"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+PR = "r1"
+
+SRC_URI = "file://COPYING.MIT \
+	   file://openjdk-config.sh \
+"
+
+S = "${WORKDIR}"
+
+# Set the default value
+JAVA_HOME ?= ""
+
+do_configure() {
+	sed -i "s%@JAVA_HOME@%${JAVA_HOME}%" openjdk-config.sh
+	sed -i "s%@libdir@%${libdir}%" openjdk-config.sh
+}
+
+do_install() {
+	install -d ${D}${sysconfdir}/profile.d
+	install -m 0755 openjdk-config.sh ${D}${sysconfdir}/profile.d/
+}
recipes-core/openjdk/openjdk-config/COPYING.MIT new file +17 -0
new file mode 100644
index 0000000..fb950dc
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy 
+of this software and associated documentation files (the "Software"), to deal 
+in the Software without restriction, including without limitation the rights 
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
+copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in 
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
+THE SOFTWARE.
recipes-core/openjdk/openjdk-config/openjdk-config.sh new file +11 -0
new file mode 100644
index 0000000..34b49d6
@@ -0,0 +1,11 @@
+JAVA_HOME="@JAVA_HOME@"
+libdir="@libdir@"
+
+for dir in ${libdir}/jvm/*; do
+	if [ -x "${dir}/bin/java" ]; then
+		[ -z "${JAVA_HOME}" ] && JAVA_HOME="${dir}"
+	fi
+done
+if [ -n "${JAVA_HOME}" ]; then
+	export JAVA_HOME=${JAVA_HOME}
+fi
Signature · 1 line
2.7.4
author
#2 lore raw

Re: [PATCH 2/2] openjdk: add openjdk-config

Hi, Richard Leitner

How about this patch ? Could you help to give some suggestions ?

Thanks,
Fang

Quoted 87 lines · Fang Jia

* Create a new package openjdk-config which used to set variable value for openjdk.
* The LICENSE file of openjdk-config is COPYING.MIT.
* Allow JAVA_HOME to be configured via a variable of the same name.
* Define JAVA_HOME by default in openjdk-config.sh file.

---
 recipes-core/openjdk/openjdk-config.bb             | 24 ++++++++++++++++++++++
 recipes-core/openjdk/openjdk-config/COPYING.MIT    | 17 +++++++++++++++
 .../openjdk/openjdk-config/openjdk-config.sh       | 11 ++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 recipes-core/openjdk/openjdk-config.bb
 create mode 100644 recipes-core/openjdk/openjdk-config/COPYING.MIT
 create mode 100644 recipes-core/openjdk/openjdk-config/openjdk-config.sh
recipes-core/openjdk/openjdk-config.bb new file +24 -0
new file mode 100644
index 0000000..34f9356
@@ -0,0 +1,24 @@
+SUMMARY = "Configuration script to set variables"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+PR = "r1"
+
+SRC_URI = "file://COPYING.MIT \
+	   file://openjdk-config.sh \
+"
+
+S = "${WORKDIR}"
+
+# Set the default value
+JAVA_HOME ?= ""
+
+do_configure() {
+	sed -i "s%@JAVA_HOME@%${JAVA_HOME}%" openjdk-config.sh
+	sed -i "s%@libdir@%${libdir}%" openjdk-config.sh
+}
+
+do_install() {
+	install -d ${D}${sysconfdir}/profile.d
+	install -m 0755 openjdk-config.sh ${D}${sysconfdir}/profile.d/
+}
recipes-core/openjdk/openjdk-config/COPYING.MIT new file +17 -0
new file mode 100644
index 0000000..fb950dc
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy 
+of this software and associated documentation files (the "Software"), to deal 
+in the Software without restriction, including without limitation the rights 
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
+copies of the Software, and to permit persons to whom the Software is 
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in 
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
+THE SOFTWARE.
recipes-core/openjdk/openjdk-config/openjdk-config.sh new file +11 -0
new file mode 100644
index 0000000..34b49d6
@@ -0,0 +1,11 @@
+JAVA_HOME="@JAVA_HOME@"
+libdir="@libdir@"
+
+for dir in ${libdir}/jvm/*; do
+	if [ -x "${dir}/bin/java" ]; then
+		[ -z "${JAVA_HOME}" ] && JAVA_HOME="${dir}"
+	fi
+done
+if [ -n "${JAVA_HOME}" ]; then
+	export JAVA_HOME=${JAVA_HOME}
+fi
#3 lore raw
In reply to Fang Jia

Hi,
thanks for the patch. Looks good to me now.
I'll add it to my tests and will give feedback.

Nonetheless things to improve for your next contribution:
a) Please add [meta-java] to the subject
b) Please version the patchset when it updates an existing one on the mailinglist

Therefore the correct subject prefix for this patchset would have been:
[oe][meta-java][PATCH V2 1/2]

No problem for this one as I found it, but please keep an eye on that for the next time. Thanks.

regards;Richard.L

Quoted 41 lines · Fang Jia

This reverts commit ada652564f09756a81f54495cbc2091125239625.

When enable multilib on a 64-bit system, probably both base-file and lib32-base-files are installed.
Then both packages want to modify the file "profile", there will be an error like:
"
Error: Transaction check error:
file /etc/profile conflicts between attempted installs of lib32-base-files-3.0.14-r148.gpb_virt and base-files-3.0.14-r148.gpb_virt
"

The task can be added by adding a file to ${sysconfdir}/profile.d/.

---
  recipes-core/base-files/base-files_3.0.14.bbappend | 13 -------------
  1 file changed, 13 deletions(-)

delete mode 100644 recipes-core/base-files/base-files_3.0.14.bbappend

recipes-core/base-files/base-files_3.0.14.bbappend deleted +0 -13
deleted file mode 100644
index 4651185..0000000
@@ -1,13 +0,0 @@
-do_install_append() {
-	cat >> ${D}${sysconfdir}/profile << EOT
-JAVA_HOME=""
-for dir in ${libdir}/jvm/*; do
-	if [ -x "\${dir}/bin/java" ]; then
-		[ -z "\${JAVA_HOME}" ] && JAVA_HOME="\${dir}"
-	fi
-done
-if [ -n "\${JAVA_HOME}" ]; then
-	export JAVA_HOME=\${JAVA_HOME}
-fi
-EOT
-}
author
#4 lore raw

Hi,
Thank you so much.
Next time will do as your instruction definitely. Thanks again.

Regards,
Fang

Quoted 16 lines · Richard Leitner

Hi,
thanks for the patch. Looks good to me now.
I'll add it to my tests and will give feedback.

Nonetheless things to improve for your next contribution:
 a) Please add [meta-java] to the subject
 b) Please version the patchset when it updates an existing one on the mailinglist

Therefore the correct subject prefix for this patchset would have been:
 [oe][meta-java][PATCH V2 1/2]

No problem for this one as I found it, but please keep an eye on that for the next time. Thanks.

regards;Richard.L

author
#5 lore raw
In reply to Richard Leitner

Hi Richard

How about the test for the two patches ? Is it fine to push to master branch ?

Thanks,
Fang

Quoted 61 lines · Richard Leitner

Hi,
thanks for the patch. Looks good to me now.
I'll add it to my tests and will give feedback.

Nonetheless things to improve for your next contribution:
 a) Please add [meta-java] to the subject
 b) Please version the patchset when it updates an existing one on the mailinglist

Therefore the correct subject prefix for this patchset would have been:
 [oe][meta-java][PATCH V2 1/2]

No problem for this one as I found it, but please keep an eye on that for the next time. Thanks.

regards;Richard.L

Quoted 42 lines · Fang Jia

This reverts commit ada652564f09756a81f54495cbc2091125239625.

When enable multilib on a 64-bit system, probably both base-file and lib32-base-files are installed.
Then both packages want to modify the file "profile", there will be an error like:
"
Error: Transaction check error:
file /etc/profile conflicts between attempted installs of lib32-base-files-3.0.14-r148.gpb_virt and base-files-3.0.14-r148.gpb_virt
"

The task can be added by adding a file to ${sysconfdir}/profile.d/.

---
  recipes-core/base-files/base-files_3.0.14.bbappend | 13 -------------

  1 file changed, 13 deletions(-)

  delete mode 100644 recipes-core/base-files/base-files_3.0.14.bbappend

recipes-core/base-files/base-files_3.0.14.bbappend deleted +0 -13
deleted file mode 100644
index 4651185..0000000
@@ -1,13 +0,0 @@
-do_install_append() {
-    cat >> ${D}${sysconfdir}/profile << EOT
-JAVA_HOME=""
-for dir in ${libdir}/jvm/*; do
-    if [ -x "\${dir}/bin/java" ]; then
-        [ -z "\${JAVA_HOME}" ] && JAVA_HOME="\${dir}"
-    fi
-done
-if [ -n "\${JAVA_HOME}" ]; then
-    export JAVA_HOME=\${JAVA_HOME}
-fi
-EOT
-}
#6 lore raw
In reply to Fang Jia

Hi,
this is a note to let you know that I've just added this patch to the master-next branch of the meta-java repository at
git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

Quoted 41 lines · Fang Jia

This reverts commit ada652564f09756a81f54495cbc2091125239625.

When enable multilib on a 64-bit system, probably both base-file and lib32-base-files are installed.
Then both packages want to modify the file "profile", there will be an error like:
"
Error: Transaction check error:
file /etc/profile conflicts between attempted installs of lib32-base-files-3.0.14-r148.gpb_virt and base-files-3.0.14-r148.gpb_virt
"

The task can be added by adding a file to ${sysconfdir}/profile.d/.

---
  recipes-core/base-files/base-files_3.0.14.bbappend | 13 -------------
  1 file changed, 13 deletions(-)

delete mode 100644 recipes-core/base-files/base-files_3.0.14.bbappend

recipes-core/base-files/base-files_3.0.14.bbappend deleted +0 -13
deleted file mode 100644
index 4651185..0000000
@@ -1,13 +0,0 @@
-do_install_append() {
-	cat >> ${D}${sysconfdir}/profile << EOT
-JAVA_HOME=""
-for dir in ${libdir}/jvm/*; do
-	if [ -x "\${dir}/bin/java" ]; then
-		[ -z "\${JAVA_HOME}" ] && JAVA_HOME="\${dir}"
-	fi
-done
-if [ -n "\${JAVA_HOME}" ]; then
-	export JAVA_HOME=\${JAVA_HOME}
-fi
-EOT
-}