diff --git a/mozilla/security/jss/build_java.pl b/mozilla/security/jss/build_java.pl index 7d852b34641..dc86df8050b 100644 --- a/mozilla/security/jss/build_java.pl +++ b/mozilla/security/jss/build_java.pl @@ -159,6 +159,23 @@ sub build { copy($debug_source_file, $debug_target_file) or die "Copying file: $!"; } + # + # generate manifest.mf file in lib dir + # + my $manifest_file = "MANIFEST.MF"; + my $jss_revision = `grep JSS_VERSION org/mozilla/jss/util/jssver.h`; + chop($jss_revision); + $jss_revision = substr($jss_revision, 22, 3); + my $build_revision = $jss_revision; + system("echo \"Manifest-Version: 1.0\" > $manifest_file"); + system("echo \"\" >> $manifest_file"); + system("echo \"Name: org/mozilla/jss/\" >> $manifest_file"); + system("echo \"Specification-Title: Network Security Services for Java (JSS)\" >> $manifest_file"); + system("echo \"Specification-Version: $jss_revision\" >> $manifest_file"); + system("echo \"Specification-Vendor: Mozilla Foundation\" >> $manifest_file"); + system("echo \"Implementation-Title: org.mozilla.jss\" >> $manifest_file"); + system("echo \"Implementation-Version: $build_revision\" >> $manifest_file"); + system("echo \"Implementation-Vendor: Mozilla Foundation\" >> $manifest_file"); # # recursively find *.java @@ -195,7 +212,8 @@ sub build { ensure_dir_exists($class_dir); print_do("$javac $javac_opt_flag -sourcepath . -d $class_dir " . "$classpath " . join(" ",@source_list)); - print_do("sh -c 'pwd && cd $class_dir && pwd && rm -f $class_jar && pwd && ls -al && ls -al ../../dist && zip -r $class_jar *'"); + print_do("sh -c 'pwd && cd $class_dir && pwd && rm -f $class_jar && pwd && ls -al && ls -al ../../dist && jar -cvmf ../../security/jss/$manifest_file $class_jar *'"); + print_do("rm -f $manifest_file"); print "Exit status was " . ($?>>8) . "\n"; } diff --git a/mozilla/security/jss/org/mozilla/jss/tests/JSSPackageTest.java b/mozilla/security/jss/org/mozilla/jss/tests/JSSPackageTest.java new file mode 100644 index 00000000000..fc6078a95ba --- /dev/null +++ b/mozilla/security/jss/org/mozilla/jss/tests/JSSPackageTest.java @@ -0,0 +1,88 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Netscape Security Services for Java. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +package org.mozilla.jss.tests; + +import org.mozilla.jss.ssl.*; +import org.mozilla.jss.CryptoManager; +import org.mozilla.jss.crypto.*; +import org.mozilla.jss.asn1.*; +import org.mozilla.jss.pkix.primitive.*; +import org.mozilla.jss.pkix.cert.*; +import org.mozilla.jss.pkix.cert.Certificate; +import org.mozilla.jss.util.PasswordCallback; + +public class JSSPackageTest { + + private static CryptoManager cm = null; + + public static void main(String[] args) { + try { + try { + CryptoManager.initialize("."); + } catch (Exception e) { } + + Package pkg = Package.getPackage("org.mozilla.jss"); + + System.out.println("\n---------------------------------------------------------"); + System.out.println("Checking jss jar and library version"); + System.out.println("---------------------------------------------------------"); + System.out.println(" Introspecting jss jar file"); + System.out.println("Package name:\t" + pkg.getName()); + + System.out.println("Spec title :\t" + pkg.getSpecificationTitle()); + System.out.println("Spec vendor :\t" + pkg.getSpecificationVendor()); + System.out.println("Spec version:\t" + pkg.getSpecificationVersion()); + + System.out.println("Impl title :\t" + pkg.getImplementationTitle()); + System.out.println("Impl vendor :\t" + pkg.getImplementationVendor()); + System.out.println("Impl version:\t" + pkg.getImplementationVersion()); + + System.out.println("\n Fetching version information from CryptoManager"); + System.out.println(CryptoManager.JAR_JSS_VERSION); + System.out.println(CryptoManager.JAR_NSS_VERSION); + System.out.println(CryptoManager.JAR_NSPR_VERSION); + + System.out.println("\n Checking for header information in jss library"); + System.exit(0); + + } catch (Exception e) { + System.out.println("Exception caught : " + e.getMessage()); + e.printStackTrace(); + System.exit(1); + } + } +} diff --git a/mozilla/security/jss/org/mozilla/jss/tests/all.pl b/mozilla/security/jss/org/mozilla/jss/tests/all.pl index faacbaacff1..c83f1f559da 100644 --- a/mozilla/security/jss/org/mozilla/jss/tests/all.pl +++ b/mozilla/security/jss/org/mozilla/jss/tests/all.pl @@ -53,6 +53,8 @@ my $dist_dir; my $pathsep = ":"; my $scriptext = "sh"; my $exe_suffix = ""; +my $lib_suffix = ".so"; +my $lib_jss = "libjss"; my $jss_rel_dir = ""; my $jss_classpath = ""; @@ -70,6 +72,8 @@ sub setup_vars { $truncate_lib_path = 0; $pathsep = ";"; $exe_suffix = ".exe"; + $lib_suffix = ".dll"; + $lib_jss = "jss"; } else { $ld_lib_path = "LD_LIBRARY_PATH"; $scriptext = "sh"; @@ -270,3 +274,21 @@ $result = system("$java org.mozilla.jss.tests.JSSE_SSLClient"); $result >>=8; $result and die "JSSE client returned $result"; +# +# Test for JSS jar and library revision +# +print STDERR "============= Check JSS jar version\n"; +$result = system("$java org.mozilla.jss.tests.JSSPackageTest"); +$result >>=8; +my $LIB = "$lib_jss"."4"."$lib_suffix"; +my $strings_exist = `which strings`; +chop($strings_exist); +if ($strings_exist ne "") { + my $jsslibver = `strings $nss_lib_dir/$LIB | grep Header`; + chop($jsslibver); + print "$LIB = $jsslibver\n"; +} else { + print "Could not fetch Header information from $LIB\n"; +} +$result and die "JSS jar package information test $result"; +