1 |
On Mon, 2022-06-27 at 21:21 +0200, Florian Schmaus wrote: |
2 |
> Thanks to Mike Gilbert (floppym) for valuable feedback. |
3 |
> |
4 |
> Closes: https://bugs.gentoo.org/853928 |
5 |
> Closes: https://github.com/gentoo/gentoo/pull/26069 |
6 |
> Signed-off-by: Florian Schmaus <flow@g.o> |
7 |
> --- |
8 |
> eclass/java-vm-2.eclass | 30 ++++++++++++++++++++++++++++-- |
9 |
> 1 file changed, 28 insertions(+), 2 deletions(-) |
10 |
> |
11 |
> diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass |
12 |
> index 8196b1cdc72a..dc0d87f4caf5 100644 |
13 |
> --- a/eclass/java-vm-2.eclass |
14 |
> +++ b/eclass/java-vm-2.eclass |
15 |
> @@ -25,6 +25,7 @@ RDEPEND=" |
16 |
> " |
17 |
> DEPEND="${RDEPEND}" |
18 |
> BDEPEND="app-arch/unzip" |
19 |
> +IDEPEND="app-eselect/eselect-java" |
20 |
|
21 |
IDEPEND here will not do anything to current jdk source ebuilds. |
22 |
|
23 |
openjdk source ebuilds are EAPI7 at the moment and can't be updated to |
24 |
EAPI8 due to econf unconditionally passing '--disable-static' |
25 |
|
26 |
configure: error: unrecognized options: --disable-static |
27 |
configure exiting with result code 1 |
28 |
|
29 |
so befire IDEPEND works we either have to fix portage/EAPI8 econf, or |
30 |
roll custom econf in source packages of jdk. |
31 |
|
32 |
https://bugs.gentoo.org/814380 - looks like the following jdk |
33 |
./configure option triggers it: |
34 |
|
35 |
--enable-static-build |
36 |
|
37 |
|
38 |
> |
39 |
> if [[ ${EAPI} == 6 ]]; then |
40 |
> DEPEND+=" ${BDEPEND}" |
41 |
> @@ -88,14 +89,35 @@ java-vm-2_pkg_postinst() { |
42 |
> xdg_desktop_database_update |
43 |
> } |
44 |
> |
45 |
> +# @FUNCTION: has_eselect_java-vm_update |
46 |
> +# @INTERNAL |
47 |
> +# @DESCRIPTION: |
48 |
> +# Checks if an eselect-java version providing "eselect java-vm |
49 |
> update" |
50 |
> +# is available. |
51 |
> +# @RETURN: 0 if >=app-eselect/eselect-java-0.5 is installed, 1 |
52 |
> otherwise. |
53 |
> +has_eselect_java-vm_update() { |
54 |
> + local has_version_args="-b" |
55 |
> + if [[ ${EAPI} == 6 ]]; then |
56 |
> + has_version_args="--host-root" |
57 |
> + fi |
58 |
> + |
59 |
> + has_version "${has_version_args}" ">=app-eselect/eselect- |
60 |
> java-0.5" |
61 |
> +} |
62 |
> |
63 |
> # @FUNCTION: java-vm-2_pkg_prerm |
64 |
> # @DESCRIPTION: |
65 |
> # default pkg_prerm |
66 |
> # |
67 |
> -# Warn user if removing system-vm. |
68 |
> +# Does nothing if eselect-java-0.5 or newer is available. |
69 |
> Otherwhise, |
70 |
> +# warn user if removing system-vm. |
71 |
> |
72 |
> java-vm-2_pkg_prerm() { |
73 |
> + if has_eselect_java-vm_update; then |
74 |
> + # We will potentially switch to a new Java system VM |
75 |
> in |
76 |
> + # pkg_postrm(). |
77 |
> + return |
78 |
> + fi |
79 |
> + |
80 |
> if [[ $(GENTOO_VM= java-config -f 2>/dev/null) == ${VMHANDLE} |
81 |
> && -z ${REPLACED_BY_VERSION} ]]; then |
82 |
> ewarn "It appears you are removing your system-vm! |
83 |
> Please run" |
84 |
> ewarn "\"eselect java-vm list\" to list available |
85 |
> VMs, then use" |
86 |
> @@ -108,10 +130,14 @@ java-vm-2_pkg_prerm() { |
87 |
> # @DESCRIPTION: |
88 |
> # default pkg_postrm |
89 |
> # |
90 |
> -# Update mime database. |
91 |
> +# Invoke "eselect java-vm update" if eselect-java 0.5, or newer, is |
92 |
> +# available. Also update the mime database. |
93 |
> |
94 |
> java-vm-2_pkg_postrm() { |
95 |
> xdg_desktop_database_update |
96 |
> + if has_eselect_java-vm_update; then |
97 |
> + eselect --root="${EROOT}" java-vm update |
98 |
> + fi |
99 |
> } |
100 |
> |
101 |
> |