Improve output and comments for java-pkg_verify-classes().
authorVlastimil Babka <caster@gentoo.org>
Tue, 30 Jan 2007 14:12:34 +0000 (14:12 +0000)
committerVlastimil Babka <caster@gentoo.org>
Tue, 30 Jan 2007 14:12:34 +0000 (14:12 +0000)
eclass/java-utils-2.eclass

index 2bb6a17ba348218f9aec2c72a3504ff3d6c42d4f..e089580ddc852c81d9a5e1a25e387f46d370cd21 100644 (file)
@@ -6,7 +6,7 @@
 #
 # Licensed under the GNU General Public License, v2
 #
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.55 2007/01/30 12:50:25 betelgeuse Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.56 2007/01/30 14:12:34 caster Exp $
 
 
 # -----------------------------------------------------------------------------
@@ -2214,24 +2214,33 @@ java-pkg_jar-list() {
        fi
 }
 
-# TODO document
-# Verify that the classes were compiled for the right source / target
-# If $1 is present will check that file otherwise the ${D} directory
-# recursively.
+# ------------------------------------------------------------------------------
+# @internal-function java-pkg_verify-classes
+#
+# Verify that the classes were compiled for the right source / target. Dies if
+# not.
+# @param $1 (optional) - the file to check, otherwise checks whole ${D}
+# ------------------------------------------------------------------------------
 java-pkg_verify-classes() {
        #$(find ${D} -type f -name '*.jar' -o -name '*.class')
        local target=$(java-pkg_get-target)
-       ebegin "Verifying java class versions (target: ${target})"
+       local result
+       local log="${T}/class-version-verify.log"
        if [[ -n "${1}" ]]; then
-               class-version-verify.py -t ${target} "${1}"
+               class-version-verify.py -v -t ${target} "${1}" > "${log}"
+               result=$?
        else
-               class-version-verify.py -t ${target} -r "${D}"
+               ebegin "Verifying java class versions (target: ${target})"
+               class-version-verify.py -v -t ${target} -r "${D}" > "${log}"
+               result=$?
+               eend ${result}
        fi
-       result=$?
-       eend ${result}
+       [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
        if [[ ${result} != 0 ]]; then
-               ewarn "Possible problem"
-               die "Bad class files found"
+               eerror "Incorrect bytecode version found"
+               [[ -n "${1}" ]] && eerror "in file: ${1}"
+               eerror "See ${log} for more details."
+               die "Incorrect bytecode found"
        fi
 }