Debian Codegraph @

sigtest

raw
1 #!/bin/sh
2 #
3 # Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
4 #
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v. 2.0, which is available at
7 # http://www.eclipse.org/legal/epl-2.0.
8 #
9 # This Source Code may also be made available under the following Secondary
10 # Licenses when the conditions for such availability set forth in the
11 # Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12 # version 2 with the GNU Classpath Exception, which is available at
13 # https://www.gnu.org/software/classpath/license.html.
14 #
15 # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16 #
17
18 #
19 # Compare API against a signature file.
20 #
21 # Usage: sigtest jakarta.mail.jar mail.sig
22 #
23 SIGTEST=${SIGTEST:-/java/re/sigtest/4.0/promoted/fcs/latest/binaries/sigtest-4.0}
24 # The apicheck program isn't working correctly, use sigtest instead.
25 #APICHECK_JAR=$SIGTEST/lib/apicheck.jar
26 SIGTEST_JAR=$SIGTEST/lib/sigtestdev.jar
27 JAVA_HOME=${JAVA_HOME:-/opt/jdk1.8}
28 USAGE="sigtest [-b] [-p package] jakarta.mail.jar mail.sig"
29 PKG=jakarta.mail
30 BACKWARD=
31 PLATSIG=/tmp/$$.platform.sig
32
33 while getopts bp: opt
34 do
35 case $opt in
36 p) PKG="$OPTARG";;
37 b) BACKWARD=-backward;;
38 \?) echo $USAGE; exit 1;;
39 esac
40 done
41 shift `expr $OPTIND - 1`
42
43 JAR="$1"
44 SIG="$2"
45 shift 2
46
47 ver=$($JAVA_HOME/bin/java -version 2>&1 | sed -e 's/.*"\(.*\)".*/\1/;q')
48 case "$ver" in
49 1.[0-9]*) xjimage=;
50 cp="${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/jre/lib/jce.jar";;
51 *) xjimage="-xjimage ${JAVA_HOME}/bin/jimage";
52 cp="${JAVA_HOME}/lib/modules";;
53 esac
54
55 echo '*** Generate JDK signatures ***'
56 ${JAVA_HOME}/bin/java -jar $SIGTEST_JAR setup \
57 -classpath "$cp" $xjimage \
58 -filename "$PLATSIG" -package java -package javax -keepfile \
59 -verbose nowarn
60 echo
61 echo '*** Check Jakarta Mail signatures ***'
62 ${JAVA_HOME}/bin/java -jar $SIGTEST_JAR test -static \
63 -classpath "$PLATSIG:$JAR" \
64 -filename "$SIG" -package "$PKG" -out /dev/stdout \
65 -nomerge -checkvalue -mode src $BACKWARD "$@"
66
67 rm "$PLATSIG"