I wrote a patch to add pkg_preinst to java-utils-2 to check the jars in
the images for problems in the jars but it can later be used for other
stuff too. If there are no objections we will need to modify the
following ebuilds as not to change their behavior. I will do this in
behalf of the maintainers in question so that all the changes go in at
the same time.

[EMAIL PROTECTED] /mnt/checkouts/java/scripts $ bash
find-function-usage-in-inheriting-ebuilds.sh --can-add --no-default
java-pkg-2 pkg_preinst
perl-module.eclass: dev-perl/Inline-Java/Inline-Java-0.50.ebuild
perl-module.eclass: dev-perl/Inline-Java/Inline-Java-0.51.ebuild
perl-module.eclass: dev-perl/Inline-Java/Inline-Java-0.52.ebuild

[EMAIL PROTECTED] /mnt/checkouts/java/scripts $ bash
find-function-usage-in-inheriting-ebuilds.sh --can-add --no-default
java-pkg-opt-2 pkg_preinst
perl-module.eclass: app-pda/pilot-link/pilot-link-0.12.2.ebuild
perl-module.eclass: dev-util/subversion/subversion-1.3.2-r3.ebuild
perl-module.eclass: dev-util/subversion/subversion-1.3.2-r4.ebuild

The script can be found in
https://overlays.gentoo.org/svn/proj/java/scripts/find-function-usage-in-inheriting-ebuilds.sh

Regards,
Petteri
Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.100
diff -u -r1.100 java-utils-2.eclass
--- java-utils-2.eclass 28 Nov 2007 02:03:48 -0000      1.100
+++ java-utils-2.eclass 16 Dec 2007 01:57:29 -0000
@@ -293,7 +295,6 @@
        java-pkg_do_write_
 }
 
-
 # 
------------------------------------------------------------------------------
 # @internal-function depend-java-query
 #
@@ -833,6 +830,30 @@
 }
 
 # 
------------------------------------------------------------------------------
+# @eclass-pkg_preinst
+#
+# Checks jars in the image for problems.
+#
+# 
------------------------------------------------------------------------------
+
+java-utils-2_pkg_preinst() {
+       debug-print-function ${FUNCNAME} "[EMAIL PROTECTED]"
+       is-java-strict || return
+
+       for jar in $(find "${D}" -name "*.jar"); do
+               for dep in $(unzip -p "${jar}" META-INF/MANIFEST.MF | egrep 
"^Class-Path:" | cut -d ":" -f 2); do
+                       local dir=$(dirname "${jar}")
+                       einfo "${dir}/${dep}" "${ROOT}${dir#${D}}/${dep}"
+                       if [[ ! -e "${dir}/${dep}" && ! -e 
"${ROOT}${dir#${D}}/${dep}" ]]; then
+                               eerror "${jar}"
+                               eerror "has Class-Path entry in Manifest 
pointing at ${dep}"
+                               eerror "but that file does not exist in image 
or ROOT=${ROOT}"
+                       fi
+               done
+       done
+}
+
+# 
------------------------------------------------------------------------------
 # @section-end install
 # 
------------------------------------------------------------------------------
 
@@ -2729,6 +2760,8 @@
        return $?
 }
 
+EXPORT_FUNCTIONS pkg_preinst
+
 # 
------------------------------------------------------------------------------
 # @eclass-end
 # 
------------------------------------------------------------------------------

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to