From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1HA1uL-0004fc-0j for garchives@archives.gentoo.org; Thu, 25 Jan 2007 10:32:41 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.8) with SMTP id l0PAVo0J019686; Thu, 25 Jan 2007 10:31:50 GMT Received: from slimak.dkm.cz (smtp.dkm.cz [62.24.64.34]) by robin.gentoo.org (8.13.8/8.13.8) with SMTP id l0PAVloU019597 for ; Thu, 25 Jan 2007 10:31:47 GMT Received: (qmail 60235 invoked by uid 0); 25 Jan 2007 10:31:45 -0000 Received: from r141.net.upc.cz (HELO ?192.168.1.1?) (62.24.83.141) by smtp.dkm.cz with SMTP; 25 Jan 2007 10:31:45 -0000 Message-ID: <45B88710.2080405@gentoo.org> Date: Thu, 25 Jan 2007 11:31:44 +0100 From: Vlastimil Babka User-Agent: Thunderbird 2.0b2 (X11/20070122) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-java@gentoo.org MIME-Version: 1.0 To: gentoo-java@lists.gentoo.org Subject: [gentoo-java] new proposed enhancement to java-pkg_jarfrom() X-Enigmail-Version: 0.94.2.0 OpenPGP: id=4E61DE84; url=subkeys.pgp.net Content-Type: multipart/mixed; boundary="------------050703080903020002090506" X-Archives-Salt: 58611bbd-b1da-47f7-9326-1f3d4850bf41 X-Archives-Hash: a6ee1b092523a82367a45f5bc9bf3637 This is a multi-part message in MIME format. --------------050703080903020002090506 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Attached a patch, will commit if no-one objects. Originally I just wanted to fix a bug that in src_test() it would shift parameters (i.e. name of package) if the first parameter wasn't - --build-only. Encountered this while improving commons-cli ebuild. Then I decided to improve a bit more: Fixes a theoretical situation where --build-only and --with-dependencies would be both specified, but in the wrong order. Now there's a general loop for resolving --* parameters. Adds a new parameter: '--into $dir' which will symlink the jars into the $dir instead of '.' Consider this difference (again, commons-cli): before the change: src_test() { cd lib java-pkg_jar-from junit cd .. eant test } after the change: src_test() { java-pkg_jar-from --into lib junit eant test } The directory must exist, but maybe it could be improved even more to mkdir it if it doesn't? BTW, I think deferring the test-specific jar-from/getjars calls until src_test() is good idea, because you don't need to prefix them with "use test &&", specify "--build-only" and you don't need to test package twice (without and with test) to ensure those deps are really needed only for testing. - -- Vlastimil Babka (Caster) Gentoo/Java -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFuIcPtbrAj05h3oQRAlFAAKCcqFsMsQzy77Do8pQfzoi9Kbws0QCeIEKV wwMC9H8jBvysTsObWpGg8V0= =WMKt -----END PGP SIGNATURE----- --------------050703080903020002090506 Content-Type: text/x-patch; name="java-utils-2.eclass.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="java-utils-2.eclass.patch" Index: java-utils-2.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v retrieving revision 1.48 diff -u -B -r1.48 java-utils-2.eclass --- java-utils-2.eclass 21 Jan 2007 21:12:52 -0000 1.48 +++ java-utils-2.eclass 25 Jan 2007 10:22:19 -0000 @@ -759,8 +759,12 @@ # Example: get junit.jar which is needed only for building # java-pkg_jar-from --build-only junit junit.jar # -# @param $1 - (optional) "--build-only" makes the jar(s) not added into -# package.env DEPEND line. +# @param $opt +# --build-only - makes the jar(s) not added into package.env DEPEND line. +# (assumed automatically when called inside src_test) +# --with-dependencies - get jars also from requested package's dependencies +# transitively. +# --into $dir - symlink jar(s) into $dir (must exist) instead of . # @param $1 - Package to get jars from. # @param $2 - jar from package. If not specified, all jars will be used. # @param $3 - When a single jar is specified, destination filename of the @@ -771,16 +775,24 @@ debug-print-function ${FUNCNAME} $* local build_only="" + local destdir="." + local deep="" + + [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true" - if [[ "${1}" = "--build-only" || "${EBUILD_PHASE}" == "test" ]]; then - build_only="true" - shift - fi - - if [[ "${1}" = "--with-dependencies" ]]; then - local deep="--with-dependencies" + while [[ "${1}" == --* ]]; do + if [[ "${1}" = "--build-only" ]]; then + build_only="true" + elif [[ "${1}" = "--with-dependencies" ]]; then + deep="--with-dependencies" + elif [[ "${1}" = "--into" ]]; then + destdir="${2}" + shift + else + die "java-pkg_jar-from called with unknown parameter: ${1}" + fi shift - fi + done local target_pkg="${1}" target_jar="${2}" destjar="${3}" @@ -794,6 +806,8 @@ classpath="$(java-config ${deep} --classpath=${target_pkg})" [[ $? != 0 ]] && die ${error_msg} + pushd ${destdir} > /dev/null \ + || die "failed to change directory to ${destdir}" local jar for jar in ${classpath//:/ }; do local jar_name=$(basename "${jar}") @@ -816,6 +830,7 @@ return 0 fi done + popd > /dev/null # if no target was specified, we're ok if [[ -z "${target_jar}" ]] ; then return 0 --------------050703080903020002090506-- -- gentoo-java@gentoo.org mailing list