From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IcW07-0008Nw-BP for garchives@archives.gentoo.org; Tue, 02 Oct 2007 00:52:40 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id l920gx6f021423; Tue, 2 Oct 2007 00:42:59 GMT Received: from smtp12.ihug.co.nz (smtp12.ihug.co.nz [203.109.136.112]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id l920gvlW021415 for ; Tue, 2 Oct 2007 00:42:58 GMT Received: from cust.filter1.content.ihug.net.nz (smtp.mailfilter1.ihug.co.nz) [10.80.50.1] by smtp12.ihug.co.nz with esmtp (Exim 4.60 #1 (Debian); Ihug conf #192) id 1IcVqi-0004cv-M0; Tue, 02 Oct 2007 13:42:56 +1300 Ironport-Content-Filter: send-to-smtp Received: from 203-109-218-133.dsl.dyn.ihug.co.nz (HELO [10.1.1.3]) ([203.109.218.133]) by smtp.mailfilter1.ihug.co.nz with ESMTP; 02 Oct 2007 12:42:55 +1200 Message-ID: <470192EC.1020500@gentoo.org> Date: Tue, 02 Oct 2007 13:38:04 +1300 From: Alistair Bush User-Agent: Thunderbird 2.0.0.6 (X11/20070829) 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] Changes to java-util-2.eclass to support virtuals X-Enigmail-Version: 0.95.3 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0EB425C5B45D42CD354A7384" X-Archives-Salt: d61a7c8a-28f9-4693-a80b-3c68ba953fb7 X-Archives-Hash: c033de3d2cb67f1dccf927b46a70fbe5 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0EB425C5B45D42CD354A7384 Content-Type: multipart/mixed; boundary="------------010608060503000502070301" This is a multi-part message in MIME format. --------------010608060503000502070301 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Ok, so what is going on in this patch, simply :) both java-pkg_jar-from java-pkg_getjar get a new option --virtual when passed to these functions they will record the package as a whole (ie not the individual jars). The rational for this is that virtuals may provide/package functionality within multiple jars, we should therefore never depend on an individual jar from a virtual. A few more paths in java-pkg_init_paths A function java-pkg_do_virtuals_write() that is called _ONLY_ by the java-virtuals-2.eclass. It installs the virtuals "environment" file. Is everyone happy with the --virtual option, This could be conceivably used for 'normal' packages so maybe there is a better verb/noun/adjective/adverb/etc/etc/etc Alistair --------------010608060503000502070301 Content-Type: text/plain; name="java-utils-2.eclass.virtual-support" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="java-utils-2.eclass.virtual-support" --- cvs/gentoo-x86/eclass/java-utils-2.eclass 2007-09-28 18:26:27.0000000= 00 +1200 +++ overlays/java-virtuals/eclass/java-utils-2.eclass 2007-10-02 12:56:28= =2E000000000 +1300 @@ -840,6 +840,8 @@ # (assumed automatically when called inside src_test) # --with-dependencies - get jars also from requested package's dependenc= ies # transitively. +# --virtual - Packages passed to this function are to be handled as virt= uals +# and will not have individual jar dependencies recorded. # --into $dir - symlink jar(s) into $dir (must exist) instead of . # @param $1 - Package to get jars from, or comma-separated list of packa= ges in # case other parameters are not used. @@ -854,6 +856,7 @@ local build_only=3D"" local destdir=3D"." local deep=3D"" + local virtual=3D"" =20 [[ "${EBUILD_PHASE}" =3D=3D "test" ]] && build_only=3D"build" =20 @@ -862,6 +865,8 @@ build_only=3D"build" elif [[ "${1}" =3D "--with-dependencies" ]]; then deep=3D"--with-dependencies" + elif [[ "${1}" =3D "--virtual" ]]; then + virtual=3D"true" elif [[ "${1}" =3D "--into" ]]; then destdir=3D"${2}" shift @@ -897,6 +902,14 @@ java-pkg_ensure-dep "${build_only}" "${target_pkg}" fi =20 + # Record the entire virtual as a dependency so that + # no jars are missed. + if [[ -z "${build_only}" && -n "${virtual}" ]]; then + java-pkg_record-jar_ "${target_pkg}" + # setting this disables further record-jars_ calls later + build_only=3D"build" + fi + pushd ${destdir} > /dev/null \ || die "failed to change directory to ${destdir}" =20 @@ -1028,6 +1041,8 @@ # # @param $opt # --build-only - makes the jar not added into package.env DEPEND line. +# --virtual - Packages passed to this function are to be handled as virt= uals +# and will not have individual jar dependencies recorded. # @param $1 - package to use # @param $2 - jar to get # ----------------------------------------------------------------------= -------- @@ -1035,12 +1050,15 @@ debug-print-function ${FUNCNAME} $* =20 local build_only=3D"" + local virtual=3D"" =20 [[ "${EBUILD_PHASE}" =3D=3D "test" ]] && build_only=3D"build" =20 while [[ "${1}" =3D=3D --* ]]; do if [[ "${1}" =3D "--build-only" ]]; then build_only=3D"build" + elif [[ "${1}" =3D=3D --* ]]; then + virtual=3D"true" else die "java-pkg_jar-from called with unknown parameter: ${1}" fi @@ -1060,6 +1078,13 @@ =20 java-pkg_ensure-dep "${build_only}" "${pkg}" =20 + # Record the package(Virtual) as a dependency and then set build_only + # So that individual jars are not recorded. + if [[ -n "${virtual}" ]]; then + java-pkg_record-jar_ "${pkg}" + build_only=3D"true" + fi + for jar in ${classpath//:/ }; do if [[ ! -f "${jar}" ]] ; then die "Installation problem with jar ${jar} in ${pkg} - is it installed= ?" @@ -2054,6 +2079,9 @@ java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be sr= c_unpack" fi =20 + # Initializing the JAVA_PKG_VNEED var from DEPEND + java-pkg_parse-virtuals + java-pkg_init_paths_ java-pkg_switch-vm PATH=3D${JAVA_HOME}/bin:${PATH} @@ -2074,6 +2102,21 @@ unset ANT_OPTS } =20 +# ----------------------------------------------------------------------= ------- +# @function-internal java-pkg_parse-virtuals +# +# ----------------------------------------------------------------------= ------- + +java-pkg_parse-virtuals() { + debug-print-function ${FUNCNAME} $* + + for dep in ${DEPEND}; do + if [[ -n "$(grep java-virtuals/* <<< ${dep})" ]]; then + JAVA_PKG_VNEED=3D"${JAVA_PKG_VNEED} ${dep}" + fi=09 + done +} + # ----------------------------------------------------------------------= -------- # @function-internal java-pkg-init-compiler_ # @@ -2203,6 +2246,8 @@ JAVA_PKG_SHAREPATH=3D"${DESTTREE}/share/${JAVA_PKG_NAME}" JAVA_PKG_SOURCESPATH=3D"${JAVA_PKG_SHAREPATH}/sources/" JAVA_PKG_ENV=3D"${D}${JAVA_PKG_SHAREPATH}/package.env" + JAVA_PKG_VIRTUALS_PATH=3D"${DESTTREE}/share/java-config-2/virtuals" + JAVA_PKG_VIRTUAL_PROVIDER=3D"${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_= NAME}" =20 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST=3D"${JAVA_PKG_SHAREP= ATH}/lib" [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST=3D"${DESTTREE}/$(get= _libdir)/${JAVA_PKG_NAME}" @@ -2218,6 +2263,33 @@ } =20 # ----------------------------------------------------------------------= -------- +# @internal-function java-pkg_do_virtuals_write +# +# Writes the package.env out to disk. +# +# ----------------------------------------------------------------------= -------- +java-pkg_do_virtuals_write() { + java-pkg_init_paths_ + + dodir "${JAVA_PKG_VIRTUALS_PATH}" + if [[ -n "${JAVA_VIRTUAL_PROVIDES}" ]]; then + echo "PROVIDERS=3D\"${JAVA_VIRTUAL_PROVIDES}\"" \ + >> ${JAVA_PKG_VIRTUAL_PROVIDER} + fi + + if [[ -n "${JAVA_VIRTUAL_VM}" ]]; then + echo "VM=3D\"${JAVA_VIRTUAL_VM}\"" \ + >> ${JAVA_PKG_VIRTUAL_PROVIDER} + fi +=09 + if [[ -n "${JAVA_VIRTUAL_VM_CLASSPATH}" ]]; then + echo "VM_CLASSPATH=3D\"${JAVA_VIRTUAL_VM_CLASSPATH}\"" \ + >> ${JAVA_PKG_VIRTUAL_PROVIDER} + fi +} + + +# ----------------------------------------------------------------------= -------- # @internal-function java-pkg_do_write_ # # Writes the package.env out to disk. --------------010608060503000502070301-- --------------enig0EB425C5B45D42CD354A7384 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHAZLzj0U8B+iUlwsRAqy3AJ9F/ZUMkRHlXu4EE2c0UI67qkZ7rACfUkPp qoMIiL6VtU+Ymr4ZWhJ+CS0= =oelo -----END PGP SIGNATURE----- --------------enig0EB425C5B45D42CD354A7384-- -- gentoo-java@gentoo.org mailing list