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 Communicator client code, released
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 1998-1999
22 # the Initial Developer. All Rights Reserved.
25 # Sean Su <ssu@netscape.com>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either of the GNU General Public License Version 2 or later (the "GPL"),
29 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
47 # inUpdate - update or noupdate
48 # update - enables time/date compare file update of chrome archives
49 # noupdate - disables time/date compare file update of chrome archives.
50 # it will always update chrome files regardless of time/date stamp.
51 # inSourcePath - path to where the tmpchrome dir
52 # inTargetPath - path to where the bin\chrome dir
53 ($inOsType, $inUpdate, $inSourcePath, $inTargetPath) = @_;
56 if($inOsType =~ /win32/i)
60 elsif($inOsType =~ /mac/i)
64 elsif($inOsType =~ /unix/i)
74 if(!($inUpdate =~ /update/i) &&
75 !($inUpdate =~ /noupdate/i))
80 if($inOsType =~ /win32/i)
82 # Convert all '/' to '\\' or else win32 will have problems
83 $inSourcePath =~ s/\//\\/g
;
84 $inTargetPath =~ s/\//\\/g
;
87 # Make sure $inSourcePath exists
88 if(!(-e
"$inSourcePath"))
93 # Make sure $inTargetPath exists
94 if(!(-e
"$inTargetPath"))
96 mkdir("$inTargetPath", 0775);
99 # Call CreateArchive() on locales, packages, and skins
100 # CreateArchive("loc", $inSourcePath . $gPathDelimiter . "locales", "$inTargetPath");
101 # CreateArchive("pkg", $inSourcePath . $gPathDelimiter . "packages", "$inTargetPath");
102 # CreateArchive("skn", $inSourcePath . $gPathDelimiter . "skins", "$inTargetPath");
103 CreateArchive
("jar", $inSourcePath . $gPathDelimiter, "$inTargetPath");
109 my($inExtension, $inSrc, $inDest) = @_;
117 # Make sure $inSrc exists
123 # Make sure $inSrc is a directory
129 # Make sure $inDest exists
132 mkdir("$inDest", 0775);
135 # Check for extension, if none is passed, use .jar as default
136 if($inExtension eq "")
138 $inExtension = "jar";
141 # Save current working directory
145 # For all the subdirectories within $inSrc, create an archive
146 # using the name of the subdirectory, but with the extension passed
149 foreach $dir (@dirList)
151 if($inOsType =~ /win32/i)
153 # Convert all '/' to '\\' or else win32 will have problems
157 # Get the leaf dir name of full path
158 # Get the leaf dir name from full path
159 if($inOsType =~ /win32/i)
161 @dirItem = split(/\\/, $dir);
163 elsif($inOsType =~ /mac/i)
165 @dirItem = split(/:/, $dir);
167 elsif($inOsType =~ /unix/i)
169 @dirItem = split(/\//, $dir);
171 $dirName = $dirItem[$#dirItem];
175 # Zip only works for win32 and unix systems
176 if(($inOsType =~ /win32/i) || ($inOsType =~ /unix/i))
178 if($inUpdate =~ /noupdate/i)
181 if(-e
"$dirName.$inExtension")
183 # Delete archive is one already exists in target location
184 print " Removing $dirName.$inExtension\n";
185 unlink "$dirName.$inExtension";
188 print " Creating $dirName.$inExtension\n";
191 elsif($inUpdate =~ /update/i)
193 if(!(-e
"$dirName.$inExtension"))
196 print " Creating $dirName.$inExtension\n";
201 print " Updating $dirName.$inExtension\n";
206 # Create the archive in $inDest
208 if(system("zip $mZipParam -r ..$gPathDelimiter$dirName.$inExtension *") != 0)
210 print "Error: zip $mZipParam -r ..$gPathDelimiter$dirName.$inExtension *\n";
219 # Restore to the current working dir