SOURCES: rpm-java-requires (NEW) - Th version, based on find-java-...
qboosh
qboosh at pld-linux.org
Tue May 22 21:59:35 CEST 2007
Author: qboosh Date: Tue May 22 19:59:32 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- Th version, based on find-java-req.sh:AC-branch
---- Files affected:
SOURCES:
rpm-java-requires (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/rpm-java-requires
diff -u /dev/null SOURCES/rpm-java-requires:1.1
--- /dev/null Tue May 22 21:59:32 2007
+++ SOURCES/rpm-java-requires Tue May 22 21:59:27 2007
@@ -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 at 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
================================================================
More information about the pld-cvs-commit
mailing list