SOURCES: find-java-req.sh - skip symlinks and inexistent files - s...

glen glen at pld-linux.org
Tue Apr 10 20:34:18 CEST 2007


Author: glen                         Date: Tue Apr 10 18:34:18 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- skip symlinks and inexistent files
- scan only files
- allow multiple class version in one run

---- Files affected:
SOURCES:
   find-java-req.sh (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/find-java-req.sh
diff -u SOURCES/find-java-req.sh:1.1 SOURCES/find-java-req.sh:1.2
--- SOURCES/find-java-req.sh:1.1	Wed Apr  4 12:44:58 2007
+++ SOURCES/find-java-req.sh	Tue Apr 10 20:34:13 2007
@@ -8,7 +8,7 @@
 javadeps_args='--requires --rpmformat --keywords'
 
 IGNORE_DEPS="@"
-BUILDROOT="/" 
+BUILDROOT="/"
 
 # Loop over all args
 while :; do
@@ -53,18 +53,23 @@
 javaclassversion() {
 	local file="$1"
 
+	# check only files, symlinks could point outside buildroot
+	[ ! -f "$file" -o -L "$file" ] || return
+
 	tmp=$(mktemp -d)
 	unzip -q -d $tmp $file >&2
-	classver=$(find $tmp -name '*.class' | xargs file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u)
+	classver=$(find $tmp -type f -name '*.class' | xargs -r -d'\n' file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u)
 	rm -rf $tmp
 	[ "$classver" ] || return
-	echo "java(ClassDataVersion) >= $classver"
+	for v in $classver; do
+		echo "java(ClassDataVersion) >= $v"
+	done
 }
 
 for file in $(cat -); do
-	case $file in 
+	case $file in
 	*.jar)
-		javaclassversion $file
+		javaclassversion "$file"
 	;;
 	esac
 done | sort -u | egrep -v \'$IGNORE_DEPS\'
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/find-java-req.sh?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list