public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-java@lists.gentoo.org
Subject: Re: [gentoo-java] Running java-pkg_ensure-no-bundled-jars automatically with JAVA_PKG_STRICT
Date: Tue, 09 Jan 2007 18:13:56 +0200	[thread overview]
Message-ID: <45A3BF44.4000401@gentoo.org> (raw)
In-Reply-To: <459F9F93.10109@gentoo.org>


[-- Attachment #1.1: Type: text/plain, Size: 869 bytes --]

Petteri Räty kirjoitti:
> Joshua Nichols kirjoitti:
>> * Some packages are weird, and jar up their sources inside of their
>> upstream distfile, which we then unpack. So, we'd either need to remove
>> those jars after unpacking, or perhaps add some checks to ensure the
>> bundled jars don't contain class files
>> * Some packages have jars for like tests, or examples, or whatnot. Maybe
>> we need a variable to say what jars are ok?
>> * In some cases, we may be only replacing some jars with jar-from... but
>> perhaps not all of them, or maybe they are meant to replace a jar, but
>> the jar changed names, so both the symlink from jar-from and the
>> original are around.
>>
> 
> Probably best to go with the attached then.
> 
> Regards,
> Petteri
> 

Ok. The attached is probably what I am going to commit this week unless
someone objects.

[-- Attachment #1.2: warn-about-bundled-jars.patch --]
[-- Type: text/plain, Size: 2505 bytes --]

Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.39
diff -u -r1.39 java-utils-2.eclass
--- java-utils-2.eclass	3 Jan 2007 09:18:20 -0000	1.39
+++ java-utils-2.eclass	9 Jan 2007 16:12:19 -0000
@@ -1011,13 +1011,36 @@
 #	export RDEPEND="${RDEPEND} ${depstr}"
 #}
 
-# This should be used after S has been populated with symlinks to jars
-# TODO document
+# ------------------------------------------------------------------------------
+# @ebuild-function java-pkg_find-normal-jars
+#
+# Find the files with suffix .jar file in the given directory or $WORKDIR
+#
+# @param $1 - The directory to search for jar files (default: ${WORKDIR})
+# ------------------------------------------------------------------------------
+java-pkg_find-normal-jars() {
+	local dir=$1
+	[[ "${dir}" ]] || dir="${WORKDIR}"
+	local found
+	for jar in $(find "${dir}" -name "*.jar" -type f); do
+		echo "${jar}"
+		found="true"
+	done
+	[[ "${found}" ]]
+	return $?
+}
+
+# ------------------------------------------------------------------------------
+# @ebuild-function java-pkg_ensure-no-bundled-jars
+#
+# Try to locate bundled jar files in ${WORKDIR} and die if found.
+# This function should be called after WORKDIR has been populated with symlink
+# to system jar files or bundled jars removed.
+# ------------------------------------------------------------------------------
 java-pkg_ensure-no-bundled-jars() {
 	debug-print-function ${FUNCNAME} $*
-	pushd ${WORKDIR} >/dev/null 2>/dev/null
 
-	local bundled_jars=$(find . -name "*.jar" -type f)
+	local bundled_jars=$(java-pkg_find-normal-jars)
 	if [[ -n ${bundled_jars} ]]; then
 		echo "Bundled jars found:"
 		local jar
@@ -1025,9 +1048,7 @@
 			echo $(pwd)${jar/./}
 		done
 		die "Bundled jars found!"
-
 	fi
-	popd >/dev/null 2>/dev/null
 }
 
 # ------------------------------------------------------------------------------
Index: java-pkg-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v
retrieving revision 1.8
diff -u -r1.8 java-pkg-2.eclass
--- java-pkg-2.eclass	18 Dec 2006 10:18:56 -0000	1.8
+++ java-pkg-2.eclass	9 Jan 2007 16:12:19 -0000
@@ -84,6 +84,10 @@
 }
 
 pre_src_compile() {
+	if is-java-strict; then
+		echo "Searching for bundled jars:"
+		java-pkg_find-normal-jars || echo "None found."
+	fi
 	java-pkg-2_pkg_setup
 }
 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

      reply	other threads:[~2007-01-09 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02 16:13 [gentoo-java] Running java-pkg_ensure-no-bundled-jars automatically with JAVA_PKG_STRICT Petteri Räty
2007-01-03  1:53 ` Joshua Nichols
2007-01-06 13:09   ` Petteri Räty
2007-01-09 16:13     ` Petteri Räty [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45A3BF44.4000401@gentoo.org \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-java@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox