1 |
The new ECLASS_VARIABLE JAVA_PKG_NO_CLEAN is defined as an array in |
2 |
which those *.class or *.jar files can be listed which should not be |
3 |
removed by java-pkg_clean. This change helps in cases where only a |
4 |
small parts of bundled stuff cannot be replaced with system libraries. |
5 |
It also helps to visualize not yet unbundled stuff in the ebuild. |
6 |
|
7 |
Signed-off-by: Volkmar W. Pogatzki <gentoo@××××××××.net> |
8 |
--- |
9 |
eclass/java-utils-2.eclass | 27 +++++++++++++++++++++++---- |
10 |
1 file changed, 23 insertions(+), 4 deletions(-) |
11 |
|
12 |
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass |
13 |
index 4f50ce39c5dc..5cd9d441f396 100644 |
14 |
--- a/eclass/java-utils-2.eclass |
15 |
+++ b/eclass/java-utils-2.eclass |
16 |
@@ -1,4 +1,4 @@ |
17 |
-# Copyright 2004-2022 Gentoo Authors |
18 |
+# Copyright 2004-2023 Gentoo Authors |
19 |
# Distributed under the terms of the GNU General Public License v2 |
20 |
|
21 |
# @ECLASS: java-utils-2.eclass |
22 |
@@ -66,6 +66,18 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"} |
23 |
# JAVA_PKG_FORCE_VM=openjdk-11 emerge foo |
24 |
# @CODE |
25 |
|
26 |
+# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN |
27 |
+# @DEFAULT_UNSET |
28 |
+# @DESCRIPTION: |
29 |
+# An array of *.class or *.jar files which must not be deleted by java-pkg_clean. |
30 |
+# |
31 |
+# @CODE |
32 |
+# JAVA_PKG_NO_CLEAN=( |
33 |
+# apps/susidns/src/lib/jstl.jar |
34 |
+# apps/susidns/src/lib/standard.jar |
35 |
+# ) |
36 |
+# @CODE |
37 |
+ |
38 |
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM |
39 |
# @DEFAULT_UNSET |
40 |
# @DESCRIPTION: |
41 |
@@ -2928,9 +2940,16 @@ is-java-strict() { |
42 |
# Java package cleaner function. This will remove all *.class and *.jar |
43 |
# files, removing any bundled dependencies. |
44 |
java-pkg_clean() { |
45 |
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then |
46 |
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die |
47 |
- fi |
48 |
+ pushd ${S} > /dev/null || die |
49 |
+ local FILES_TO_DELETE=$(find * '(' -name '*.class' -o -name '*.jar' ')') |
50 |
+ for keep in "${JAVA_PKG_NO_CLEAN[@]}"; do |
51 |
+ FILES_TO_DELETE=${FILES_TO_DELETE//${keep}} |
52 |
+ done |
53 |
+ for delete in "${FILES_TO_DELETE[@]}"; do |
54 |
+ echo "" |
55 |
+ rm -v ${delete} || die |
56 |
+ done |
57 |
+ popd > /dev/null || die |
58 |
} |
59 |
|
60 |
# @FUNCTION: java-pkg_gen-cp |
61 |
-- |
62 |
2.39.1 |