* [gentoo-dev] [PATCH v2] java-utils-2.eclass: ECLASS_VARIABLE JAVA_PKG_NO_CLEAN
@ 2023-02-04 18:00 Volkmar W. Pogatzki
0 siblings, 0 replies; only message in thread
From: Volkmar W. Pogatzki @ 2023-02-04 18:00 UTC (permalink / raw
To: gentoo-dev
The new ECLASS_VARIABLE JAVA_PKG_NO_CLEAN is defined as an array in
which those *.class or *.jar files can be listed which should not be
removed by java-pkg_clean. This change helps in cases where only a
small parts of bundled stuff cannot be replaced with system libraries.
It also helps to visualize not yet unbundled stuff in the ebuild.
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-utils-2.eclass | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 4f50ce39c5dc..8601c66287a1 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,18 @@ 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 *.class or *.jar files which must not be deleted by java-pkg_clean.
+#
+# @CODE
+# JAVA_PKG_NO_CLEAN=(
+# apps/susidns/src/lib/jstl.jar
+# apps/susidns/src/lib/standard.jar
+# )
+# @CODE
+
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -2926,11 +2938,16 @@ 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, removing any bundled dependencies except bundled sources.
java-pkg_clean() {
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die
- fi
+ local FILES_TO_DELETE=$(find "${@}" '(' -name '*.class' -o -name '*.jar' ')')
+ FILES_TO_DELETE=${FILES_TO_DELETE//\.\/${@}}
+ for keep in "${JAVA_PKG_NO_CLEAN[@]}"; do
+ FILES_TO_DELETE=${FILES_TO_DELETE//${keep}}
+ done
+ for delete in "${FILES_TO_DELETE[@]}"; do
+ rm -v ${delete} || die
+ done
}
# @FUNCTION: java-pkg_gen-cp
--
2.39.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-04 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-04 18:00 [gentoo-dev] [PATCH v2] java-utils-2.eclass: ECLASS_VARIABLE JAVA_PKG_NO_CLEAN Volkmar W. Pogatzki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox