diff options
author | Patrice Clement <monsieurp@gentoo.org> | 2015-07-22 09:20:07 +0000 |
---|---|---|
committer | Patrice Clement <monsieurp@gentoo.org> | 2015-07-22 09:20:07 +0000 |
commit | 1d5fcf5e5a82f16dc1bbeac2080d0a2ddd742fcf (patch) | |
tree | 4827e726761c7c51972e1e3717e5ded17b4729f6 | |
parent | Remove unnecessary backslashes (diff) | |
download | historical-1d5fcf5e5a82f16dc1bbeac2080d0a2ddd742fcf.tar.gz historical-1d5fcf5e5a82f16dc1bbeac2080d0a2ddd742fcf.tar.bz2 historical-1d5fcf5e5a82f16dc1bbeac2080d0a2ddd742fcf.zip |
Introduce java-pkg_rm_files as a helper function along with JAVA_RM_FILES array to readily get rid of useless files. Derived from perl_rm_files by Kent Fredric.
-rw-r--r-- | eclass/ChangeLog | 6 | ||||
-rw-r--r-- | eclass/java-utils-2.eclass | 48 |
2 files changed, 52 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 44bc41f0936f..475dcbb27c50 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1723 2015/07/20 15:05:49 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1724 2015/07/22 09:20:07 monsieurp Exp $ + + 22 Jul 2015; Patrice Clement <monsieurp@gentoo.org> java-utils-2.eclass: + Introduce java-pkg_rm_files as a helper function along with JAVA_RM_FILES + array to readily get rid of useless files. 20 Jul 2015; Sergei Trofimovich <slyfox@gentoo.org> haskell-cabal.eclass: Workaround upstream cabal tests hangup bug #537500 by Michael Orlitzky; use diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index cdc533f3cc76..dd2c1393308d 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -6,7 +6,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.165 2015/06/28 13:33:48 chewi Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.166 2015/07/22 09:20:07 monsieurp Exp $ # @ECLASS: java-utils-2.eclass # @MAINTAINER: @@ -248,6 +248,46 @@ java-pkg_addres() { popd > /dev/null || die "popd failed" } +# @FUNCTION: java-pkg_rm_files +# @USAGE: java-pkg_rm_files File1.java File2.java ... +# @DESCRIPTION: +# Remove unneeded files in ${S}. +# +# Every now and then, you'll run into situations whereby a file needs removing, +# be it a unit test or a regular java class. +# +# You can use this function by either: +# - calling it yourself in java_prepare() and feeding java-pkg_rm_files with +# the list of files you wish to remove. +# - defining an array in the ebuild named JAVA_RM_FILES with the list of files +# you wish to remove. +# +# Both way work and it is left to the developer's preferences. If the +# JAVA_RM_FILES array is defined, it is will be automatically handed over to +# java-pkg_rm_files. +# +# See java-utils-2_src_prepare. +# +# @CODE +# +# @param $* - list of files to remove. +# JAVA_RM_FILES - array containing files to remove. +# if defined, automatically handed over to java-pkg_rm_files in java-utils-2_src_prepare. +# +# @CODE +java-pkg_rm_files() { + debug-print-function ${FUNCNAME} $* + OIFS="$IFS" + IFS="\n" + for filename in "$@"; do + [[ ! -f "${filename}" ]] && die "${filename} is not a regular file. Aborting." + einfo "Removing unneeded file ${filename}" + rm -f "${S}/${filename}" || die "cannot remove ${filename}" + eend $? + done + IFS="$OIFS" +} + # @FUNCTION: java-pkg_dojar # @USAGE: <jar1> [<jar2> ...] # @DESCRIPTION: @@ -1782,6 +1822,12 @@ java-utils-2_src_prepare() { [[ ${EBUILD_PHASE} == prepare ]] && java-pkg_func-exists java_prepare && java_prepare + # Check for files in JAVA_RM_FILES array. + if [[ ${JAVA_RM_FILES[@]} ]]; then + debug-print "$FUNCNAME: removing unneeded files" + java-pkg_rm_files "${JAVA_RM_FILES[@]}" + fi + # Remember that eant will call this unless called via Portage if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then echo "Searching for bundled jars:" |