]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- Th version, based on find-java-req.sh:AC-branch
authorJakub Bogusz <qboosh@pld-linux.org>
Tue, 22 May 2007 19:59:27 +0000 (19:59 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-java-requires -> 1.1

rpm-java-requires [new file with mode: 0644]

diff --git a/rpm-java-requires b/rpm-java-requires
new file mode 100644 (file)
index 0000000..40db41b
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+# This script reads filenames from STDIN and outputs any relevant requires
+# information that needs to be included in the package.
+#
+# Based on rpm-4.4.2/scripts/find-req.pl
+# Authors: Elan Ruusam√§e <glen@pld-linux.org>
+
+export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
+
+javaclassversion() {
+       [ $# -gt 0 ] || return
+
+       local ver
+       classver=$(echo "$@" | xargs -r file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u)
+       [ "$classver" ] || return
+       for v in $classver; do
+               echo "java(ClassDataVersion) >= $v"
+       done
+}
+
+javajarversion() {
+       local jar="$1"
+
+       # check only files, symlinks could point outside buildroot
+       [ -f "$jar" -a ! -L "$jar" ] || return
+
+#      echo >&2 "find java requires: ${jar#$RPM_BUILD_ROOT}"
+
+       tmp=$(mktemp -d)
+       unzip -q -d $tmp $jar >&2
+       javaclassversion $(find $tmp -type f -name '*.class')
+       rm -rf $tmp
+}
+
+FILES=$(cat -)
+
+find_requires() {
+       for file in $FILES; do
+               case $file in
+               *.jar)
+                       javajarversion "$file"
+               ;;
+               *.class)
+                       javaclassversion "$file"
+               ;;
+               esac
+       done
+}
+
+find_requires | sort -u
This page took 0.071396 seconds and 4 git commands to generate.