summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2023-02-04 14:05:59 +0100
committerMiroslav Šulc <fordfrog@gentoo.org>2023-02-10 10:50:48 +0100
commit7125dbc4af3e143c96174b52d7583b66933f22d7 (patch)
tree468e66f9410e6faf535234caffd8da2cc88d7a8f /eclass/java-utils-2.eclass
parentdev-libs/nss: add 3.88.1 (diff)
downloadgentoo-7125dbc4af3e143c96174b52d7583b66933f22d7.tar.gz
gentoo-7125dbc4af3e143c96174b52d7583b66933f22d7.tar.bz2
gentoo-7125dbc4af3e143c96174b52d7583b66933f22d7.zip
java-utils-2.eclass: ECLASS_VARIABLE JAVA_PKG_NO_CLEAN
The new ECLASS_VARIABLE JAVA_PKG_NO_CLEAN is an array of expressions to match *.class or *.jar files in order to protect them against deletion by java-pkg_clean. This change helps in cases where most bundled *.class or *.jar files can be deleted while only some few cannot be replaced with system libraries. It also helps to visualize bundled stuff in the ebuild. Cleaning does not work by default. It still needs java-pkg_clean within src_prepare(). Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/29470 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r--eclass/java-utils-2.eclass27
1 files changed, 22 insertions, 5 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 4f50ce39c5dc..7641f9f40290 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2022 Gentoo Authors
+# Copyright 2004-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -66,6 +66,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# JAVA_PKG_FORCE_VM=openjdk-11 emerge foo
# @CODE
+# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array of expressions to match *.class or *.jar files in order to protect
+# them against deletion by java-pkg_clean.
+#
+# @CODE
+# JAVA_PKG_NO_CLEAN=(
+# "*/standard.jar"
+# "*/launch4j.jar"
+# "*/apps/jetty/apache-tomcat*"
+# "*/lib/jetty*"
+# )
+# @CODE
+
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -2926,11 +2941,13 @@ is-java-strict() {
# @FUNCTION: java-pkg_clean
# @DESCRIPTION:
# Java package cleaner function. This will remove all *.class and *.jar
-# files, removing any bundled dependencies.
+# files, except those specified by expressions in JAVA_PKG_NO_CLEAN.
java-pkg_clean() {
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die
- fi
+ NO_DELETE=()
+ for keep in ${JAVA_PKG_NO_CLEAN[@]}; do
+ NO_DELETE+=( '!' '-wholename' ${keep} )
+ done
+ find "${@}" '(' -name '*.class' -o -name '*.jar' ${NO_DELETE[@]} ')' -type f -delete -print || die
}
# @FUNCTION: java-pkg_gen-cp