]> git.pld-linux.org Git - packages/rpm.git/blob - find-java-req.sh
- updated for 4.4.8
[packages/rpm.git] / find-java-req.sh
1 #!/bin/sh
2 # This script reads filenames from STDIN and outputs any relevant provides
3 # information that needs to be included in the package.
4
5 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
6 PATH=${PATH}:$(dirname $0)
7
8 javadeps_args='--requires --rpmformat --keywords'
9
10 IGNORE_DEPS="@"
11 BUILDROOT="/" 
12
13 # Loop over all args
14 while :; do
15 # Break out if there are no more args
16         case $# in
17         0)
18                 break
19                 ;;
20         esac
21
22 # Get the first arg, and shuffle
23         option=$1
24         shift
25
26 # Make all options have two hyphens
27         orig_option=$option     # Save original for error messages
28         case $option in
29         --*) ;;
30         -*) option=-$option ;;
31         esac
32
33         case $option in
34         --buildroot)
35                 BUILDROOT=$1
36                 shift
37                 ;;
38         --ignore_deps)
39                 IGNORE_DEPS=$1
40                 shift
41                 ;;
42         --help)
43                 echo $usage
44                 exit 0
45                 ;;
46         *)
47                 echo "$0: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
48                 exit 1
49                 ;;
50         esac
51 done
52
53 javaclassversion() {
54         local file="$1"
55
56         tmp=$(mktemp -d)
57         unzip -q -d $tmp $file >&2
58         classver=$(find $tmp -name '*.class' | xargs file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u)
59         rm -rf $tmp
60         [ "$classver" ] || return
61         echo "java(ClassDataVersion) >= $classver"
62 }
63
64 for file in $(cat -); do
65         case $file in 
66         *.jar)
67                 javaclassversion $file
68         ;;
69         esac
70 done | sort -u | egrep -v \'$IGNORE_DEPS\'
This page took 0.026456 seconds and 3 git commands to generate.