Implement experimental dependency checking

This commit is contained in:
Mikolaj Izdebski 2012-06-11 21:10:55 +02:00 committed by Stanislav Ochotnicky
parent ebf5130c1b
commit d1265ccd6f
2 changed files with 27 additions and 4 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/bash
if [ -f /usr/share/java-utils/java-functions ] ; then
. /usr/share/java-utils/java-functions
set_jvm
@ -32,6 +33,9 @@ function help()
# add maven.repo.local if it's not defined already
local_add="-Dmaven.repo.local=$(pwd)/.m2/"
log_file="$(umask 2 && mktemp -t mvn-rpmbuild.$$.XXXXXXXXXX)"
logfile_add="-Dmaven.resolver.logfile=$log_file"
function process_args()
{
while [ $# != 0 ]; do
@ -62,6 +66,21 @@ echo $JAVA_HOME
export JAVA_HOME
# can't put it on command line due to
# http://jira.codehaus.org/browse/SUREFIRE-121
export MAVEN_OPTS="$MAVEN_OPTS -Dmaven.local.mode ${local_add}"
export MAVEN_OPTS="$MAVEN_OPTS -Dmaven.local.mode ${local_add} ${logfile_add}"
$M2_HOME/bin/mvn -o "$@"
$M2_HOME/bin/mvn -o "$@" || exit $?
sanitize() {
for obj in $1; do
echo -n 'mvn-rpmbuild: possibly redundant dependency: '
rpm -qf "$(readlink -f $obj)" | sed 's/-[^-]*-[^-]*$//'
done | sort -u
}
installed=$(sanitize "$(rpm -ql `package-cleanup --all --leaves | xargs` | egrep '\.(jar|pom)$')")
used=$(sanitize "$(cat $log_file 2>/dev/null)")
diff - /dev/fd/3 <<<"$installed" 3<<<"$used" | grep '^< ' | sed s/..//
:

View File

@ -2,7 +2,7 @@
Name: maven
Version: 3.0.4
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Java project management and project comprehension tool
Group: Development/Tools
@ -97,6 +97,7 @@ Requires: sisu >= 2.1.1-2
Requires: sonatype-oss-parent
Requires: xbean
Requires: xerces-j2
Requires: yum-utils
# for noarch->arch change
@ -359,6 +360,9 @@ ln -sf `rpm --eval '%%{_jnidir}'` %{_datadir}/%{name}/repository-jni/JPP
%changelog
* Mon Jun 11 2012 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.0.4-7
- Implement redundant dependency checks
* Thu May 24 2012 Krzysztof Daniel <kdaniel@redhat.com> 3.0.4-6
- Bug 824789 -Use the version if it is possible.