*** NOT PART OF BUILD ***

Ported perl scripts and install script templates to build Unix .xpis.
b = 21261
r = ssu
a = chofmann
This commit is contained in:
sgehani%netscape.com 1999-12-10 23:44:37 +00:00
parent 01d9abbcda
commit 6496815892
8 changed files with 153 additions and 644 deletions

View File

@ -1,386 +0,0 @@
[General]
; Run Mode values:
; Normal - Shows all dialogs. Requires user input.
; Auto - Shows some dialogs, but none requiring user input. It will
; automatically install the product using default values.
; Silent - Show no dialogs at all. It will install product using default
; values.
Run Mode=Normal
Product Name=Netscape Seamonkey
; Destination Path values:
; PROGRAMFILESDIR
; WINDISK
; WINDIR
; WINSYSDIR
Path=[PROGRAMFILESDIR]\Netscape\Seamonkey
; Program Folder Path values:
; COMMON_STARTUP
; COMMON_PROGRAMS
; COMMON_STARTMENU
; COMMON_DESKTOP
;
; PERSONAL_STARTUP
; PERSONAL_PROGRAMS
; PERSONAL_STARTMENU
; PERSONAL_DESKTOP
;
; PERSONAL_APPDATA
; PERSONAL_CACHE
; PERSONAL_COOKIES
; PERSONAL_FAVORITES
; PERSONAL_FONTS
; PERSONAL_HISTORY
; PERSONAL_NETHOOD
; PERSONAL_PERSONAL
; PERSONAL_PRINTHOOD (supported only under Windows NT)
; PERSONAL_RECENT
; PERSONAL_SENDTO
; PERSONAL_TEMPLATES
;
; PROGRAMFILESDIR
; COMMONFILESDIR
; MEDIAPATH
; CONFIGPATH (supported only under Windows95 and Windows98)
; DEVICEPATH
Program Folder Name=Netscape Seamonkey
Program Folder Path=[COMMON_PROGRAMS]
; Default Setup Type values:
; Setup Type 0 - first radio button (default)
; Setup Type 1 - second radio button
; Setup Type 2 - third radio button
; Setup Type 3 - fourth radio button (usually the Custom option)
Default Setup Type=Setup Type 0
[Dialog Welcome]
Show Dialog=TRUE
Title=Welcome
Message0=Welcome to %s Setup.
Message1=It is strongly recommended that you exit all Windows programs before running this Setup program.
Message2=Click Cancel to quit Setup and then close any programs you have running. Click Next to continue the Setup Program.
[Dialog License]
Show Dialog=FALSE
Title=Software License Agreement
License File=license.txt
Message0=
Message1=
[Dialog Setup Type]
Show Dialog=TRUE
Title=Setup Type
Message0=Click the type of Setup you prefer, then click Next.
; at least one Setup Type needs to be set, and up to 4 can be
; set (Setup Type0, Setup Type1, Setup Type2, Setup Type3).
[Setup Type0]
Description Short=B&ase
Description Long=Program will be installed with the minimal options.
; List of components to install/enable for this Setup Type.
; All other components not listed here will be disabled if
; this Setup Type is selected.
C0=Component0
[Setup Type1]
Description Short=C&omplete
Description Long=Program will be installed with the most common options.
; List of components to install/enable for this Setup Type.
; All other components not listed here will be disabled if
; this Setup Type is selected.
C0=Component0
C1=Component1
[Setup Type2]
Description Short=C&ustom
Description Long=You many choose the options you want to install. Recommended for advanced users.
;Description Short=&Pro
;Description Long=Program will be installed with all the options available.
; List of components to install/enable for this Setup Type.
; All other components not listed here will be disabled if
; this Setup Type is selected.
C0=Component0
C1=Component1
;[Setup Type3]
;Description Short=C&ustom
;Description Long=You many choose the options you want to install. Recommended for advanced users.
; List of components to install/enable for this Setup Type.
; All other components not listed here will be disabled if
; this Setup Type is selected.
;C0=Component0
;C1=Component1
;C2=Component2
;C3=Component3
[Dialog Select Components]
Show Dialog=TRUE
Title=Select Components
Message0=
[Dialog Windows Integration]
Show Dialog=FALSE
Title=Windows Integration
Message0=Check the Netscape Preference options you would like Setup to perform.
Message1=These settings allow you to set default Internet preferences for browsing and searching. They affect browsers installed on your machine, including Netscape Communicator and Microsoft Internet Explorer.
; Only a maximum of 4 "Windows Integration-Item"s are allowded. Each Item
; shows up as a checkbox in the Windows Integration dialog.
[Windows Integration-Item0]
CheckBoxState=FALSE
Description=Make Netscape Communicator my default Internet browser
Archive=
[Windows Integration-Item1]
CheckBoxState=FALSE
Description=Make Netscape Netcenter my home page
Archive=
[Windows Integration-Item2]
CheckBoxState=FALSE
Description=Use Netscape Netcenter to search the Web
Archive=
[Dialog Program Folder]
Show Dialog=TRUE
Title=Program Folder
Message0=Setup will add program icons to the Program Folder listed below. You may type a new folder name, or select one from the existing folder list. Click Next to continue.
[Dialog Start Install]
Show Dialog=TRUE
Title=Start Install
Message0=Setup has enough information to start copying the program files. If you want to review or change settings, click Back. If you are satisfied with the current settings, click Install to begin copying files.
[Dialog Reboot]
; Show Dialog values are:
; TRUE - Always show
; FALSE - Don't show unless at least one component has its reboot show value set
; to TRUE. This will not show even if some files were in use and a reboot
; is necessary.
; AUTO - Don't show unless a component has its reboot show value set to
; TRUE or there was at least one file in use and a reboot is
; is required for the file to be replaced correctly.
Show Dialog=FALSE
; These SmartDownload sections contain information to configure SmartDownload.
; The info is applied to all components to be downloaded.
[SmartDownload-Netscape Install]
;core_file=base.zip
;core_dir=[SETUP PATH]
no_ads=true
silent=false
execution=false
confirm_install=false
;extract_msg=Uncompressing Seamonkey. Please wait...
[SmartDownload-Proxy]
[SmartDownload-Execution]
exe=
exe_param=
; These are the components to be offered to the user (shown in the Select
; Components dialog) for installation.
; There is no limit to the number of components to install.
[Component0]
Description Short=Netscape Seamonkey
Description Long=Browser software for the internet
Archive=core.xpi
$InstallSize$:core
$InstallSizeSystem$
; Attributes can be the following values:
; SELECTED - the component is selected to be installed by default.
; INVISIBLE - the component is not shown in the Select Components dialog.
Attributes=SELECTED
; url keys can be as many as needed. url0 is attempted first. if it fails,
; the next url key is tried in sequential order.
; The url should not contain the filename. Setup will assemble the complete url
; using the url keys and the Archive key.
url0=$URLPath$
[Component1]
Description Short=Mail&News
Description Long=Seamonkey Mail&News
Archive=mail.xpi
$InstallSize$:mail
$InstallSizeSystem$
;Dependency0=Netscape Seamonkey
; Attributes can be the following values:
; SELECTED - the component is selected to be installed by default.
; INVISIBLE - the component is not shown in the Select Components dialog.
Attributes=SELECTED
Parameter=
; url keys can be as many as needed. url0 is attempted first. if it fails,
; the next url key is tried in sequential order.
; The url should not contain the filename. Setup will assemble the complete url
; using the url keys and the Archive key.
url0=$URLPath$
[Core]
Source=[XPI PATH]\core.xpi
Destination=[TEMP]\core.ns
Cleanup=TRUE
Message=Preparing SmartUpdate, please wait...
; The Timing key needs to be one of the following values:
; pre download - process before any files have been downloaded.
; post download - process after all files have been downloaded.
; pre core - process before the core file has been uncompressed.
; post core - process after the core file has been uncompressed.
; pre smartupdate - process before the smartupdate engine has been launched.
; post smartupdate - process after the smartupdate engine has been launched.
; pre launchapp - process before the launching of executables.
; post launchapp - process after the launching of executables.
;Uncompress FileX sections
;[Uncompress File0]
;Timing=post download
;Source=[XPI PATH]\core.xpi
;Destination=[SETUP PATH]
;Message=Configuring Seamonkey, please wait...
;[Uncompress File1]
;Timing=post download
;Source=[XPI PATH]\extratest.xpi
;Destination=[SETUP PATH]
;Message=Configuring Extra test files, please wait...
;Move FileX sections
;[Move File0]
;Timing=post download
;Source=[SETUP PATH]\bin\*
;Destination=[SETUP PATH]\program
;[Move File1]
;Timing=post download
;Source=[SETUP PATH]\ftmain\*
;Destination=[SETUP PATH]\program
;Copy FileX sections
;[Copy File0]
;Timing=post launchapp
;Source=[WINDISK]\Progra~1\JavaSoft\JRE\1.2.2\bin\npjava*.dll
;Destination=[SETUP PATH]\components
;Fail If Exists=FALSE
;[Copy File1]
;Timing=post launchapp
;Source=[TEMP]\xtratest\bin\*.*
;Destination=[SETUP PATH]
;Fail If Exists=FALSE
;[Copy File1]
;Timing=post download
;Source=[SETUP PATH]\bin\*.exe
;Destination=[TEMP]
;Fail If Exists=
;Create DirectoryX sections
;[Create Directory0]
;Timing=post download
;Destination=[TEMP]\Test
;[Create Directory1]
;Timing=post download
;Destination=[TEMP]\Test\temp
;Delete FileX sections
;[Delete File0]
;Timing=post launchapp
;Destination=[Setup Path]\install.js
;Remove DirectoryX sections
;[Remove Directory0]
;Timing=post launchapp
;Destination=[TEMP]\xtratest
;Remove subdirs=TRUE
;RunAppX sections
[RunApp0]
Timing=post launchapp
Wait=FALSE
Target=[SETUP PATH]\mozilla.exe
Parameters=-installer
WorkingDir=[SETUP PATH]
; Values for Show Folder:
; HIDE Hides the window and activates another window.
; MAXIMIZE Maximizes the specified window.
; MINIMIZE Minimizes the specified window and activates the next
; top-level window in the z-order.
; RESTORE Activates and displays the window. If the window is
; minimized or maximized, Windows restores it to its
; original size and position. An application should specify
; this flag when restoring a minimized window.
; SHOW Activates the window and displays it in its current size
; and position.
; SHOWMAXIMIZED Activates the window and displays it as a maximized
; window.
; SHOWMINIMIZED Activates the window and displays it as a minimized
; window.
; SHOWMINNOACTIVE Displays the window as a minimized window. The active
; window remains active.
; SHOWNA Displays the window in its current state. The active
; window remains active.
; SHOWNOACTIVATE Displays a window in its most recent size and position.
; The active window remains active.
; SHOWNORMAL Activates and displays a window. If the window is
; minimized or maximized, Windows restores it to its
; original size and position. An application should specify
; this flag when displaying the window for the first time.
[Program Folder0]
Timing=post download
Show Folder=SHOW
Program Folder=[Default Folder]
[Program Folder0-Shortcut0]
File=[SETUP PATH]\mozilla.exe
Arguments=
Working Dir=[SETUP PATH]
Description=Netscape Mozilla
Icon Path=[SETUP PATH]\mozilla.exe
Icon Id=0
;[Program Folder0-Shortcut1]
;File=[SETUP PATH]\bin\viewer.exe
;Arguments=
;Working Dir=[SETUP PATH]
;Description=Netscape Viewer
;Icon Path=[SETUP PATH]\bin\viewer.exe
;Icon Id=0
;[Program Folder0-Shortcut2]
;File=[SETUP PATH]\bin\Net2fone.exe
;Arguments=
;Working Dir=[SETUP PATH]
;Description=Net2Fone
;Icon Path=[SETUP PATH]\bin\Net2fone.exe
;Icon Id=0
;[Program Folder1]
;Timing=post download
;Show Folder=SHOW
;Program Folder=[Default Folder]\lala land
;[Program Folder1-Shortcut0]
;File=c:\bin\getver.exe
;Arguments=
;Working Dir=[TEMP]
;Description=Getver Test
;Icon Path=[WINDISK]\4nt\4nt.exe
;Icon Id=0
;[Program Folder1-Shortcut1]
;File=c:\perl\bin\perl.exe
;Arguments=
;Working Dir=[WINSYS]
;Description=Perl
;Icon Path=c:\perl\bin\perl.exe
;Icon Id=0

View File

@ -1,21 +0,0 @@
var err = StartInstall("Mozilla Seamonkey", "Seamonkey", "$Version$");
LogComment("StartInstall: " + err);
var communicatorFolder = Install.GetFolder("Communicator");
LogComment("communicatorFolder: " + communicatorFolder);
err = AddDirectory("Program",
"$Version$",
"bin", // fileName in jar,
communicatorFolder, // Where to put this file (Returned from GetFolder)
"", // fileName in jar,
true ); // Force Flag
LogComment("AddDirectory() returned: " + err);
var fileComponentReg = communicatorFolder + "\\component.reg";
err = Install.FileDelete(fileComponentReg);
LogComment("FileDelete() returned: " + err);
err = FinalizeInstall();
LogComment("FinalizeInstall() returned: " + err);

View File

@ -1,18 +1,28 @@
var err = StartInstall("Mozilla Editor", "Seamonkey", "$Version$");
LogComment("StartInstall: " + err);
var err = startInstall("Mozilla Editor", "Seamonkey", "$Version$");
logComment("startInstall: " + err);
var communicatorFolder = Install.GetFolder("Communicator");
LogComment("communicatorFolder: " + communicatorFolder);
var communicatorFolder = getFolder("Communicator");
logComment("communicatorFolder: " + communicatorFolder);
err = AddDirectory("Program",
err = addDirectory("Program",
"$Version$",
"bin", // fileName in jar,
communicatorFolder, // Where to put this file (Returned from GetFolder)
"", // fileName in jar,
true ); // Force Flag
"bin", // jar source folder
communicatorFolder, // target folder
"", // target subdir
true ); // force Flag
LogComment("AddDirectory() returned: " + err);
logComment("addDirectory() returned: " + err);
err = getLastError();
if (err==SUCCESS || err==REBOOT_NEEDED)
{
err = finalizeInstall();
logComment("finalizeInstall() returned: " + err);
}
else
{
abortInstall();
logComment("abortInstall() due to error: " + err);
}
err = FinalizeInstall();
LogComment("FinalizeInstall() returned: " + err);

View File

@ -1,18 +1,27 @@
var err = StartInstall("Mozilla Mail", "Seamonkey", "$Version$");
LogComment("StartInstall: " + err);
var err = startInstall("Mozilla Mail", "Seamonkey", "$Version$");
logComment("startInstall: " + err);
var communicatorFolder = Install.GetFolder("Communicator");
LogComment("communicatorFolder: " + communicatorFolder);
var communicatorFolder = getFolder("Communicator");
logComment("communicatorFolder: " + communicatorFolder);
err = AddDirectory("Program",
err = addDirectory("Program",
"$Version$",
"bin", // fileName in jar,
communicatorFolder, // Where to put this file (Returned from GetFolder)
"", // fileName in jar,
true ); // Force Flag
"bin", // jar source folder
communicatorFolder, // target folder
"", // target subdir
true ); // force flag
LogComment("AddDirectory() returned: " + err);
logComment("addDirectory() returned: " + err);
err = FinalizeInstall();
LogComment("FinalizeInstall() returned: " + err);
err = getLastError();
if (err==SUCCESS || err==REBOOT_NEEDED)
{
err = finalizeInstall();
logComment("finalizeInstall() returned: " + err);
}
else
{
abortInstall();
logComment("abortInstall() due to error: " + err);
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
@ -20,6 +20,7 @@
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
# Samir Gehani <sgehani@netscape.com>
#
#
@ -40,7 +41,8 @@ if($#ARGV < 3)
staging path : full path to where the components are staged at
dist install path : full path to where the mozilla/dist/bin is at.
dist install path : full path to target dist area
\n";
}
@ -55,38 +57,25 @@ if(!(-e "$inStagePath"))
die "invalid path: $inStagePath\n";
}
# Make sure inDestPath exists
# Make sure inDistPath exists
if(!(-e "$inDistPath"))
{
system("mkdir $inDestPath");
system("mkdir $inDistPath");
}
MakeConfigFile();
MakeJsFile();
# Make .js files
MakeJsFile("install");
MakeJsFile("browser");
MakeJsFile("mail");
# Make all xpi files
MakeXpiFile("core");
MakeXpiFile("install");
MakeXpiFile("browser");
MakeXpiFile("mail");
MakeXpiFile("editor");
if(-e "$inDistPath/setup")
{
unlink <$inDistPath/setup/*>;
}
else
{
system("mkdir $inDistPath/setup");
}
# Copy the setup files to the dist setup directory.
system("cp config.ini $inDistPath");
system("cp config.ini $inDistPath\\setup");
system("cp $inDistPath/mozilla-install $inDistPath\\setup");
#system("cp $inDistPath\\setuprsc.dll $inDistPath\\setup");
# build the self-extracting .exe file.
printf "\nbuilding self-extracting .exe installer...";
#system("$inDistPath/nszip.exe $inDistPath/nsinstall.exe $inDistPath\\setup\\*.* $inDistPath\\xpi\\*.*");
# printf "\nbuilding self-extracting .exe installer...";
# PORT system("$inDistPath\\nszip.exe $inDistPath\\nsinstall.exe $inDistPath\\setup\\*.*");
print " done!\n";
@ -96,7 +85,7 @@ exit(0);
sub MakeConfigFile
{
# Make config.ini file
if(system("perl makecfgini.pl config.it $inStagePath $inURLPath") != 0)
if(system("perl makecfgini.pl config.it $inStagePath $inDistPath $inURLPath") != 0)
{
exit(1);
}
@ -104,14 +93,12 @@ sub MakeConfigFile
sub MakeJsFile
{
# Make .js files
@jstFiles = <*.jst>;
foreach $jst (@jstFiles)
my($componentName) = @_;
# Make .js file
if(system("perl makejs.pl $componentName.jst $inDefaultVersion $inStagePath/$componentName") != 0)
{
if(system("perl makejs.pl $jst $inDefaultVersion") != 0)
{
exit(1);
}
exit(1);
}
}
@ -120,7 +107,7 @@ sub MakeXpiFile
my($componentName) = @_;
# Make .xpi file
if(system("perl makexpi.pl $componentName $inStagePath $inDistPath\\xpi") != 0)
if(system("perl makexpi.pl $componentName $inStagePath $inDistPath") != 0)
{
exit(1);
}

View File

@ -1,161 +0,0 @@
#!/usr/bin/perl
#
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
#
# This perl script parses the input file for special variables
# in the format of $Variable$ and replace it with the appropriate
# value(s).
#
# Input: .it file
# - which is a .ini template
# Path to staging area
# - path on where the seamonkey built bits are staged to
# URL path
# - path to where the .xpi files are staged. can be
# either ftp:// or http://
#
# ie: perl makecfgini.pl z:\exposed\windows\32bit\en\5.0 ftp://sweetlou/products/client/seamonkey/windows/32bit/x86/1999-09-13-10-M10
#
# Make sure there are at least two arguments
if($#ARGV < 2)
{
die "usage: $0 <.it file> <staging path> <URL path>
.it file : input ini template file
staging path : path to where the components are staged at
URL path : URL path to where the .xpi files will be staged at.
Either ftp:// or http:// can be used
\n";
}
$inItFile = $ARGV[0];
$inStagePath = $ARGV[1];
$inURLPath = $ARGV[2];
# Get the name of the file replacing the .it extension with a .ini extension
@inItFileSplit = split(/\./,$inItFile);
$outIniFile = $inItFileSplit[0];
$outIniFile .= ".ini";
# Open the input file
open(fpInIt, $inItFile) || die "\ncould not open $ARGV[0]: $!\n";
# Open the output file
open(fpOutIni, ">$outIniFile") || die "\nCould not open $outIniFile: $!\n";
print "\n Making $outIniFile...\n";
# While loop to read each line from input file
while($line = <fpInIt>)
{
# For each line read, search and replace $InstallSize$ with the calculated size
if($line =~ /\$InstallSize\$/i)
{
$installSize = 0;
$installSizeSystem = 0;
# split read line by ":" deliminator
@colonSplit = split(/:/, $line);
if($#colonSplit >= 0)
{
$componentName = $colonSplit[1];
chop($componentName);
$installSize = OutputInstallSize("$inStagePath/$componentName");
# special oji consideration here. Since it's an installer that
# seamonkey installer will be calling, the disk space allocation
# needs to be adjusted by an expansion factor of 3.62.
if($componentName =~ /oji/i)
{
$installSize = int($installSize * 3.62);
}
}
# Read the next line to calculate for the "Install Size System="
if($line = <fpInIt>)
{
if($line =~ /\$InstallSizeSystem\$/i)
{
$installSizeSystem = OutputInstallSizeSystem($line, "$inStagePath/$componentName");
}
}
$installSize -= $installSizeSystem;
print fpOutIni "Install Size=$installSize\n";
print fpOutIni "Install Size System=$installSizeSystem\n";
}
else
{
# For each line read, search and replace $InstallSizeSystem$ with the calulated size
$line =~ s/\$URLPath\$/$inURLPath/i;
print fpOutIni $line;
}
}
print " done!\n";
# end of script
exit(0);
sub OutputInstallSize()
{
my($inPath) = @_;
my($installSize);
print " calulating size for $inPath\n";
$installSize = `ds32.exe /L0 /A /S /C 32768 $inPath`;
$installSize = int($installSize / 1024);
$installSize += 1;
return($installSize);
}
sub OutputInstallSizeSystem()
{
my($inLine, $inPath) = @_;
my($installSizeSystem) = 0;
# split read line by ":" deliminator
@colonSplit = split(/:/, $inLine);
if($#colonSplit >= 0)
{
# split line by "," deliminator
@commaSplit = split(/\,/, $colonSplit[1]);
if($#commaSplit >= 0)
{
foreach(@commaSplit)
{
# calculate the size of component installed using ds32.exe in Kbytes
print " calulating size for $inPath/$_\n";
$installSizeSystem += `ds32.exe /L0 /A /S /C 32768 $inPath/$_`;
$installSizeSystem = int($installSize / 1024);
$installSizeSystem += 1;
}
}
}
return($installSizeSystem);
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
@ -20,6 +20,7 @@
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
# Samir Gehani <sgehani@netscape.com>
#
#
@ -31,42 +32,110 @@
# default version - a julian date in the form of:
# major.minor.release.yydoy
# ie: 5.0.0.99256
# staging path - path to where the components are staged at
#
# ie: perl makejs.pl core.jst 5.0.0.99256
# ie: perl makejs.pl core.jst 5.0.0.99256 ../../staging_area/core
#
# Make sure there are at least two arguments
if($#ARGV < 1)
# Make sure there are at least three arguments
if($#ARGV < 2)
{
die "usage: $0 <.jst file> <default version>
die "usage: $0 <.jst file> <default version> <staging path>
.jst file : .js template input file
default version : default julian base version number to use in the
form of: major.minor.release.yydoy
ie: 5.0.0.99256
.jst file : .js template input file
default version : default julian base version number to use in the
form of: major.minor.release.yydoy
ie: 5.0.0.99256
component staging path : path to where this component is staged at
ie: z:\stage\windows\32bit\en\5.0\core
\n";
}
$inJstFile = $ARGV[0];
$inVersion = $ARGV[1];
$inStagePath = $ARGV[2];
# Get the name of the file replacing the .jst extension with a .js extension
@inJstFileSplit = split(/\./,$inJstFile);
$outJsFile = $inJstFileSplit[0];
$outJsFile .= ".js";
# Open the input .jst file
open(fpInJst, $inJstFile) || die "\ncould not open $ARGV[0]: $!\n";
# Open the input template file
open(fpInJst, "<$inJstFile") || die "\nCould not open $inJstFile: $!\n";
# Open the output .js file
open(fpOutJs, ">$outJsFile") || die "\nCould not open $outJsFile: $!\n";
# While loop to read each line from input file
while($line = <fpInJst>)
{
# For each line read, search and replace $Version$ with the version passed in
$line =~ s/\$Version\$/$inVersion/i;
if($line =~ /\$Version\$/i)
{
$line =~ s/\$Version\$/$inVersion/i;
}
# For each line read, search and replace $SpaceRequired$ with the version passed in
if($line =~ /\$SpaceRequired\$/i)
{
$spaceRequired = 0;
# split read line by ":" delimiter
@colonSplit = split(/:/, $line);
if($#colonSplit > 0)
{
@semiColonSplit = split(/;/, $colonSplit[1]);
$subDir = $semiColonSplit[0];
$spaceRequired = GetSpaceRequired("$inStagePath/$subDir");
$spaceRequired = int($spaceRequired/1024) + 1;
$line =~ s/\$SpaceRequired\$:$subDir/$spaceRequired/i;
}
else
{
$spaceRequired = GetSpaceRequired("$inStagePath");
$spaceRequired = int($spaceRequired/1024) + 1;
$line =~ s/\$SpaceRequired\$/$spaceRequired/i;
}
}
print fpOutJs $line;
}
##
# GetSpaceRequired
#
# Finds the space used by the contents of a dir by recursively
# traversing the subdir hierarchy and counting individual file
# sizes
#
# @param targetDir the directory whose space usage to find
# @return spaceUsed the number of bytes used by the dir contents
#
sub GetSpaceRequired()
{
my($targetDir) = $_[0];
my($spaceUsed) = 0;
my(@dirEntries) = ();
my($item) = "";
@dirEntries = <$targetDir/*>;
# iterate over all dir entries
foreach $item ( @dirEntries )
{
# if dir entry is dir
if (-d $item)
{
# add GetSpaceRequired(<dirEntry>) to space used
$spaceUsed += GetSpaceRequired($item);
}
# else if dir entry is file
elsif (-e $item)
{
# add size of file to space used
$spaceUsed += (-s $item);
}
}
return $spaceUsed;
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
@ -20,6 +20,7 @@
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
# Samir Gehani <sgehani@netscape.com>
#
#
@ -33,7 +34,8 @@
# - path to where the .xpi files are are to be created at.
# ** MUST BE AN ABSOLUTE PATH, NOT A RELATIVE PATH **
#
# ie: perl makexpi.pl core z:\exposed\windows\32bit\en\5.0 d:\build\mozilla\dist\win32_o.obj\install\working
# ie: perl makexpi.pl core z:\exposed\windows\32bit\en\5.0
# d:\build\mozilla\dist\win32_o.obj\install\working
#
use File::Copy;
@ -54,13 +56,13 @@ $inComponentName = $ARGV[0];
$inStagePath = $ARGV[1];
$inDestPath = $ARGV[2];
# check for existance of staging component path
# check for existence of staging component path
if(!(-e "$inStagePath/$inComponentName"))
{
die "invalid path: $inStagePath/$inComponentName\n";
}
# check for existance of .js script
# check for existence of .js script
if(!(-e "$inComponentName.js"))
{
die "missing .js script: $inComponentName.js\n";
@ -71,7 +73,7 @@ if(-e "$inDestPath/$inComponentName.xpi")
{
unlink("$inDestPath/$inComponentName.xpi");
}
if(-e "$inStagePath/$incomponentName/$inComponentName.xpi")
if(-e "$inStagePath/$inComponentName/$inComponentName.xpi")
{
unlink("$inDestPath/$inComponentName.xpi");
}