diff --git a/mozilla/xpinstall/packager/windows/GetLongFile.pl b/mozilla/xpinstall/packager/windows/GetLongFile.pl new file mode 100644 index 00000000000..d5991eba409 --- /dev/null +++ b/mozilla/xpinstall/packager/windows/GetLongFile.pl @@ -0,0 +1,202 @@ +#!c:\perl\bin\perl +# +# The contents of this file are subject to the Mozilla 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/MPL/ +# +# 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 Navigator. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corp. Portions created by Netscape Communications Corp. are +# Copyright (C) 1998, 1999, 2000, 2001 Netscape Communications Corp. All +# Rights Reserved. +# +# Contributor(s): +# Sean Su +# + +use Cwd; + +if($#ARGV < 1) +{ + print_usage(); + exit(1); +} + +print "searching for longfilenames in:\n"; +print " $ARGV[0]\n"; + +$outFile = $ARGV[1]; +$start_dir = $ARGV[0]; +$start_dir =~ s/\\/\//g; + +if(substr($start_dir, -1, 1) ne '/') +{ + $start_dir = $start_dir . "/"; +} + +# Open the output file +open(fpOutFile, ">>$outFile") || die "\nCould not open $outFile: $!\n"; + +# $rv has the following possible values: +# 0 - Found at least one long filename file +# 1 - Error locating GetShortPathName.exe +# 2 - No long filename file found +$rv = check_dir_structure($ARGV[0]); + +print "\n"; +close(fpOutFile); +exit($rv); +# end + +sub check_dir_structure +{ + my($curr_dir) = @_; + my($foundFirstFile) = 2; # This var is also used as a return value: + # 0 - Found at least one long filename file + # 1 - Error locating GetShortPathName.exe + # 2 - No long filename file found + + $save_cwd = cwd(); + $save_cwd =~ s/\//\\/g; + if((-e "$curr_dir") && (-d "$curr_dir")) + { + $foundFirstFile = check_all_dir($curr_dir, $foundFirstFile); + chdir($save_cwd); + print " done!"; + } + else + { + if(!(-e "$curr_dir")) + { + print "\n"; + print "$curr_dir does not exist!"; + } + elsif(!(-d "$curr_dir")) + { + print "\n"; + print "$curr_dir is not a valid directory!"; + } + } + + # print out the closing brace for the last file written out. + if($foundFirstFile == 0) + { + # at least one file was found + # print the "];\n" for the previous file found. + print fpOutFile "];\n"; + } + + return($foundFirstFile); +} + +sub check_all_dir +{ + my($curr_dir, $foundFirstFile) = @_; + my(@dirlist); + my($file); + + chdir("$curr_dir"); + @dirlist = <*>; + foreach $file (@dirlist) + { + if(-d "$file") + { + print "."; + $foundFirstFile = check_all_dir($file, $foundFirstFile); + } + elsif(-e $file) + { + if(check_extension($file)) + { + $short_filename = `$ENV{MOZ_TOOLS}\\bin\\GetShortPathName.exe $file`; + if(($?/256) == 1) + { + print "$ENV{MOZ_TOOLS}\\bin\\GetShortPathName.exe: $!\n"; + exit(1); + } + + if(!($file =~ /$short_filename/i)) + { + if($foundFirstFile == 0) + { + # at least one file was found + # print the ",\n" for the previous file found. + print fpOutFile ",\n"; + } + + $curr_path = cwd(); + # perl has problems dealing with '\\''s in split(), so we need to + # convert them to '/''s. + $curr_path =~ s/\\/\//g; + @relative_path = split(/$start_dir/,$curr_path); + if($relative_path[1] eq "") + { + print_file($file, $foundFirstFile); + } + else + { + print_file("$relative_path[1]/$file", $foundFirstFile); + } + $foundFirstFile = 0; + } + } + } + } + chdir(".."); + return($foundFirstFile); +} + +sub check_extension +{ + my($file) = @_; + my($var); + @listExtension = ("dll", + "com", + "jar", + "exe"); + + @arrayExtension = split(/\./,$file); + $extension = @arrayExtension[$#arrayExtension]; + foreach $var (@listExtension) + { + if($extension eq $var) + { + return(1); + } + } + return(0); +} + +sub print_file +{ + my($file, $foundFirstFile) = @_; + + if($foundFirstFile) + { + # first file in list + print fpOutFile "// This list contains filenames that are long filenames ( > 8.3) critical during installation time.\n"; + print fpOutFile "// This list is automatically generated during the build process.\n"; + print fpOutFile "// The filenames should include paths relative to the Netscape 6 folder.\n"; + print fpOutFile "// '/' must be used as path delimiters regardless of platform.\n"; + print fpOutFile "var listLongFilePaths = [\"$file\""; + } + else + { + # middle file in list + print fpOutFile " \"$file\""; + } +} + +sub print_usage +{ + print "\n usage: $0 \n"; + print "\n dir - full path to look for files\n"; + print " outfile - file to append to\n"; +} diff --git a/mozilla/xpinstall/packager/windows/browser.jst b/mozilla/xpinstall/packager/windows/browser.jst index 08c5d951e05..30c32f8b254 100644 --- a/mozilla/xpinstall/packager/windows/browser.jst +++ b/mozilla/xpinstall/packager/windows/browser.jst @@ -205,6 +205,8 @@ var fWindowsSystem; var fileComponentRegStr; var fileComponentReg; +$Ren8dot3List$ + srDest = $SpaceRequired$:bin; err = initInstall("$ProductName$", "Browser", "$Version$"); logComment("initInstall: " + err); @@ -216,6 +218,9 @@ logComment("fProgram: " + fProgram); if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); + + $Ren8dot3Call$ + err = addDirectory("", "$Version$", "bin", // dir name in jar to extract diff --git a/mozilla/xpinstall/packager/windows/chatzilla.jst b/mozilla/xpinstall/packager/windows/chatzilla.jst index f474634c5f2..d6dde84c361 100644 --- a/mozilla/xpinstall/packager/windows/chatzilla.jst +++ b/mozilla/xpinstall/packager/windows/chatzilla.jst @@ -1,6 +1,10 @@ +$Ren8dot3List$ + var err = initInstall("Chatzilla v0.5", "Chatzilla", "$Version$"); logComment("initInstall: " + err); +$Ren8dot3Call$ + addFile("Chatzilla service", "bin/components/chatzilla-service.js", getFolder("Components"), diff --git a/mozilla/xpinstall/packager/windows/config.it b/mozilla/xpinstall/packager/windows/config.it index 16b7a8eb1e1..f361b374de2 100644 --- a/mozilla/xpinstall/packager/windows/config.it +++ b/mozilla/xpinstall/packager/windows/config.it @@ -331,7 +331,7 @@ $InstallSizeArchive$:xpcom.xpi ; 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|INVISIBLE +Attributes=SELECTED|INVISIBLE|CRITICAL [Component1] Description Short=Mozilla Navigator @@ -345,7 +345,7 @@ $InstallSizeArchive$:browser.xpi ; 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|DISABLED +Attributes=SELECTED|DISABLED|CRITICAL [Component2] Description Short=Mail & News @@ -410,7 +410,7 @@ $InstallSizeArchive$:deflenus.xpi ; 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|INVISIBLE +Attributes=SELECTED|INVISIBLE|CRITICAL Parameter= [Component6] @@ -425,7 +425,7 @@ $InstallSizeArchive$:langenus.xpi ; 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|INVISIBLE +Attributes=SELECTED|INVISIBLE|CRITICAL Parameter= diff --git a/mozilla/xpinstall/packager/windows/deflenus.jst b/mozilla/xpinstall/packager/windows/deflenus.jst index aeb6f077981..aa5d6f98b9c 100644 --- a/mozilla/xpinstall/packager/windows/deflenus.jst +++ b/mozilla/xpinstall/packager/windows/deflenus.jst @@ -8,6 +8,8 @@ var prettyName = "US English profile default"; var regName = "defaults/mozilla/en-US"; // --- END CHANGABLE STUFF --- +$Ren8dot3List$ + srDest = $SpaceRequired$:bin; err = initInstall(prettyName, regName, "$Version$"); logComment("initInstall: " + err); @@ -18,6 +20,9 @@ logComment("fProgram: " + fProgram); if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); + + $Ren8dot3Call$ + err = addDirectory("", "$Version$", "bin", // dir name in jar to extract diff --git a/mozilla/xpinstall/packager/windows/editor.jst b/mozilla/xpinstall/packager/windows/editor.jst index ebbd140f2c8..a2eb9237af9 100644 --- a/mozilla/xpinstall/packager/windows/editor.jst +++ b/mozilla/xpinstall/packager/windows/editor.jst @@ -1,9 +1,13 @@ +$Ren8dot3List$ + var err = initInstall("Mozilla Editor", "Seamonkey", "$Version$"); logComment("initInstall: " + err); var communicatorFolder = getFolder("Communicator"); logComment("communicatorFolder: " + communicatorFolder); +$Ren8dot3Call$ + err = addDirectory("Program", "$Version$", "bin", // fileName in jar, diff --git a/mozilla/xpinstall/packager/windows/langende.jst b/mozilla/xpinstall/packager/windows/langende.jst index 69f337f237d..8d478dae741 100644 --- a/mozilla/xpinstall/packager/windows/langende.jst +++ b/mozilla/xpinstall/packager/windows/langende.jst @@ -9,6 +9,8 @@ var regName = "locales/mozilla/en-DE"; var chromeName = "en-DE.jar"; // --- END CHANGABLE STUFF --- +$Ren8dot3List$ + srDest = $SpaceRequired$:bin; err = initInstall(prettyName, regName, "$Version$"); logComment("initInstall: " + err); @@ -19,6 +21,9 @@ logComment("fProgram: " + fProgram); if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); + + $Ren8dot3Call$ + err = addDirectory("", "$Version$", "bin", // dir name in jar to extract diff --git a/mozilla/xpinstall/packager/windows/langengb.jst b/mozilla/xpinstall/packager/windows/langengb.jst index d6e90a9b8b1..1136efa42ec 100644 --- a/mozilla/xpinstall/packager/windows/langengb.jst +++ b/mozilla/xpinstall/packager/windows/langengb.jst @@ -9,6 +9,8 @@ var regName = "locales/mozilla/en-GB"; var chromeName = "en-GB.jar"; // --- END CHANGABLE STUFF --- +$Ren8dot3List$ + srDest = $SpaceRequired$:bin; err = initInstall(prettyName, regName, "$Version$"); logComment("initInstall: " + err); @@ -19,6 +21,9 @@ logComment("fProgram: " + fProgram); if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); + + $Ren8dot3Call$ + err = addDirectory("", "$Version$", "bin", // dir name in jar to extract diff --git a/mozilla/xpinstall/packager/windows/mail.jst b/mozilla/xpinstall/packager/windows/mail.jst index 8633c0d29b4..90f88dbd3c5 100644 --- a/mozilla/xpinstall/packager/windows/mail.jst +++ b/mozilla/xpinstall/packager/windows/mail.jst @@ -3,13 +3,7 @@ var srDest; var err; var fProgram; -// This list contains filenames that are long filenames ( > 8.3) critical during installation time. -// Unfortunately, it is statically created. If there are new files that are suspected to be -// locked in memory during installation of this .xpi file, then they should be listed here. -// The filenames should include paths relative to the Netscape 6 folder. -// '/' must be used as path delimiters regardless of platform. -var listLongFilePaths = ["components/nsAB4xUpgrader.dll", - "chrome/messenger.jar"]; +$Ren8dot3List$ srDest = $SpaceRequired$:bin; err = initInstall("Mozilla Mail", "Mail", "$Version$"); @@ -22,9 +16,7 @@ if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); - // Ren8dot3 process needs to be done before any files have been installed - // (this includes the temp files during the prepare phase) - prepareRen8dot3(listLongFilePaths); + $Ren8dot3Call$ err = addDirectory("", "$Version$", diff --git a/mozilla/xpinstall/packager/windows/makejs.pl b/mozilla/xpinstall/packager/windows/makejs.pl index 0863cfc04fa..a6fbc63071f 100644 --- a/mozilla/xpinstall/packager/windows/makejs.pl +++ b/mozilla/xpinstall/packager/windows/makejs.pl @@ -28,9 +28,9 @@ # value(s). # # Input: .jst file - which is a .js template -# default version - a julian date in the form of: -# major.minor.release.yydoy -# ie: 5.0.0.99256 +# default version - a date in the form of: +# major.minor.release.yyyymmdyhr +# ie: 5.0.0.1999120910 # component staging path - path to where the components are staged at # # ie: perl makejs.pl xpcom.jst 5.0.0.99256 @@ -69,9 +69,11 @@ $outJsFile = $inJstFileSplit[0]; $outJsFile .= ".js"; $outTempFile = $inJstFileSplit[0]; $outTempFile .= ".template"; +$foundLongFiles = 0; -system("copy ..\\common\\share.t $outTempFile"); -system("type windows.t >> $outTempFile"); # append windows specific functions +print "copy \"$ENV{MOZ_SRC}\\mozilla\\xpinstall\\packager\\common\\share.t\" $outTempFile\n"; +system("copy \"$ENV{MOZ_SRC}\\mozilla\\xpinstall\\packager\\common\\share.t\" $outTempFile"); +system("type \"$ENV{MOZ_SRC}\\mozilla\\xpinstall\\packager\\common\\windows.t\" >> $outTempFile"); # append windows specific functions system("type $inJstFile >> $outTempFile"); # Open the input .template file @@ -83,7 +85,7 @@ open(fpOutJs, ">$outJsFile") || die "\nCould not open $outJsFile: $!\n"; # While loop to read each line from input file while($line = ) { - if($line =~ /\$SpaceRequired\$/i) # For each line read, search and replace $InstallSize$ with the calculated size + if($line =~ /\$SpaceRequired\$/i) # For each line read, search and replace $SpaceRequired$ with the calculated size { $spaceRequired = 0; @@ -102,6 +104,38 @@ while($line = ) $line =~ s/\$SpaceRequired\$/$spaceRequired/i; } } + elsif($line =~ /\$Ren8dot3List\$/i) + { + if(-d "$inStagePath\\bin") + { + # need to close the output file because GetLongFile.pl will attempt to open + # it in order to update it. + close(fpOutJs); + $rv = system("perl \"$ENV{MOZ_SRC}\\mozilla\\xpinstall\\packager\\windows\\GetLongFile.pl\" \"$inStagePath\\bin\" \"$outJsFile\"")/256; + if($rv == 0) + { + # set var when long filenames have been found. This is so that the + # call to prepareRen8dot3() will not be written out. + $foundLongFiles = 1; + } + elsif($rv == 1) + { + exit($rv); + } + + # reopen the output .js file + open(fpOutJs, ">>$outJsFile") || die "\nCould not open $outJsFile: $!\n"; + } + } + elsif($line =~ /\$Ren8dot3Call\$/i) + { + if($foundLongFiles) + { + print fpOutJs " // Ren8dot3 process needs to be done before any files have been installed\n"; + print fpOutJs " // (this includes the temp files during the prepare phase)\n"; + print fpOutJs " prepareRen8dot3(listLongFilePaths);\n"; + } + } else { $line =~ s/\$Version\$/$inVersion/i; @@ -113,16 +147,25 @@ while($line = ) $line =~ s/\$UninstallFile\$/$fileUninstall/i; } - print fpOutJs $line; + # Do not print $line if $Ren8dot3List$ or $Ren8dot3Call$ have been detected. + # They have their own print routines. + if(!($line =~ /\$Ren8dot3List\$/i) && !($line =~ /\$Ren8dot3Call\$/i)) + { + print fpOutJs $line; + } } +close(fpInTemplate); +close(fpOutJs); +exit(0); + sub GetSpaceRequired() { my($inPath) = @_; my($spaceRequired); print " calculating size for $inPath\n"; - $spaceRequired = `$ENV{MOZ_TOOLS}\\bin\\ds32.exe /D /L0 /A /S /C 32768 $inPath`; + $spaceRequired = `\"$ENV{MOZ_TOOLS}\\bin\\ds32.exe\" /D /L0 /A /S /C 32768 $inPath`; $spaceRequired = int($spaceRequired / 1024); $spaceRequired += 1; return($spaceRequired); diff --git a/mozilla/xpinstall/packager/windows/xpcom.jst b/mozilla/xpinstall/packager/windows/xpcom.jst index 9b6260c3972..d84e53913c6 100644 --- a/mozilla/xpinstall/packager/windows/xpcom.jst +++ b/mozilla/xpinstall/packager/windows/xpcom.jst @@ -56,6 +56,8 @@ var fileComponentRegStr; var fileMsvcrt; var fileMsvcirt; +$Ren8dot3List$ + srDest = $SpaceRequired$:bin; err = initInstall("Mozilla XPCom", "XPCom", "$Version$"); logComment("initInstall: " + err); @@ -75,6 +77,9 @@ logComment("Installing: " + fProgram + "component.reg"); if(verifyDiskSpace(fProgram, srDest)) { setPackageFolder(fProgram); + + $Ren8dot3Call$ + err = addDirectory("", "$Version$", "bin", // dir name in jar to extract