Adding pkg_preinst to java-utils-2 for QA purposes

Petteri Räty <[email protected]>
Newsgroups gmane.linux.gentoo.java,gmane.linux.gentoo.devel
Message-ID <[email protected]>
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.

betelgeuse@pena /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

betelgeuse@pena /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
java-pkg_preinst.patch (text/plain, 1.8 KB)
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} "${@}"
+	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
 # ------------------------------------------------------------------------------
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHZIiJcxLzpIGCsLQRAqU0AJwO5FK3nv2SEWoQeVs5IlIOqdX/TwCfXw6v
kRCYhAVWjuBxXrIzUHiH/D0=
=oIQy
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.