summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2015-06-15 21:09:06 +0000
committerJames Le Cuirot <chewi@gentoo.org>2015-06-15 21:09:06 +0000
commit39d470260d2c449ba8acdfef13718f787ea34400 (patch)
tree5a88cda884e529cafd984647c8b56d5ab418b963 /eclass
parentUpdating remote-id in metadata.xml (diff)
downloadhistorical-39d470260d2c449ba8acdfef13718f787ea34400.tar.gz
historical-39d470260d2c449ba8acdfef13718f787ea34400.tar.bz2
historical-39d470260d2c449ba8acdfef13718f787ea34400.zip
Add java-pkg_addres function for adding resource files to an existing
jar.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/java-utils-2.eclass33
2 files changed, 36 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 468342609f72..ed4ec9379017 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1664 2015/06/15 19:09:28 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1665 2015/06/15 21:09:06 chewi Exp $
+
+ 15 Jun 2015; James Le Cuirot <chewi@gentoo.org> java-utils-2.eclass:
+ Add java-pkg_addres function for adding resource files to an existing jar.
15 Jun 2015; Justin Lecher <jlec@gentoo.org> intel-sdp.eclass:
Don't install uninstall informations, bug 551638; make use of path_exists()
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 15a0bf20fd7c..bb900dc46b1b 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.162 2015/05/24 22:44:37 chewi Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.163 2015/06/15 21:09:06 chewi Exp $
# @ECLASS: java-utils-2.eclass
# @MAINTAINER:
@@ -217,6 +217,37 @@ java-pkg_doexamples() {
dosym "${dest}" "${JAVA_PKG_SHAREPATH}/examples" || die
}
+# @FUNCTION: java-pkg_addres
+# @USAGE: <jar> <dir> [<find arguments> ...]
+# @DESCRIPTION:
+# Adds resource files to an existing jar.
+# It is important that the directory given is actually the root of the
+# corresponding resource tree. The target directory as well as
+# sources.lst, MANIFEST.MF, *.class, *.jar, and *.java files are
+# automatically excluded. Symlinks are always followed. Additional
+# arguments are passed through to find.
+#
+# @CODE
+# java-pkg_addres ${PN}.jar resources ! -name "*.html"
+# @CODE
+#
+# @param $1 - jar file
+# @param $2 - resource tree directory
+# @param $* - arguments to pass to find
+java-pkg_addres() {
+ debug-print-function ${FUNCNAME} $*
+
+ [[ ${#} -lt 2 ]] && die "at least two arguments needed"
+
+ local jar=$(realpath "$1" || die "realpath $1 failed")
+ local dir="$2"
+ shift 2
+
+ pushd "${dir}" > /dev/null || die "pushd ${dir} failed"
+ find -L -type f ! -path "./target/*" ! -path "./sources.lst" ! -name "MANIFEST.MF" ! -regex ".*\.\(class\|jar\|java\)" "${@}" -print0 | xargs -0 jar uf "${jar}" || die "jar failed"
+ popd > /dev/null || die "popd failed"
+}
+
# @FUNCTION: java-pkg_dojar
# @USAGE: <jar1> [<jar2> ...]
# @DESCRIPTION: