public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-java] RFC: solving jdk-1.6 compatibility with bootclasspath
@ 2009-11-08  0:19 Vlastimil Babka
  2009-11-08  9:22 ` Petteri Räty
  0 siblings, 1 reply; 3+ messages in thread
From: Vlastimil Babka @ 2009-11-08  0:19 UTC (permalink / raw
  To: Gentoo Java

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

Hi,

as you might know, we're getting rid of 1.4 jdk soonish (now it's up to 
the arch teams). While it's quite late removal, we can be much faster 
with 1.5 removal, since 1.5 got EOLed this week and the next bunch of 
security bugs won't be fixed there.

The list of packages that need to be fixed isn't that large, and most 
just can't compile due to the JDBC API changes. Adding those missing 
methods can be quite messy and large patches, so instead I've tested the 
idea of keeping just the classes from a 1.5 jdk in a special package, 
and using it as bootclasspath to build the problematic packages against.
In the end, it's about 10 packages that need it and it seems to work.

Here's what's required:
1) the attached function that should be added to java-ant-2.eclass. 
Nothing fancy, just rewrites the build.xml with bootclasspath provided 
by the package below.
2) A package with the bootclasspath. For now, I assume it would be 
called dev-java/sun-bootclasspath of version 1.5 and just extract rt.jar 
and jsse.jar from the jdk distfile, and install it under 
/opt/sun-bootclasspath-1.5/ . Beetter ideas for naming/path welcome
3) Packages that need it, will depend on >=virtual/jdk-1.5 and the 
sun-bootclasspath-1.5 and call the eclass function in the java_prepare 
phase. Since it's just 10 packages, I don't think any fancy automagic 
variables are needed to pollute the eclasses even more. The revbumps are 
sitting on my drive, can be commited after the eclass and package.

If it looks sane, I can commit it.

The 1.5 removal is tracked on https://bugs.gentoo.org/show_bug.cgi?id=292001
Besides the packages solved by this way, there are packages with java6 
flag to be removed (and made mandatory), some that restrict jdk to 1.5 
only for tests (can be test-restricted at worst) and few need more 
special treatment...

Vlastimil

[-- Attachment #2: bootclasspath.txt --]
[-- Type: text/plain, Size: 1060 bytes --]

# ------------------------------------------------------------------------------
# @public java-ant_rewrite-bootclasspath
#
# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
# bootclasspath package of given version.
#
# Affected by:
#       JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
#
# @param $1 - the version of bootclasspath (e.g. 1.5)
# @param $2 - path to desired build.xml file, defaults to 'build.xml'
# @param $3 - (optional) what to prepend the bootclasspath with (to override)
# ------------------------------------------------------------------------------

java-ant_rewrite-bootclasspath() {
        local version="${1}"
        local file="${2-build.xml}"
        local extra="${3}"

        local bcp="/opt/sun-bootclasspath-${version}/rt.jar:/opt/sun-bootclasspath-${version}/jsse.jar"
        if [[ -n "${extra}" ]]; then
                bcp="${extra}:${bcp}"
        fi

        java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
                -a bootclasspath -v "${bcp}"
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-java] RFC: solving jdk-1.6 compatibility with bootclasspath
  2009-11-08  0:19 [gentoo-java] RFC: solving jdk-1.6 compatibility with bootclasspath Vlastimil Babka
@ 2009-11-08  9:22 ` Petteri Räty
  2009-11-08 20:22   ` Vlastimil Babka
  0 siblings, 1 reply; 3+ messages in thread
From: Petteri Räty @ 2009-11-08  9:22 UTC (permalink / raw
  To: Gentoo Java

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

Vlastimil Babka wrote:
> 
> If it looks sane, I can commit it.
> 

Maybe register the jars for sun-bootclasspath and use java-pkg_getjars
--build-only? Users might find java-config -p sun-bootclasspath useful
for their own purposes.

Regards,
Petteri


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-java] RFC: solving jdk-1.6 compatibility with bootclasspath
  2009-11-08  9:22 ` Petteri Räty
@ 2009-11-08 20:22   ` Vlastimil Babka
  0 siblings, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2009-11-08 20:22 UTC (permalink / raw
  To: gentoo-java

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

Petteri Räty wrote:
> Vlastimil Babka wrote:
>> If it looks sane, I can commit it.
>>
> 
> Maybe register the jars for sun-bootclasspath and use java-pkg_getjars
> --build-only? Users might find java-config -p sun-bootclasspath useful
> for their own purposes.

Too bad, I've read the dlj licence and it seems packaging just rt.jar 
would violate it. So I've tried using gnu-classpath instead and seems to 
work for everything except two packages (which I've solved differently).

The attached eclass patch thus uses gnu-classpath. I've also added a 
JAVA_PKG_WANT_BOOTCLASSPATH variable to pull the needed dep.
gnu-classpath will just need a revbump to register the classes to 
package.env

> Regards,
> Petteri
> 


[-- Attachment #2: bootclasspath.patch --]
[-- Type: text/plain, Size: 3175 bytes --]

? ejavac.patch
Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.45
diff -u -B -r1.45 java-ant-2.eclass
--- java-ant-2.eclass	15 Feb 2009 01:24:59 -0000	1.45
+++ java-ant-2.eclass	8 Nov 2009 20:18:50 -0000
@@ -451,3 +451,49 @@
 		die "xml-rewrite not found"
 	fi
 }
+
+# ------------------------------------------------------------------------------
+# @public java-ant_rewrite-bootclasspath
+#
+# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
+# bootclasspath package of given version.
+#
+# Affected by:
+#	JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
+#
+# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
+#             of the current JDK
+# @param $2 - path to desired build.xml file, defaults to 'build.xml'
+# @param $3 - (optional) what to prepend the bootclasspath with (to override)
+# @param $4 - (optional) what to append to the bootclasspath
+# ------------------------------------------------------------------------------
+
+java-ant_rewrite-bootclasspath() {
+	local version="${1}"
+	local file="${2-build.xml}"
+	local extra_before="${3}"
+	local extra_after="${4}"
+
+	local bcp
+	case "${version}" in 
+		auto)
+			bcp="$(java-config -g BOOTCLASSPATH)"
+			;;
+		1.5)
+			bcp="$(java-pkg_getjars --build-only gnu-classpath-0.98)"
+			;;
+		*)
+			eerror "unknown parameter of java-ant_rewrite-bootclasspath"
+			die "unknown parameter of java-ant_rewrite-bootclasspath"
+			;;
+	esac
+	if [[ -n "${extra_before}" ]]; then
+		bcp="${extra_before}:${bcp}"
+	fi
+	if [[ -n "${extra_after}" ]]; then
+		bcp="${bcp}:${extra_after}"
+	fi
+
+	java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
+		-a bootclasspath -v "${bcp}"
+}
Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.129
diff -u -B -r1.129 java-utils-2.eclass
--- java-utils-2.eclass	7 Jun 2009 08:22:42 -0000	1.129
+++ java-utils-2.eclass	8 Nov 2009 20:18:51 -0000
@@ -76,6 +76,22 @@
 hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
 
 # -----------------------------------------------------------------------------
+# @variable-preinherit JAVA_PKG_WANT_BOOTCLASSPATH
+#
+# The version of bootclasspath the package needs to work. Translates to a proper
+# dependency. The bootclasspath has to be obtained by java-ant_rewrite-bootclasspath
+# -----------------------------------------------------------------------------
+
+if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then
+	if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then
+		JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} >=dev-java/gnu-classpath-0.98-r1:0.98"
+	else
+		eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
+		die "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
+	fi
+fi
+
+# -----------------------------------------------------------------------------
 # @variable-external JAVA_PKG_ALLOW_VM_CHANGE
 # @variable-default yes
 #

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-08 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-08  0:19 [gentoo-java] RFC: solving jdk-1.6 compatibility with bootclasspath Vlastimil Babka
2009-11-08  9:22 ` Petteri Räty
2009-11-08 20:22   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox