security/nss/coreconf/cpdist.pl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #! /usr/local/bin/perl
michael@0 2 #
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6 require('coreconf.pl');
michael@0 7
michael@0 8 #######-- read in variables on command line into %var
michael@0 9
michael@0 10 &parse_argv;
michael@0 11
michael@0 12 ### do the copy
michael@0 13
michael@0 14 print STDERR "RELEASE TREE / MODULE = $var{RELEASE_TREE} $var{MODULE}\n";
michael@0 15
michael@0 16
michael@0 17
michael@0 18 # 1
michael@0 19 if ($var{RELEASE} eq "") { exit; } # Can't do release here, so exit.
michael@0 20
michael@0 21 # 2
michael@0 22 #if (! ($var{RELEASE} =~ /\//)) { # if no specific version is specified in RELEASE variable
michael@0 23 # $component = $var{RELEASE};
michael@0 24 #}
michael@0 25 #else { # if a subcomponent/version is given in the RELEASE variable
michael@0 26 # $var{RELEASE} =~ m|^([^/]*)/|;
michael@0 27 # $component = $1; # everything before the first slash;
michael@0 28 # }
michael@0 29
michael@0 30 # 3
michael@0 31 $path = $var{RELEASE};
michael@0 32
michael@0 33
michael@0 34 # 4
michael@0 35 # find out what directory we would create for 'today'
michael@0 36
michael@0 37 $year = (localtime)[5] + 1900;
michael@0 38 $month = (localtime)[4] + 1;
michael@0 39 $day = (localtime)[3];
michael@0 40 $today = sprintf( "%d%02d%02d", $year, $month, $day );
michael@0 41
michael@0 42 # 5
michael@0 43 # if version is null, then set the version to today.
michael@0 44 if ($var{"RELEASE_VERSION"} eq "") {
michael@0 45 $var{"RELEASE_VERSION"} = $today;
michael@0 46 }
michael@0 47
michael@0 48 #6
michael@0 49 $version = $var{"RELEASE_VERSION"}; # set RELEASE_VERSION to passed in variable
michael@0 50
michael@0 51 #7
michael@0 52 # if version is today, then we will want to make a 'current' link.
michael@0 53
michael@0 54 if ($version eq $today) {
michael@0 55 $create_current = 1;
michael@0 56 }
michael@0 57
michael@0 58 #8
michael@0 59 # version can be a) passed in value from command line, b) value in manifest.mn
michael@0 60 # or c) computed value such as '19970909'
michael@0 61
michael@0 62
michael@0 63 $dir = "$var{'RELEASE_TREE'}/$path";
michael@0 64
michael@0 65 #9
michael@0 66 if (! (-e "$dir/$version" && -d "$dir/$version")) {
michael@0 67 print "making dir $dir \n";
michael@0 68 &rec_mkdir("$dir/$version");
michael@0 69 }
michael@0 70
michael@0 71
michael@0 72
michael@0 73 print "version = $version\n";
michael@0 74 print "path = $path\n";
michael@0 75 print "var{release_tree} = $var{'RELEASE_TREE'}\n";
michael@0 76 print "dir = $dir = RELEASE_TREE/path\n";
michael@0 77
michael@0 78
michael@0 79 #10
michael@0 80 if ($create_current == 1) {
michael@0 81
michael@0 82 # unlinking and linking always occurs, even if the link is correct
michael@0 83 print "unlinking $dir/current\n";
michael@0 84 unlink("$dir/current");
michael@0 85
michael@0 86 print "putting version number $today into 'current' file..";
michael@0 87
michael@0 88 open(FILE,">$dir/current") || die " couldn't open current\n";
michael@0 89 print FILE "$today\n";
michael@0 90 close(FILE);
michael@0 91 print " ..done\n"
michael@0 92
michael@0 93 }
michael@0 94
michael@0 95 &rec_mkdir("$dir/$version/$var{'RELEASE_MD_DIR'}");
michael@0 96 &rec_mkdir("$dir/$version/$var{'RELEASE_XP_DIR'}");
michael@0 97
michael@0 98
michael@0 99
michael@0 100
michael@0 101 foreach $jarfile (split(/ /,$var{FILES}) ) {
michael@0 102 print STDERR "---------------------------------------------\n";
michael@0 103
michael@0 104 $jarinfo = $var{$jarfile};
michael@0 105
michael@0 106 ($jardir,$jaropts) = split(/\|/,$jarinfo);
michael@0 107
michael@0 108 if ($jaropts =~ /f/) {
michael@0 109 print STDERR "Copying files $jardir....\n";
michael@0 110 }
michael@0 111 else {
michael@0 112 print STDERR "Copying jar file $jarfile....\n";
michael@0 113 }
michael@0 114
michael@0 115 print "jaropts = $jaropts\n";
michael@0 116
michael@0 117 if ($jaropts =~ /m/) {
michael@0 118 $destdir = $var{"RELEASE_MD_DIR"};
michael@0 119 print "found m, using MD dir $destdir\n";
michael@0 120 }
michael@0 121 elsif ($jaropts =~ /x/) {
michael@0 122 $destdir = $var{"RELEASE_XP_DIR"};
michael@0 123 print "found x, using XP dir $destdir\n";
michael@0 124 }
michael@0 125 else {
michael@0 126 die "Error: must specify m or x in jar options in $jarinfo line\n";
michael@0 127 }
michael@0 128
michael@0 129
michael@0 130 $distdir = "$dir/$version/$destdir";
michael@0 131
michael@0 132
michael@0 133
michael@0 134 if ($jaropts =~ /f/) {
michael@0 135
michael@0 136 print "splitting: \"$jardir\"\n";
michael@0 137 for $srcfile (split(/ /,$jardir)) {
michael@0 138
michael@0 139 #if srcfile has a slash
michael@0 140 if ($srcfile =~ m|/|) {
michael@0 141 #pull out everything before the last slash into $1
michael@0 142 $srcfile =~ m|(.*)/|;
michael@0 143 $distsubdir = "/$1";
michael@0 144 print "making dir $distdir$distsubdir\n";
michael@0 145 &rec_mkdir("$distdir$distsubdir");
michael@0 146 }
michael@0 147 print "copy: from $srcfile\n";
michael@0 148 print " to $distdir$distsubdir\n";
michael@0 149 $srcprefix = "";
michael@0 150 if ($jaropts =~/m/) {
michael@0 151 $srcprefix = "$var{'PLATFORM'}/";
michael@0 152 }
michael@0 153 system("cp $srcprefix$srcfile $distdir$distsubdir");
michael@0 154 }
michael@0 155 }
michael@0 156 else {
michael@0 157 $srcfile = "$var{SOURCE_RELEASE_PREFIX}/$jardir/$jarfile";
michael@0 158
michael@0 159 print "copy: from $srcfile\n";
michael@0 160 print " to $distdir\n";
michael@0 161
michael@0 162 system("cp $srcfile $distdir");
michael@0 163
michael@0 164 }
michael@0 165
michael@0 166 }
michael@0 167

mercurial