1 |
The new ECLASS_VARIABLE JAVA_PKG_NO_CLEAN is an array of expressions to |
2 |
match *.class or *.jar files in order to protect them against deletion |
3 |
by java-pkg_clean. |
4 |
|
5 |
This change helps in cases where most bundled *.class or *.jar files can |
6 |
be deleted while only some few cannot be replaced with system libraries. |
7 |
|
8 |
It also helps to visualize bundled stuff in the ebuild. |
9 |
|
10 |
Cleaning does not work by default. It still needs java-pkg_clean within |
11 |
src_prepare(). |
12 |
|
13 |
Signed-off-by: Volkmar W. Pogatzki <gentoo@××××××××.net> |
14 |
--- |
15 |
eclass/java-utils-2.eclass | 27 ++++++++++++++++++++++----- |
16 |
1 file changed, 22 insertions(+), 5 deletions(-) |
17 |
|
18 |
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass |
19 |
index 4f50ce39c5dc..7641f9f40290 100644 |
20 |
--- a/eclass/java-utils-2.eclass |
21 |
+++ b/eclass/java-utils-2.eclass |
22 |
@@ -1,4 +1,4 @@ |
23 |
-# Copyright 2004-2022 Gentoo Authors |
24 |
+# Copyright 2004-2023 Gentoo Authors |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
|
27 |
# @ECLASS: java-utils-2.eclass |
28 |
@@ -66,6 +66,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"} |
29 |
# JAVA_PKG_FORCE_VM=openjdk-11 emerge foo |
30 |
# @CODE |
31 |
|
32 |
+# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN |
33 |
+# @DEFAULT_UNSET |
34 |
+# @DESCRIPTION: |
35 |
+# An array of expressions to match *.class or *.jar files in order to protect |
36 |
+# them against deletion by java-pkg_clean. |
37 |
+# |
38 |
+# @CODE |
39 |
+# JAVA_PKG_NO_CLEAN=( |
40 |
+# "*/standard.jar" |
41 |
+# "*/launch4j.jar" |
42 |
+# "*/apps/jetty/apache-tomcat*" |
43 |
+# "*/lib/jetty*" |
44 |
+# ) |
45 |
+# @CODE |
46 |
+ |
47 |
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM |
48 |
# @DEFAULT_UNSET |
49 |
# @DESCRIPTION: |
50 |
@@ -2926,11 +2941,13 @@ is-java-strict() { |
51 |
# @FUNCTION: java-pkg_clean |
52 |
# @DESCRIPTION: |
53 |
# Java package cleaner function. This will remove all *.class and *.jar |
54 |
-# files, removing any bundled dependencies. |
55 |
+# files, except those specified by expressions in JAVA_PKG_NO_CLEAN. |
56 |
java-pkg_clean() { |
57 |
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then |
58 |
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die |
59 |
- fi |
60 |
+ NO_DELETE=() |
61 |
+ for keep in ${JAVA_PKG_NO_CLEAN[@]}; do |
62 |
+ NO_DELETE+=( '!' '-wholename' ${keep} ) |
63 |
+ done |
64 |
+ find "${@}" '(' -name '*.class' -o -name '*.jar' ${NO_DELETE[@]} ')' -type f -delete -print || die |
65 |
} |
66 |
|
67 |
# @FUNCTION: java-pkg_gen-cp |
68 |
-- |
69 |
2.39.1 |