3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is mozilla.org code.
18 # The Initial Developer of the Original Code is
19 # Netscape Communications Corporation.
20 # Portions created by the Initial Developer are Copyright (C) 1999
21 # the Initial Developer. All Rights Reserved.
24 # Samir Gehani <sgehani@netscape.com>
26 # Alternatively, the contents of this file may be used under the terms of
27 # either the GNU General Public License Version 2 or later (the "GPL"), or
28 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 # in which case the provisions of the GPL or the LGPL are applicable instead
30 # of those above. If you wish to allow use of your version of this file only
31 # under the terms of either the GPL or the LGPL, and not to allow others to
32 # use your version of this file under the terms of the MPL, indicate your
33 # decision by deleting the provisions above and replace them with the notice
34 # and other provisions required by the GPL or the LGPL. If you do not delete
35 # the provisions above, a recipient may use your version of this file under
36 # the terms of any one of the MPL, the GPL or the LGPL.
38 # ***** END LICENSE BLOCK *****
40 #==============================================================================
41 # usage: perl deliver.pl version URLPath stubName blobName buildWizard
42 # e.g. perl deliver.pl 5.0.0.1 ftp://foo/ mozilla-installer mozilla-installer
44 # Delivers the stub and blob installers to mozilla/installer/stub
45 # and mozilla/installer/sea, respectively. Also, delivers the .xpis
46 # to mozilla/installer/raw/xpi.
50 # * all args are optional
51 # * version is used by xpinstall and needs to bumped every build
52 # * URLPath must have a trailing slash
53 # * if you are not building a release version no need to pass any args
54 # * pass in "buildwizard" as the last arg to build the wizard too
55 # * you must be in deliver.pl's dir when calling it since it assumes DEPTH
56 #==============================================================================
71 # archive url not supplied, set it to default values
72 $inXpiURL = "ftp://not.supplied.invalid";
73 print "Warning: Remote XPI URL not set. Using $inXpiURL instead!\n";
75 if($inRedirIniURL eq "")
77 # redirect url not supplied, set it to default value.
78 $inRedirIniURL = $inXpiURL;
80 if($inConfigFiles eq "")
82 print "Error: Packager Manifests and Install Script Location not supplied! Use -config\n";
87 print "Error: Mozilla source directory must be specified with -srcDir\n";
92 print "Objdir not specified, using $inSrcDir\n";
93 $inObjDir = $inSrcDir;
96 $win32 = ($^O
=~ / ((MS)?win32)|cygwin|os2/i) ?
1 : 0;
103 # ensure that CFGParser.pm is in @INC, since we might not be called from
104 # mozilla/toolkit/mozapps/installer
106 $top_path =~ s/\\/\//g
if $win32;
107 push(@INC, dirname
($top_path));
110 CFGParser
::ParseInstallerCfg
("$inConfigFiles/installer.cfg");
112 $STAGE = "$inObjDir/stage";
113 $DIST = "$inObjDir/dist";
115 $verPartial = "5.0.0.";
116 $ver = $verPartial . GetVersion
($inObjDir);
118 # Set up the stage directory
120 system("rm -rf $STAGE");
125 #-------------------------------------------------------------------------
127 #-------------------------------------------------------------------------
129 chdir("$inSrcDir/xpinstall/packager");
130 system("perl pkgcp.pl -o $platform -s $DIST -d $STAGE -f $inConfigFiles/$ENV{WIZ_packagesFile} -v") &&
131 die "pkgcp.pl failed: $!";
132 spew
("Completed copying build files");
134 #// call xptlink.pl to make big .xpt files/component
135 system("perl xptlink.pl -s $DIST -d $STAGE -v") &&
136 die "xptlink.pl failed: $!";
137 spew
("Completed xptlinking");
139 #// call makeall.pl tunneling args (delivers .xpis to $inObjDir/installer/stage)
140 chdir("$inSrcDir/toolkit/mozapps/installer");
141 spew
("perl makeall.pl $ver -config $inConfigFiles -aurl $inXpiURL -rurl $inRedirIniURL -objDir $inObjDir");
142 system("perl makeall.pl $ver -config $inConfigFiles -aurl $inXpiURL -rurl $inRedirIniURL -objDir $inObjDir") &&
143 die "makeall.pl failed: $!";
144 spew
("Completed making .xpis");
146 spew
("Installers built (see $inObjDir/dist/install/{stub,sea})");
149 #-------------------------------------------------------------------------
151 #-------------------------------------------------------------------------
154 print "+++ deliver.pl: ".$_[0]."\n";
161 die "--- deliver.pl: couldn't cp cause ".$_[0]." doesn't exist: $!";
163 system ("cp ".$_[0]." ".$_[1]);
171 for($counter = 0; $counter <= $#myArgv; $counter++)
173 if($myArgv[$counter] =~ /^[-,\/]h
$/i
)
177 elsif($myArgv[$counter] =~ /^[-,\/]aurl
$/i
)
179 if($#myArgv >= ($counter + 1))
182 $inXpiURL = $myArgv[$counter];
183 $inRedirIniURL = $inXpiURL;
186 elsif($myArgv[$counter] =~ /^[-,\/]rurl
$/i
)
188 if($#myArgv >= ($counter + 1))
191 $inRedirIniURL = $myArgv[$counter];
194 elsif($myArgv[$counter] =~ /^[-,\/]config
$/i
)
196 if ($#myArgv >= ($counter + 1))
199 $inConfigFiles = $myArgv[$counter];
202 elsif($myArgv[$counter] =~ /^[-,\/]srcDir
$/i
)
204 if ($#myArgv >= ($counter + 1))
207 $inSrcDir = $myArgv[$counter];
210 elsif($myArgv[$counter] =~ /^[-,\/]objDir
$/i
)
212 if ($#myArgv >= ($counter + 1))
215 $inObjDir = $myArgv[$counter];
226 my($distWinPathName);
233 $distWinPathName = "dist";
235 $fileMozilla = "$depthPath/$distWinPathName/$ENV{WIZ_distSubdir}/$ENV{WIZ_fileMainExe}";
237 # verify the existance of file
238 if(!(-e
"$fileMozilla"))
240 print "file not found: $fileMozilla\n";
244 ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime,
245 $blksize, $blocks) = stat $fileMozilla;
246 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($mtime);
249 # localtime() returns year 2000 as 100, we mod 100 to get at the last 2 digits
251 $yy = "20" . sprintf("%.2d", $yy);
254 $monAdjusted = $mon + 1;
255 $mm = sprintf("%.2d", $monAdjusted);
257 # calculate month day
258 $dd = sprintf("%.2d", $mday);
261 $hh = sprintf("%.2d", $hour);
263 $fileMozillaVer = "$yy$mm$dd$hh";
264 print "y2k compliant version string for $fileMozilla: $fileMozillaVer\n";
265 return($fileMozillaVer);