• [gentoo-dev] [PATCH] java-vm-2.eclass: use "eselect java-vm update" if

    From Florian Schmaus@21:1/5 to All on Mon Jun 27 21:30:01 2022
    Thanks to Mike Gilbert (floppym) for valuable feedback.

    Closes: https://bugs.gentoo.org/853928
    Closes: https://github.com/gentoo/gentoo/pull/26069
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/java-vm-2.eclass | 30 ++++++++++++++++++++++++++++--
    1 file changed, 28 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
    index 8196b1cdc72a..dc0d87f4caf5 100644
    --- a/eclass/java-vm-2.eclass
    +++ b/eclass/java-vm-2.eclass
    @@ -25,6 +25,7 @@ RDEPEND="
    "
    DEPEND="${RDEPEND}"
    BDEPEND="app-arch/unzip"
    +IDEPEND="app-eselect/eselect-java"

    if [[ ${EAPI} == 6 ]]; then
    DEPEND+=" ${BDEPEND}"
    @@ -88,14 +89,35 @@ java-vm-2_pkg_postinst() {
    xdg_desktop_database_update
    }

    +# @FUNCTION: has_eselect_java-vm_update
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Checks if an eselect-java version providing "eselect java-vm update"
    +# is available.
    +# @RETURN: 0 if >=app-eselect/eselect-java-0.5 is installed, 1 otherwise. +has_eselect_java-vm_update() {
    + local has_version_args="-b"
    + if [[ ${EAPI} == 6 ]]; then
    + has_version_args="--host-root"
    + fi
    +
    + has_version "${has_version_args}" ">=app-eselect/eselect-java-0.5"
    +}

    # @FUNCTION: java-v
  • From Georgy Yakovlev@21:1/5 to Florian Schmaus on Mon Jun 27 21:40:01 2022
    On Mon, 2022-06-27 at 21:21 +0200, Florian Schmaus wrote:
    Thanks to Mike Gilbert (floppym) for valuable feedback.

    Closes: https://bugs.gentoo.org/853928
    Closes: https://github.com/gentoo/gentoo/pull/26069
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
     eclass/java-vm-2.eclass | 30 ++++++++++++++++++++++++++++--
     1 file changed, 28 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
    index 8196b1cdc72a..dc0d87f4caf5 100644
    --- a/eclass/java-vm-2.eclass
    +++ b/eclass/java-vm-2.eclass
    @@ -25,6 +25,7 @@ RDEPEND="
     "
     DEPEND="${RDEPEND}"
     BDEPEND="app-arch/unzip"
    +IDEPEND="app-eselect/eselect-java"

    IDEPEND here will not do anything to current jdk source ebuilds.

    openjdk source ebuilds are EAPI7 at the moment and can't be updated to
    EAPI8 due to econf unconditionally passing '--disable-static'

    configure: error: unrecognized options: --disable-static
    configure exiting with result code 1

    so befire IDEPEND works we either have to fix portage/EAPI8 econf, or
    roll custom econf in source packages of jdk.

    https://bugs.gentoo.org/814380 - looks like the following jdk
    ./configure option triggers it:

    --enable-static-build


     
     if [[ ${EAPI} == 6 ]]; then
            DEPEND+=" ${BDEPEND}"
    @@ -88,14 +89,35 @@ java-vm-2_pkg_postinst() {         xdg_desktop_database_update
     }
     
    +# @FUNCTION: has_eselect_java-vm_update
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Checks if an eselect-java version providing "eselect java-vm
    update"
    +# is available.
    +# @RETURN: 0 if >=app-eselect/eselect-java-0.5 is installed, 1
    otherwise.
    +has_eselect_java-vm_update() {
    +       local has_version_args="-b"
    +       if [[ ${EAPI} == 6 ]]; then +               has_version_args="--host-root" +       fi
    +
    +       has_version "${has_version_args}" ">=app-eselect/eselect- java-0.5"
    +}
     
     # @FUNCTION: java-vm-2_pkg_prerm
     # @DESCRIPTION:
     # default pkg_prerm
     #
    -# Warn user if removing system-vm.
    +# Does nothing if eselect-java-0.5 or newer is available. 
    Otherwhise,
    +# warn user if removing system-vm.
     
     java-vm-2_pkg_prerm() {
    +       if has_eselect_java-vm_update; then +               # We will potentially switch to a new Java system VM
    in
    +               # pkg_postrm(). +               return
    +       fi
    +
            if [[ $(GENTOO_VM= java-config -f 2>/dev/null) == ${VMHANDLE} && -z ${REPLACED_BY_VERSION} ]]; then
                    ewarn "It appears you are removing your system-vm!
    Please run"
                    ewarn "\"eselect java-vm list\" to list available
    VMs, then use"
    @@ -108,10 +130,14 @@ java-vm-2_pkg_prerm() {
     # @DESCRIPTION:
     # default pkg_postrm
     #
    -# Update mime database.
    +# Invoke "eselect java-vm update" if eselect-java 0.5, or newer, is
    +# available.  Also update the mime database.
     
     java-vm-2_pkg_postrm() {
            xdg_desktop_database_update
    +       if has_eselect_java-vm_update; then +               eselect --root="${EROOT}" java-vm update +       fi
     }
     
     

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to gyakovlev@gentoo.org on Mon Jun 27 21:50:01 2022
    On Mon, Jun 27, 2022 at 3:39 PM Georgy Yakovlev <gyakovlev@gentoo.org> wrote:

    On Mon, 2022-06-27 at 21:21 +0200, Florian Schmaus wrote:
    Thanks to Mike Gilbert (floppym) for valuable feedback.

    Closes: https://bugs.gentoo.org/853928
    Closes: https://github.com/gentoo/gentoo/pull/26069
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/java-vm-2.eclass | 30 ++++++++++++++++++++++++++++--
    1 file changed, 28 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
    index 8196b1cdc72a..dc0d87f4caf5 100644
    --- a/eclass/java-vm-2.eclass
    +++ b/eclass/java-vm-2.eclass
    @@ -25,6 +25,7 @@ RDEPEND="
    "
    DEPEND="${RDEPEND}"
    BDEPEND="app-arch/unzip"
    +IDEPEND="app-eselect/eselect-java"

    IDEPEND here will not do anything to current jdk source ebuilds.

    I think that's fine. The eclass claims to support EAPI 8, so this will
    make IDEPEND work properly if/when you update the JDK ebuilds.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Schmaus@21:1/5 to Georgy Yakovlev on Tue Jun 28 09:10:01 2022
    On 27/06/2022 21.39, Georgy Yakovlev wrote:
    On Mon, 2022-06-27 at 21:21 +0200, Florian Schmaus wrote:
    Thanks to Mike Gilbert (floppym) for valuable feedback.

    Closes: https://bugs.gentoo.org/853928
    Closes: https://github.com/gentoo/gentoo/pull/26069
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
     eclass/java-vm-2.eclass | 30 ++++++++++++++++++++++++++++--
     1 file changed, 28 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
    index 8196b1cdc72a..dc0d87f4caf5 100644
    --- a/eclass/java-vm-2.eclass
    +++ b/eclass/java-vm-2.eclass
    @@ -25,6 +25,7 @@ RDEPEND="
     "
     DEPEND="${RDEPEND}"
     BDEPEND="app-arch/unzip"
    +IDEPEND="app-eselect/eselect-java"

    IDEPEND here will not do anything to current jdk source ebuilds.

    Right, this is specified providently. I've updated the commit message of
    the change in the according pull request to make this more clear.

    Also note that PMS does not guarantee that IDEPEND dependencies will be available in pkg_*rm phases.

    But ultimately, declaring IDEPEND on eselect-java is the best thing we
    can do here.


    openjdk source ebuilds are EAPI7 at the moment and can't be updated to
    EAPI8 due to econf unconditionally passing '--disable-static'

    I remember running into this when I tried to bump the JDK ebuilds to EAPI 8.

    - Flow

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)