1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/coreconf/release.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,112 @@ 1.4 +#! /usr/local/bin/perl 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 + 1.11 +require('coreconf.pl'); 1.12 + 1.13 +#######-- read in variables on command line into %var 1.14 + 1.15 +$use_jar = 1; 1.16 +$ZIP = "$ENV{JAVA_HOME}/bin/jar"; 1.17 + 1.18 +if ( $ENV{JAVA_HOME} eq "" ) { 1.19 + $ZIP = "zip"; 1.20 + $use_jar = 0; 1.21 +} 1.22 + 1.23 + 1.24 +&parse_argv; 1.25 + 1.26 + 1.27 +######-- Do the packaging of jars. 1.28 + 1.29 +foreach $jarfile (split(/ /,$var{FILES}) ) { 1.30 + print STDERR "---------------------------------------------\n"; 1.31 + print STDERR "Packaging jar file $jarfile....\n"; 1.32 + 1.33 + $jarinfo = $var{$jarfile}; 1.34 + 1.35 + ($jardir,$jaropts) = split(/\|/,$jarinfo); 1.36 + 1.37 + if ( $use_jar ) { 1.38 + $zipoptions = "-cvf"; 1.39 + } else { 1.40 + $zipoptions = "-T -r"; 1.41 + if ($jaropts =~ /a/) { 1.42 + if ($var{OS_ARCH} eq 'WINNT') { 1.43 + $zipoptions .= ' -ll'; 1.44 + } 1.45 + } 1.46 + } 1.47 + 1.48 +# just in case the directory ends in a /, remove it 1.49 + if ($jardir =~ /\/$/) { 1.50 + chop $jardir; 1.51 + } 1.52 + 1.53 + $dirdepth --; 1.54 + 1.55 + print STDERR "jardir = $jardir\n"; 1.56 + system("ls $jardir"); 1.57 + 1.58 + if (-d $jardir) { 1.59 + 1.60 + 1.61 +# count the number of slashes 1.62 + 1.63 + $slashes =0; 1.64 + 1.65 + foreach $i (split(//,$jardir)) { 1.66 + if ($i =~ /\//) { 1.67 + $slashes++; 1.68 + } 1.69 + } 1.70 + 1.71 + $dotdots =0; 1.72 + 1.73 + foreach $i (split(m|/|,$jardir)) { 1.74 + if ($i eq '..') { 1.75 + $dotdots ++; 1.76 + } 1.77 + } 1.78 + 1.79 + $dirdepth = ($slashes +1) - (2*$dotdots); 1.80 + 1.81 + print STDERR "changing dir $jardir\n"; 1.82 + chdir($jardir); 1.83 + print STDERR "making dir META-INF\n"; 1.84 + mkdir("META-INF",0755); 1.85 + 1.86 + $filelist = ""; 1.87 + opendir(DIR,"."); 1.88 + while ($_ = readdir(DIR)) { 1.89 + if (! ( ($_ eq '.') || ($_ eq '..'))) { 1.90 + if ( $jaropts =~ /i/) { 1.91 + if (! /^include$/) { 1.92 + $filelist .= "$_ "; 1.93 + } 1.94 + } 1.95 + else { 1.96 + $filelist .= "$_ "; 1.97 + } 1.98 + } 1.99 + } 1.100 + closedir(DIR); 1.101 + 1.102 + print STDERR "$ZIP $zipoptions $jarfile $filelist\n"; 1.103 + system("$ZIP $zipoptions $jarfile $filelist"); 1.104 + rmdir("META-INF"); 1.105 + for $i (1 .. $dirdepth) { 1.106 + chdir(".."); 1.107 + print STDERR "chdir ..\n"; 1.108 + } 1.109 + } 1.110 + else { 1.111 + print STDERR "Directory $jardir doesn't exist\n"; 1.112 + } 1.113 + 1.114 +} 1.115 +