]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- find maximum class version used in jars
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 4 Apr 2007 10:44:58 +0000 (10:44 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    find-java-req.sh -> 1.1

find-java-req.sh [new file with mode: 0755]

diff --git a/find-java-req.sh b/find-java-req.sh
new file mode 100755 (executable)
index 0000000..7cdecf3
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+# This script reads filenames from STDIN and outputs any relevant provides
+# information that needs to be included in the package.
+
+export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
+PATH=${PATH}:$(dirname $0)
+
+javadeps_args='--requires --rpmformat --keywords'
+
+IGNORE_DEPS="@"
+BUILDROOT="/" 
+
+# Loop over all args
+while :; do
+# Break out if there are no more args
+       case $# in
+       0)
+               break
+               ;;
+       esac
+
+# Get the first arg, and shuffle
+       option=$1
+       shift
+
+# Make all options have two hyphens
+       orig_option=$option     # Save original for error messages
+       case $option in
+       --*) ;;
+       -*) option=-$option ;;
+       esac
+
+       case $option in
+       --buildroot)
+               BUILDROOT=$1
+               shift
+               ;;
+       --ignore_deps)
+               IGNORE_DEPS=$1
+               shift
+               ;;
+       --help)
+               echo $usage
+               exit 0
+               ;;
+       *)
+               echo "$0: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
+               exit 1
+               ;;
+       esac
+done
+
+javaclassversion() {
+       local file="$1"
+
+       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)
+       rm -rf $tmp
+       [ "$classver" ] || return
+       echo "java(ClassDataVersion) >= $classver"
+}
+
+for file in $(cat -); do
+       case $file in 
+       *.jar)
+               javaclassversion $file
+       ;;
+       esac
+done | sort -u | egrep -v \'$IGNORE_DEPS\'
This page took 0.033454 seconds and 4 git commands to generate.