public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-java] Detection of useless dependencies
@ 2008-07-18 23:05 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2008-07-18 23:05 UTC (permalink / raw
  To: Gentoo Java


[-- Attachment #1.1: Type: text/plain, Size: 931 bytes --]

If you are using JAVA_PKG_STRICT and install dev-java/java-dep-check, 
you will start to see messages like the following:
 >>> Merging dev-java/xstream-1.2-r2 to /
  * Possibly unneeded dependencies found in package.env:
  *      commons-cli-1

This means that xstream is recording a dependency on commons-cli-1 to 
package.env but the class files installed by xstream don't reference any 
classes from commons-cli in the constant pool. For most packages this 
means that you just remove the usage from the ebuild but the tool will 
also give you false positives if the dependency is only needed at 
runtime and is loaded a provider framework for example. These false 
positives will eventually be hidden by mandating the use of 
java-pkg_register-dependency for these dependencies and then we can use 
the values given to that function to filter those out from the results 
of java-dep-check.

Regards,
Petteri

[-- Attachment #1.2: java-dep-check.patch --]
[-- Type: text/plain, Size: 1246 bytes --]

Index: java-pkg-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-pkg-2.eclass,v
retrieving revision 1.28
diff -u -r1.28 java-pkg-2.eclass
--- java-pkg-2.eclass	7 Jul 2008 16:54:56 -0000	1.28
+++ java-pkg-2.eclass	18 Jul 2008 22:13:44 -0000
@@ -49,7 +49,7 @@
 	SRC_URI="mirror://apache/${PN/-///}/source/${P}-src.tar.gz"
 fi
 
-EXPORT_FUNCTIONS pkg_setup src_compile
+EXPORT_FUNCTIONS pkg_setup src_compile pkg_preinst
 
 # ------------------------------------------------------------------------------
 # @eclass-pkg_setup
@@ -93,6 +93,23 @@
 	fi
 }
 
+
+java-pkg-2_pkg_preinst() {
+	if is-java-strict; then
+		if has_version dev-java/java-dep-check; then
+			local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
+			if [[ ${output} ]]; then
+				ewarn "Possibly unneeded dependencies found in package.env:"
+				for dep in ${output}; do
+					ewarn "\t${dep}"
+				done
+			fi
+		else
+			eerror "Install dev-java/java-dep-check for dependency checking"
+		fi
+	fi
+}
+
 # ------------------------------------------------------------------------------
 # @eclass-end
 # ------------------------------------------------------------------------------

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-18 23:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-18 23:05 [gentoo-java] Detection of useless dependencies Petteri Räty

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