From a4858de6514cc8f8d7d21afab205e3c9d3e95ee3 Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Wed, 12 Mar 2003 21:40:19 +0000 Subject: [PATCH] fixing bug 190389 - GRE installer needs to use new version key format. This is not enabled just yet, but support code is fully in place with this check in r=sgehani,sr=dveditz git-svn-id: svn://10.0.0.236/trunk@139348 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpinstall/packager/StageUtils.pm | 172 ++++++++++++++++++ mozilla/xpinstall/packager/win_gre/config.it | 50 +++-- mozilla/xpinstall/packager/win_gre/gre.jst | 10 +- mozilla/xpinstall/packager/win_gre/makeall.pl | 139 ++++++++------ .../xpinstall/packager/win_gre/makecfgini.pl | 4 + .../packager/win_gre/makeuninstallini.pl | 4 + .../xpinstall/packager/win_gre/uninstall.it | 2 +- .../xpinstall/packager/win_mfcembed/config.it | 16 +- .../packager/win_mfcembed/makeall.pl | 136 +++++++++----- .../packager/win_mfcembed/makecfgini.pl | 4 + .../packager/win_mfcembed/makeuninstallini.pl | 4 + mozilla/xpinstall/packager/windows/config.it | 17 +- mozilla/xpinstall/packager/windows/makeall.pl | 132 +++++++++----- .../xpinstall/packager/windows/makecfgini.pl | 4 + .../packager/windows/makeuninstallini.pl | 4 + mozilla/xpinstall/packager/windows/xpcom.jst | 65 ------- .../xpinstall/wizard/windows/builder/build.pl | 7 +- .../wizard/windows/builder/build_gre.pl | 10 +- .../wizard/windows/builder/build_mfcembed.pl | 7 +- .../xpinstall/wizard/windows/setup/dialogs.c | 10 +- .../xpinstall/wizard/windows/setup/extra.c | 8 +- 21 files changed, 539 insertions(+), 266 deletions(-) diff --git a/mozilla/xpinstall/packager/StageUtils.pm b/mozilla/xpinstall/packager/StageUtils.pm index 62e5f5ef019..2cf2653da81 100644 --- a/mozilla/xpinstall/packager/StageUtils.pm +++ b/mozilla/xpinstall/packager/StageUtils.pm @@ -280,3 +280,175 @@ sub GeneratePackagesFromSinglePackage system("perl $gDirScripts/make_pkgs_from_list.pl -p $aPlatform -pkg $aSinglePackage -o $aDestination"); } +# To retrieve a build id ($aDefine) from $aBuildIDFile (normally +# mozilla/config/nsBuildID.h). +sub GetProductBuildID +{ + my($aBuildIDFile, $aDefine) = @_; + my($line); + my($buildID); + my($fpInIt); + + if(!(-e $aBuildIDFile)) + { + die "\n file not found: $aBuildIDFile\n"; + } + + # Open the input file + open($fpInIt, $aBuildIDFile) || die "\n open $aBuildIDFile for reading: $!\n"; + + # While loop to read each line from input file + while($line = <$fpInIt>) + { + if($line =~ /#define.*$aDefine/) + { + $buildID = $line; + chop($buildID); + + # only get the build id from string, excluding spaces + $buildID =~ s/..*$aDefine\s+//; + # strip out any quote characters + $buildID =~ s/\"//g; + } + } + close($fpInIt); + return($buildID); +} + +# GetGreSpecialID() +# To build GRE's ID as follows: +# * Use mozilla's milestone version for 1st 2 numbers of version x.x.x.x. +# * DO NOT Strip out any non numerical chars from mozilla's milestone +# version. +# * Get the y2k ID from mozilla/config/nsBuildID.h. +# * Build the GRE special ID given the following: +# mozilla milestone: 1.4a +# mozilla buildID.h: 2003030510 +# GRE Special ID : 1.4a_2003030510 +sub GetGreSpecialID +{ + my($aDirMozTopSrc) = @_; + my($fileBuildID) = "$aDirMozTopSrc/config/nsBuildID.h"; + my($greID) = undef; + my($initEmptyValues) = 0; + my($versionMilestone) = GetProductMilestoneVersion($aDirMozTopSrc, $aDirMozTopSrc, $initEmptyValues); + + $greID = GetProductBuildID($fileBuildID, "GRE_BUILD_ID"); + return($versionMilestone); +# return($greID); +# return($versionMilestone . "_$greID"); +} + +# GetGreFileVersion() +# To build GRE's file version as follows: +# * Use mozilla's milestone version for 1st 2 numbers of version x.x.x.x. +# * Strip out any non numerical chars from mozilla's milestone version. +# * Get the y2k ID from mozilla/config/nsBuildID.h. +# * Split the y2k ID exactly in 2 equal parts and use them for the last +# 2 numbers of the version x.x.x.x. +# ie: y2k: 2003030510 +# part1: 20030 +# part2: 30510 +# +# XXX XXX: Problem with this format! It won't work for dates > 65536. +# ie: 20030 71608 (July 16, 2003 8am) +# +# mozilla/config/version_win.pl has the same problem because these +# two code need to be in sync with each other. +# +# * Build the GRE file version given a mozilla milestone version of "1.4a" +# GRE version: 1.4.20030.30510 +sub GetGreFileVersion +{ + my($aDirMozTopSrc) = @_; + my($fileBuildID) = "$aDirMozTopSrc/config/nsBuildID.h"; + my($initEmptyValues) = 1; + my(@version) = undef; + my($y2kDate) = undef; + my($buildID_hi) = undef; + my($buildID_lo) = undef; + my($versionMilestone) = GetProductMilestoneVersion($aDirMozTopSrc, $aDirMozTopSrc, $initEmptyValues); + + $versionMilestone =~ s/[^0-9.][^.]*//g; # Strip out non numerical chars from versionMilestone. + @version = split /\./, $versionMilestone; + $y2kDate = GetProductBuildID($fileBuildID, "NS_BUILD_ID"); + + # If the buildID is 0000000000, it means that it's a non release build. + # This also means that the GRE version (xpcom.dll's version) will be + # 0.0.0.0. We need to match this version for install to proceed + # correctly. + if($y2kDate eq "0000000000") + { + return("0.0.0.0"); + } + + $buildID_hi = substr($y2kDate, 0, 5); + $buildID_hi =~ s/^0+//; # strip out leading '0's + $buildID_hi = 0 if($buildID_hi eq undef); #if buildID_hi happened to be all '0's, then set it to '0' + $buildID_lo = substr($y2kDate, 5); + $buildID_lo =~ s/^0+//; # strip out leading '0's + $buildID_lo = 0 if($buildID_lo eq undef); #if buildID_hi happened to be all '0's, then set it to '0' + + return("$version[0].$version[1].$buildID_hi.$buildID_lo"); +} + +# Retrieves the product's milestone version (ns or mozilla): +# ie: "1.4a.0.0" +# +# If the milestone version is simply "1.4a", this function will prefil +# the rest of the 4 unit ids with '0': +# ie: "1.4a" -> "1.4a.0.0" +# +# The milestone version is acquired from [topsrcdir]/config/milestone.txt +sub GetProductMilestoneVersion +{ + my($aDirMozTopSrc, $aDirConfigTopSrc, $initEmptyValues) = @_; + my($y2kDate) = undef; + my($versionMilestone) = undef; + my($counter) = undef; + my(@version) = undef; + my($saveCwd) = cwd(); + + chdir("$aDirMozTopSrc/config"); + $versionMilestone = `perl milestone.pl --topsrcdir $aDirConfigTopSrc`; + chop($versionMilestone); + chdir($saveCwd); + + if(($initEmptyValues ne undef) && ($initEmptyValues eq 1)) + { + @version = split /\./, $versionMilestone; + + # Initialize any missing version blocks (x.x.x.x) to '0' + for($counter = $#version + 1; $counter <= 3; $counter++) + { + $version[$counter] = "0"; + } + return("$version[0].$version[1].$version[2].$version[3]"); + } + return($versionMilestone); +} + +# Retrieves the products's milestone version from either the ns tree or the +# mozilla tree. +# +# It will also use the y2k compliant build id from mozilla/config/nsBuildID.h +# in the last value: +# ie: milestone.txt : 1.4a +# nsBuildID.h : 2003030510 +# product version then will be: 1.4a.0.2003030510 +# +# The milestone version is acquired from [topsrcdir]/config/milestone.txt +sub GetProductY2KVersion +{ + my($aDirMozTopSrc, $aDirConfigTopSrc) = @_; + my($fileBuildID) = "$aDirMozTopSrc/config/nsBuildID.h"; + my($initEmptyValues) = 1; + my(@version) = undef; + my($y2kDate) = undef; + my($versionMilestone) = GetProductMilestoneVersion($aDirMozTopSrc, $aDirConfigTopSrc, $initEmptyValues); + + @version = split /\./, $versionMilestone; + $y2kDate = GetProductBuildID($fileBuildID, "NS_BUILD_ID"); + return("$version[0].$version[1].$version[2].$y2kDate"); +} + diff --git a/mozilla/xpinstall/packager/win_gre/config.it b/mozilla/xpinstall/packager/win_gre/config.it index 4977d355057..f76ba210799 100644 --- a/mozilla/xpinstall/packager/win_gre/config.it +++ b/mozilla/xpinstall/packager/win_gre/config.it @@ -13,14 +13,14 @@ Default AppID=$ProductName$User Company Name=$CompanyName$ Product Name=$ProductName$ Product NameInternal=$ProductNameInternal$ -User Agent=$UserAgent$ +User Agent=$GreUniqueID$ ; Destination Path values: ; PROGRAMFILESDIR ; WINDISK ; WINDIR ; WINSYSDIR -Path=[COMMONFILESDIR]\$CompanyName$\$ProductName$\$XPInstallVersion$ +Path=[COMMONFILESDIR]\$CompanyName$\$ProductName$\$GreUniqueID$ ; Sub Path, when set will indicate to Setup to create a subfolder from ; what is offered to the user to change. It will not be shown to the user @@ -489,6 +489,10 @@ Filename=install_wizard.log Source=[SETUP PATH] Destination=[SETUP PATH]\Uninstall +[Delete File0] +Timing=post launchapp +Destination=[SETUP PATH]\install_wizard.log + ; Legal values for the Overwrite Name key are TRUE, FALSE and ENUMERATE. ; ENUMERATE is used for shared installs and means: ; 1) Starting with 01, increment though the NameXX named values in the @@ -500,9 +504,9 @@ Destination=[SETUP PATH]\Uninstall ; [Windows Registry0] Root Key=HKEY_LOCAL_MACHINE -Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\$ProductName$ ($UserAgentShort$) +Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\$ProductName$ ($GreUniqueID$) Name=DisplayName -Name Value=Gecko Runtime Environment ($UserAgentShort$) +Name Value=Gecko Runtime Environment ($GreUniqueID$) Type=REG_SZ Decrypt Key=FALSE Decrypt Name=FALSE @@ -514,10 +518,10 @@ Condition=DefaultApp [Windows Registry1] Root Key=HKEY_LOCAL_MACHINE -Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\$ProductName$ ($UserAgentShort$) +Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\$ProductName$ ($GreUniqueID$) Name=UninstallString ;*** LOCALIZE ME BABY *** -Name Value=[WINDIR]\$UninstallFile$ /ua "$UserAgent$" /app $ProductName$User +Name Value=[WINDIR]\$UninstallFile$ /ua "$GreUniqueID$" /app $ProductName$User Type=REG_SZ Decrypt Key=FALSE Decrypt Name=FALSE @@ -529,9 +533,8 @@ Condition=DefaultApp [Windows Registry2] Root Key=HKEY_LOCAL_MACHINE -Key=[REGPATH]\$UserAgentShort$\AppList\[APP_ID] +Key=[REGPATH]\AppList\[APP_ID] Name=Name -;*** LOCALIZE ME BABY *** Name Value=[APP_ID] Type=REG_SZ Decrypt Key=TRUE @@ -543,9 +546,8 @@ Timing=post smartupdate [Windows Registry3] Root Key=HKEY_LOCAL_MACHINE -Key=[REGPATH]\$UserAgentShort$\AppList\[APP_ID] +Key=[REGPATH]\AppList\[APP_ID] Name=PathToExe -;*** LOCALIZE ME BABY *** Name Value=[PATH_TO_APP] Type=REG_SZ Decrypt Key=TRUE @@ -557,7 +559,7 @@ Timing=post smartupdate [Windows Registry4] Root Key=HKEY_LOCAL_MACHINE -Key=[REGPATH]\$UserAgentShort$\Installer +Key=[REGPATH]\Installer Name=PathToExe ;*** LOCALIZE ME BABY *** Name Value=[SETUP PATH]\Setup $ProductNameInternal$\setup.exe @@ -569,6 +571,32 @@ Overwrite Key=TRUE Overwrite Name=TRUE Timing=post smartupdate +[Windows Registry5] +Root Key=HKEY_LOCAL_MACHINE +Key=[REGPATH]\Uninstall +Name=Description +Name Value=$ProductName$ ($UserAgentShort$) +Type=REG_SZ +Decrypt Key=TRUE +Decrypt Name=FALSE +Decrypt Name Value=FALSE +Overwrite Key=TRUE +Overwrite Name=TRUE +Timing=pre smartupdate + +[Windows Registry6] +Root Key=HKEY_LOCAL_MACHINE +Key=[REGPATH]\Uninstall +Name=Uninstall Log Folder +Name Value=[SETUP PATH]\Uninstall +Type=REG_SZ +Decrypt Key=TRUE +Decrypt Name=FALSE +Decrypt Name Value=TRUE +Overwrite Key=TRUE +Overwrite Name=TRUE +Timing=pre smartupdate + ; Values for Show Folder: ; HIDE Hides the window and activates another window. ; MAXIMIZE Maximizes the specified window. diff --git a/mozilla/xpinstall/packager/win_gre/gre.jst b/mozilla/xpinstall/packager/win_gre/gre.jst index 2f6f5c91730..9935faed134 100644 --- a/mozilla/xpinstall/packager/win_gre/gre.jst +++ b/mozilla/xpinstall/packager/win_gre/gre.jst @@ -35,7 +35,7 @@ function registerKeys() createRootRegKey(winreg); - subkey = regRootKey + "\\$UserAgent$"; + subkey = regRootKey; err = winreg.setValueString(subkey, "Version", "$UserAgent$"); tmpstr = new String(fProgram); err = winreg.setValueString(subkey, "GreHome", tmpstr.substring(0, tmpstr.length-1)); @@ -74,7 +74,7 @@ function createRootRegKey(winreg) winreg.createKey(subkey,""); } - winreg.createKey(subkey + "\\$UserAgent$",""); + winreg.createKey(subkey,""); } function registerMainKeys(winreg) @@ -84,13 +84,13 @@ function registerMainKeys(winreg) var value; //the data in the value you want to look at. var err; - winreg.createKey(regRootKey + "\\$UserAgent$", ""); + winreg.createKey(regRootKey, ""); - subkey = regRootKey + "\\$UserAgent$\\Main"; + subkey = regRootKey + "\\Main"; winreg.createKey(subkey,""); err = winreg.setValueString(subkey, "Install Directory", fProgram); - subkey = regRootKey + "\\$UserAgent$\\Uninstall"; + subkey = regRootKey + "\\Uninstall"; winreg.createKey(subkey,""); err = winreg.setValueString(subkey, "Uninstall Log Folder", fProgram + "Uninstall"); err = winreg.setValueString(subkey, "Description", "$ProductName$ ($UserAgentShort$)"); diff --git a/mozilla/xpinstall/packager/win_gre/makeall.pl b/mozilla/xpinstall/packager/win_gre/makeall.pl index 5af450803ed..0f9f2a906b1 100644 --- a/mozilla/xpinstall/packager/win_gre/makeall.pl +++ b/mozilla/xpinstall/packager/win_gre/makeall.pl @@ -31,19 +31,33 @@ use File::Copy; use File::Path; use File::Basename; -# Make sure there are at least one argument -if($#ARGV < 0) -{ - PrintUsage(); -} - $DEPTH = "../../.."; $topsrcdir = GetTopSrcDir(); +push(@INC, "$topsrcdir/xpinstall/packager"); +require StageUtils; require "$topsrcdir/config/zipcfunc.pl"; -$inDefaultVersion = $ARGV[0]; -# $ARGV[0] has the form maj.min.release.bld where maj, min, release +$inDefaultProductVersion = StageUtils::GetProductY2KVersion($topsrcdir, $topsrcdir); +# The mozilla's milestone is the same as the GRE's milestone version. +# initEmptyValues indicates to GetProductMilestoneVersion() whether or not to +# prefill the missing version values with '0's: +# ie: if milestone version is 1.4a +# initEmptyValues dictate whether is should be 1.4a.0.0 or not. +$initEmptyValues = 1; +$inDefaultGreVersion = StageUtils::GetProductMilestoneVersion($topsrcdir, $topsrcdir, $initEmptyValues); +$inStagePath = "$topsrcdir/stage"; +$inDistPath = "$topsrcdir/dist"; +$inXpiURL = "ftp://not.supplied.invalid"; +$inRedirIniURL = $inXpiURL; + +ParseArgv(@ARGV); + +print "\n"; +print " Building GRE\n"; +print " Raw version id : $inDefaultProductVersion\n"; + +# $inDefaultGreVersion has the form maj.min.release.bld where maj, min, release # and bld are numerics representing version information. # Other variables need to use parts of the version info also so we'll # split out the dot seperated values into the array @versionParts @@ -53,30 +67,34 @@ $inDefaultVersion = $ARGV[0]; # $versionParts[1] = min # $versionParts[2] = release # $versionParts[3] = bld -@versionParts = split /\./, $inDefaultVersion; +@versionParts = split /\./, $inDefaultProductVersion; # We allow non-numeric characters to be included as the last -# characters in fields of $ARG[1] for display purposes (mostly to +# characters in fields of $inDefaultProductVersion for display purposes (mostly to # show that we have moved past a certain version by adding a '+' -# character). Non-numerics must be stripped out of $inDefaultVersion, +# character). Non-numerics must be stripped out of $inDefaultProductVersion, # however, since this variable is used to identify the the product # for comparison with other installations, so the values in each field # must be numeric only: -$inDefaultVersion =~ s/[^0-9.][^.]*//g; -print "The raw version id is: $inDefaultVersion\n"; +$inDefaultProductVersion =~ s/[^0-9.][^.]*//g; -$inStagePath = "$topsrcdir/stage"; -$inDistPath = "$topsrcdir/dist"; -$inXpiURL = "ftp://not.supplied.invalid"; -$inRedirIniURL = $inXpiURL; - -ParseArgv(@ARGV); +# set environment vars for use by other .pl scripts called from this script. +if($versionParts[2] eq "0") +{ + $versionMain = "$versionParts[0].$versionParts[1]"; +} +else +{ + $versionMain = "$versionParts[0].$versionParts[1].$versionParts[2]"; +} +print " Display version : $versionMain\n"; +print " Xpinstall version: $inDefaultProductVersion\n"; +print "\n"; $gDirPackager = "$topsrcdir/xpinstall/packager"; $gDirDistInstall = "$inDistPath/inst_gre"; $gDirStageProduct = "$inStagePath/gre"; - # Create the stage area here. # If -sd is not used, the default stage dir will be: $topsrcdir/stage if(system("perl \"$gDirPackager/make_stage.pl\" -pn gre -os win -sd \"$inStagePath\"")) @@ -91,34 +109,40 @@ $seiFileNameSpecificStub = "$seiStubRootName.exe"; $seuFileNameSpecific = "GREUninstall.exe"; $seuzFileNameSpecific = "greuninstall.zip"; -# set environment vars for use by other .pl scripts called from this script. -if($versionParts[2] eq "0") -{ - $versionMain = "$versionParts[0]\.$versionParts[1]"; -} -else -{ - $versionMain = "$versionParts[0]\.$versionParts[1]\.$versionParts[2]"; -} -print "The display version is: $versionMain\n"; - $ENV{WIZ_nameCompany} = "mozilla.org"; $ENV{WIZ_nameProduct} = "GRE"; $ENV{WIZ_nameProductInternal} = "GRE"; # product name without the version string $ENV{WIZ_fileMainExe} = "none.exe"; $ENV{WIZ_fileUninstall} = $seuFileNameSpecific; $ENV{WIZ_fileUninstallZip} = $seuzFileNameSpecific; + # The following variables are for displaying version info in the # the installer. $ENV{WIZ_userAgent} = "$versionMain"; - # userAgentShort just means it does not have the language string. # ie: '1.3b' as opposed to '1.3b (en)' $ENV{WIZ_userAgentShort} = "$versionMain"; -$ENV{WIZ_xpinstallVersion} = "$versionMain"; +$ENV{WIZ_xpinstallVersion} = "$inDefaultProductVersion"; $ENV{WIZ_distInstallPath} = "$gDirDistInstall"; +# GetGreFileVersion() will return the actual version of xpcom.dll used by GRE. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre version would be: 1.4.20030.30610 +$ENV{WIZ_greFileVersion} = StageUtils::GetGreFileVersion($topsrcdir); + +# GetGreSpecialID() will return the GRE ID to be used in the windows registry. +# This ID is also the same one being querried for by the mozilla glue code. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre special ID would be: 1.4a_2003030610 +$ENV{WIZ_greUniqueID} = StageUtils::GetGreSpecialID($topsrcdir); + print "\n"; +print " GRE file version : $ENV{WIZ_greFileVersion}\n"; +print " GRE special version: $ENV{WIZ_greUniqueID}\n"; print "\n"; print " Building $ENV{WIZ_nameProduct} $ENV{WIZ_userAgent}...\n"; print "\n"; @@ -307,12 +331,14 @@ sub MakeExeZip sub PrintUsage { - die "usage: $0 [options] - - default app version: version to use for GRE - ie: 1.3b.0.0 + die "usage: $0 [options] options include: + + -productVer : Version of the product. By default it will acquire the + version listed in mozilla/config/milestone.txt file. + ie: 1.4a.0.0 + -stagePath : Full path to where the GRE components are staged at Default path, if one is not set, is: [mozilla]/stage @@ -321,13 +347,13 @@ sub PrintUsage Default path, if one is not set, is: [mozilla]/dist - -aurl : either ftp:// or http:// url to where the - archives (.xpi, .exe, .zip, etc...) reside + -aurl : either ftp:// or http:// url to where the + archives (.xpi, .exe, .zip, etc...) reside - -rurl : either ftp:// or http:// url to where the - redirec.ini resides. If not supplied, it - will be assumed to be the same as archive - url. + -rurl : either ftp:// or http:// url to where the + redirec.ini resides. If not supplied, it + will be assumed to be the same as archive + url. \n"; } @@ -336,13 +362,20 @@ sub ParseArgv my(@myArgv) = @_; my($counter); - # The first 3 arguments are required, so start on the 4th. - for($counter = 3; $counter <= $#myArgv; $counter++) + for($counter = 0; $counter <= $#myArgv; $counter++) { if($myArgv[$counter] =~ /^[-,\/]h$/i) { PrintUsage(); } + elsif($myArgv[$counter] =~ /^[-,\/]productVer$/i) + { + if($#myArgv >= ($counter + 1)) + { + ++$counter; + $inDefaultProductVersion = $myArgv[$counter]; + } + } elsif($myArgv[$counter] =~ /^[-,\/]stagePath$/i) { if($#myArgv >= ($counter + 1)) @@ -385,16 +418,16 @@ sub MakeConfigFile { chdir("$gDirPackager/win_gre"); # Make config.ini file - if(system("perl makecfgini.pl config.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) + if(system("perl makecfgini.pl config.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) { - print "\n Error: perl makecfgini.pl config.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; + print "\n Error: perl makecfgini.pl config.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; return(1); } # Make install.ini file - if(system("perl makecfgini.pl install.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) + if(system("perl makecfgini.pl install.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) { - print "\n Error: perl makecfgini.pl install.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; + print "\n Error: perl makecfgini.pl install.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; return(1); } return(0); @@ -442,9 +475,9 @@ sub MakeUninstall sub MakeUninstallIniFile { # Make config.ini file - if(system("perl makeuninstallini.pl uninstall.it $inDefaultVersion")) + if(system("perl makeuninstallini.pl uninstall.it $inDefaultProductVersion")) { - print "\n Error: perl makeuninstallini.pl uninstall.it $inDefaultVersion\n"; + print "\n Error: perl makeuninstallini.pl uninstall.it $inDefaultProductVersion\n"; return(1); } return(0); @@ -456,9 +489,9 @@ sub MakeJsFile chdir("$gDirPackager/win_gre"); # Make .js file - if(system("perl makejs.pl $mComponent.jst $inDefaultVersion $gDirStageProduct/$mComponent")) + if(system("perl makejs.pl $mComponent.jst $inDefaultProductVersion $gDirStageProduct/$mComponent")) { - print "\n Error: perl makejs.pl $mComponent.jst $inDefaultVersion $gDirStageProduct/$mComponent\n"; + print "\n Error: perl makejs.pl $mComponent.jst $inDefaultProductVersion $gDirStageProduct/$mComponent\n"; return(1); } return(0); diff --git a/mozilla/xpinstall/packager/win_gre/makecfgini.pl b/mozilla/xpinstall/packager/win_gre/makecfgini.pl index 1bd2eeb20aa..22453cf6b89 100644 --- a/mozilla/xpinstall/packager/win_gre/makecfgini.pl +++ b/mozilla/xpinstall/packager/win_gre/makecfgini.pl @@ -93,6 +93,8 @@ $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; $fileUninstallZip = $ENV{WIZ_fileUninstallZip}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; $inDomain; $inRedirDomain; @@ -198,6 +200,8 @@ while($line = ) $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; $line =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } } diff --git a/mozilla/xpinstall/packager/win_gre/makeuninstallini.pl b/mozilla/xpinstall/packager/win_gre/makeuninstallini.pl index 16f01c17ca5..0cd8a893155 100644 --- a/mozilla/xpinstall/packager/win_gre/makeuninstallini.pl +++ b/mozilla/xpinstall/packager/win_gre/makeuninstallini.pl @@ -64,6 +64,8 @@ $nameProduct = $ENV{WIZ_nameProduct}; $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; # Get the name of the file replacing the .it extension with a .ini extension @inItFileSplit = split(/\./,$inItFile); @@ -91,6 +93,8 @@ while($line = ) $line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi; $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } diff --git a/mozilla/xpinstall/packager/win_gre/uninstall.it b/mozilla/xpinstall/packager/win_gre/uninstall.it index d0ca45c46b3..8bdf1b798c8 100644 --- a/mozilla/xpinstall/packager/win_gre/uninstall.it +++ b/mozilla/xpinstall/packager/win_gre/uninstall.it @@ -54,7 +54,7 @@ Main Key=[Product WinRegKey] Decrypt Main Key=TRUE Root Key=HKEY_LOCAL_MACHINE -Key=SOFTWARE\$CompanyName$\$ProductName$\$UserAgent$\Uninstall +Key=SOFTWARE\$CompanyName$\$ProductName$\$GreUniqueID$\Uninstall Decrypt Key=TRUE Uninstall Filename=$UninstallFile$ diff --git a/mozilla/xpinstall/packager/win_mfcembed/config.it b/mozilla/xpinstall/packager/win_mfcembed/config.it index f3889a5adb2..f0cd6809803 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/config.it +++ b/mozilla/xpinstall/packager/win_mfcembed/config.it @@ -111,15 +111,15 @@ GRE Type=Shared ; declared in the following format: ; ; Software\[company name]\[product name] -; (ie: Software\mozilla.org\GRE_PRIVATE) +; (ie: Software\mozilla.org\GRE_1.4a_00000000_PRIVATE) ; ; If it is not in the above format, the GRE installer/uninstaller can ; fail to work properly. ; The value to Prodduct Name Internal= (at the beginning of this ; config.ini file) will be appended as follows: ; -; Software\mozilla.org\GRE_PRIVATE_[Product Name Internal] -GRE Private Key=Software\mozilla.org\GRE_PRIVATE +; Software\mozilla.org\GRE_1.4a_00000000_PRIVATE_[Product Name Internal] +GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE ; This section contains info on how to send error information in case of ; either a download or xpinstall error. @@ -439,9 +439,9 @@ Attributes=SELECTED|UNCOMPRESS|SUPERSEDE|LAUNCHAPP|INVISIBLE Parameter=-mmi -ma -app $ProductName$ -app_path "[SETUP PATH]\$MainExeFile$" SupersedeType=GRE SupersedeWinReg0=HKEY_LOCAL_MACHINE\Software\mozilla.org\GRE -SupersedeVersion0=1.3.0.0 -SupersedeMinVersion=1.3.0.0 -SupersedeMaxVersion=1.3.0.0 +SupersedeVersion0=$GreFileVersion$ +SupersedeMinVersion= +SupersedeMaxVersion= [Component MFCEmbed] Description Short=MFCEmbed @@ -552,6 +552,10 @@ Filename=install_wizard.log Source=[SETUP PATH] Destination=[SETUP PATH]\Uninstall +[Delete File0] +Timing=post launchapp +Destination=[SETUP PATH]\install_wizard.log + [Windows Registry0] Root Key=HKEY_LOCAL_MACHINE Key=Software\Microsoft\Windows\CurrentVersion\Uninstall\$ProductName$ ($UserAgentShort$) diff --git a/mozilla/xpinstall/packager/win_mfcembed/makeall.pl b/mozilla/xpinstall/packager/win_mfcembed/makeall.pl index 362b148b128..0236d2efdbc 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/makeall.pl +++ b/mozilla/xpinstall/packager/win_mfcembed/makeall.pl @@ -31,19 +31,33 @@ use File::Copy; use File::Path; use File::Basename; -# Make sure there are at least two arguments -if($#ARGV < 1) -{ - PrintUsage(); -} - $DEPTH = "../../.."; $topsrcdir = GetTopSrcDir(); +push(@INC, "$topsrcdir/xpinstall/packager"); +require StageUtils; require "$topsrcdir/config/zipcfunc.pl"; -$inDefaultVersion = $ARGV[0]; -# $ARGV[0] has the form maj.min.release.bld where maj, min, release +$inDefaultProductVersion = StageUtils::GetProductY2KVersion($topsrcdir, $topsrcdir); +# The mozilla's milestone is the same as the GRE's milestone version. +# initEmptyValues indicates to GetProductMilestoneVersion() whether or not to +# prefill the missing version values with '0's: +# ie: if milestone version is 1.4a +# initEmptyValues dictate whether is should be 1.4a.0.0 or not. +$initEmptyValues = 1; +$inDefaultGreVersion = StageUtils::GetProductMilestoneVersion($topsrcdir, $topsrcdir, $initEmptyValues); +$inStagePath = "$topsrcdir/stage"; +$inDistPath = "$topsrcdir/dist"; +$inXpiURL = "ftp://not.supplied.invalid"; +$inRedirIniURL = $inXpiURL; + +ParseArgv(@ARGV); + +print "\n"; +print " Building MfcEmbed\n"; +print " Raw version id : $inDefaultProductVersion\n"; + +# $inDefaultProductVersion has the form maj.min.release.bld where maj, min, release # and bld are numerics representing version information. # Other variables need to use parts of the version info also so we'll # split out the dot seperated values into the array @versionParts @@ -53,25 +67,30 @@ $inDefaultVersion = $ARGV[0]; # $versionParts[1] = min # $versionParts[2] = release # $versionParts[3] = bld -@versionParts = split /\./, $inDefaultVersion; +@versionParts = split /\./, $inDefaultProductVersion; # We allow non-numeric characters to be included as the last -# characters in fields of $ARG[1] for display purposes (mostly to +# characters in fields of $inDefaultProductVersion for display purposes (mostly to # show that we have moved past a certain version by adding a '+' -# character). Non-numerics must be stripped out of $inDefaultVersion, +# character). Non-numerics must be stripped out of $inDefaultProductVersion, # however, since this variable is used to identify the the product # for comparison with other installations, so the values in each field # must be numeric only: -$inDefaultVersion =~ s/[^0-9.][^.]*//g; -print "The raw version id is: $inDefaultVersion\n"; +$inDefaultProductVersion =~ s/[^0-9.][^.]*//g; -$inDefaultGreVersion = $ARGV[1]; -$inStagePath = "$topsrcdir/stage"; -$inDistPath = "$topsrcdir/dist"; -$inXpiURL = "ftp://not.supplied.invalid"; -$inRedirIniURL = $inXpiURL; +# set environment vars for use by other .pl scripts called from this script. +if($versionParts[2] eq "0") +{ + $versionMain = "$versionParts[0].$versionParts[1]"; +} +else +{ + $versionMain = "$versionParts[0].$versionParts[1].$versionParts[2]"; +} -ParseArgv(@ARGV); +print " Display version : $versionMain\n"; +print " Xpinstall version: $inDefaultProductVersion\n"; +print "\n"; $gDirPackager = "$topsrcdir/xpinstall/packager"; $gDirDistInstall = "$inDistPath/inst_mfcembed"; @@ -86,22 +105,10 @@ $seuzFileNameSpecific = "mfcembeduninstall.zip"; $seiGreFileNameSpecific = "gre-win32-installer.exe"; $seizGreFileNameSpecific = "gre-win32-installer.zip"; -# set environment vars for use by other .pl scripts called from this script. -if($versionParts[2] eq "0") -{ - $versionMain = "$versionParts[0]\.$versionParts[1]"; -} -else -{ - $versionMain = "$versionParts[0]\.$versionParts[1]\.$versionParts[2]"; -} -print "The display version is: $versionMain\n"; - - # Build GRE installer package first before building Mozilla! GRE installer is required by the mozilla installer. -if(system("perl \"$gDirPackager/win_gre/makeall.pl\" $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) +if(system("perl \"$gDirPackager/win_gre/makeall.pl\" -productVer $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) { - die "\n Error: perl \"$gDirPackager/win_gre/makeall.pl\" $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; + die "\n Error: perl \"$gDirPackager/win_gre/makeall.pl\" -productVer $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; } # Create the stage area here. @@ -136,10 +143,27 @@ $ENV{WIZ_fileUninstallZip} = $seuzFileNameSpecific; # the installer. $ENV{WIZ_userAgent} = "$versionMain"; $ENV{WIZ_userAgentShort} = "$versionMain"; -$ENV{WIZ_xpinstallVersion} = "$versionMain"; +$ENV{WIZ_xpinstallVersion} = "$inDefaultProductVersion"; $ENV{WIZ_distInstallPath} = "$gDirDistInstall"; +# GetGreFileVersion() will return the actual version of xpcom.dll used by GRE. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre version would be: 1.4.20030.30610 +$ENV{WIZ_greFileVersion} = StageUtils::GetGreFileVersion($topsrcdir); + +# GetGreSpecialID() will return the GRE ID to be used in the windows registry. +# This ID is also the same one being querried for by the mozilla glue code. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre special ID would be: 1.4a_2003030610 +$ENV{WIZ_greUniqueID} = StageUtils::GetGreSpecialID($topsrcdir); + print "\n"; +print " GRE file version : $ENV{WIZ_greFileVersion}\n"; +print " GRE special version: $ENV{WIZ_greUniqueID}\n"; print "\n"; print " Building $ENV{WIZ_nameProduct} $ENV{WIZ_userAgent}...\n"; print "\n"; @@ -349,6 +373,15 @@ sub PrintUsage options include: + -productVer : Version of the product. By default it will acquire the + version listed in mozilla/config/milestone.txt and + mozilla/config/nsBuildID.h files. + ie: 1.0.0.2003030410 + + -greVer : Version of GRE. By default it will acquire the + version listed in mozilla/config/milestone.txt file. + ie: 1.4a.0.0 + -stagePath : full path to where the mfc embed components are staged at Default stage path, if this is not set, is: [mozilla]/stage @@ -372,13 +405,28 @@ sub ParseArgv my(@myArgv) = @_; my($counter); - # The first 3 arguments are required, so start on the 4th. - for($counter = 3; $counter <= $#myArgv; $counter++) + for($counter = 0; $counter <= $#myArgv; $counter++) { if($myArgv[$counter] =~ /^[-,\/]h$/i) { PrintUsage(); } + elsif($myArgv[$counter] =~ /^[-,\/]productVer$/i) + { + if($#myArgv >= ($counter + 1)) + { + ++$counter; + $inDefaultProductVersion = $myArgv[$counter]; + } + } + elsif($myArgv[$counter] =~ /^[-,\/]greVer$/i) + { + if($#myArgv >= ($counter + 1)) + { + ++$counter; + $inDefaultGreVersion = $myArgv[$counter]; + } + } elsif($myArgv[$counter] =~ /^[-,\/]stagePath$/i) { if($#myArgv >= ($counter + 1)) @@ -421,16 +469,16 @@ sub MakeConfigFile { chdir("$gDirPackager/win_mfcembed"); # Make config.ini file - if(system("perl makecfgini.pl config.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) + if(system("perl makecfgini.pl config.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) { - print "\n Error: perl makecfgini.pl config.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; + print "\n Error: perl makecfgini.pl config.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; return(1); } # Make install.ini file - if(system("perl makecfgini.pl install.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) + if(system("perl makecfgini.pl install.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL")) { - print "\n Error: perl makecfgini.pl install.it $inDefaultVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; + print "\n Error: perl makecfgini.pl install.it $inDefaultProductVersion $gDirStageProduct $gDirDistInstall/xpi $inRedirIniURL $inXpiURL\n"; return(1); } return(0); @@ -484,9 +532,9 @@ sub MakeUninstallIniFile { chdir("$gDirPackager/win_mfcembed"); # Make config.ini file - if(system("perl makeuninstallini.pl uninstall.it $inDefaultVersion")) + if(system("perl makeuninstallini.pl uninstall.it $inDefaultProductVersion")) { - print "\n Error: perl makeuninstallini.pl uninstall.it $inDefaultVersion\n"; + print "\n Error: perl makeuninstallini.pl uninstall.it $inDefaultProductVersion\n"; return(1); } return(0); @@ -498,9 +546,9 @@ sub MakeJsFile chdir("$gDirPackager/win_mfcembed"); # Make .js file - if(system("perl makejs.pl $mComponent.jst $inDefaultVersion $gDirStageProduct/$mComponent")) + if(system("perl makejs.pl $mComponent.jst $inDefaultProductVersion $gDirStageProduct/$mComponent")) { - print "\n Error: perl makejs.pl $mComponent.jst $inDefaultVersion $gDirStageProduct/$mComponent\n"; + print "\n Error: perl makejs.pl $mComponent.jst $inDefaultProductVersion $gDirStageProduct/$mComponent\n"; return(1); } return(0); diff --git a/mozilla/xpinstall/packager/win_mfcembed/makecfgini.pl b/mozilla/xpinstall/packager/win_mfcembed/makecfgini.pl index 1bd2eeb20aa..22453cf6b89 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/makecfgini.pl +++ b/mozilla/xpinstall/packager/win_mfcembed/makecfgini.pl @@ -93,6 +93,8 @@ $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; $fileUninstallZip = $ENV{WIZ_fileUninstallZip}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; $inDomain; $inRedirDomain; @@ -198,6 +200,8 @@ while($line = ) $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; $line =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } } diff --git a/mozilla/xpinstall/packager/win_mfcembed/makeuninstallini.pl b/mozilla/xpinstall/packager/win_mfcembed/makeuninstallini.pl index 16f01c17ca5..0cd8a893155 100644 --- a/mozilla/xpinstall/packager/win_mfcembed/makeuninstallini.pl +++ b/mozilla/xpinstall/packager/win_mfcembed/makeuninstallini.pl @@ -64,6 +64,8 @@ $nameProduct = $ENV{WIZ_nameProduct}; $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; # Get the name of the file replacing the .it extension with a .ini extension @inItFileSplit = split(/\./,$inItFile); @@ -91,6 +93,8 @@ while($line = ) $line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi; $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } diff --git a/mozilla/xpinstall/packager/windows/config.it b/mozilla/xpinstall/packager/windows/config.it index a5285c044b9..a57d0c0cb74 100644 --- a/mozilla/xpinstall/packager/windows/config.it +++ b/mozilla/xpinstall/packager/windows/config.it @@ -108,15 +108,15 @@ GRE Type=Local ; declared in the following format: ; ; Software\[company name]\[product name] -; (ie: Software\mozilla.org\GRE_PRIVATE) +; (ie: Software\mozilla.org\GRE_1.4a_0000000000_PRIVATE) ; ; If it is not in the above format, the GRE installer/uninstaller can ; fail to work properly. ; The value to Prodduct Name Internal= (at the beginning of this ; config.ini file) will be appended as follows: ; -; Software\mozilla.org\GRE_PRIVATE_[Product Name Internal] -GRE Private Key=Software\mozilla.org\GRE_PRIVATE +; Software\mozilla.org\GRE_1.4a_0000000000_PRIVATE_[Product Name Internal] +GRE Private Key=Software\mozilla.org\GRE_$GreUniqueID$_PRIVATE ; This section contains info on how to send error information in case of ; either a download or xpinstall error. @@ -529,12 +529,13 @@ $InstallSize$:gre $InstallSizeSystem$ $InstallSizeArchive$:gre-win32-installer.zip Attributes=SELECTED|UNCOMPRESS|SUPERSEDE|LAUNCHAPP|INVISIBLE -Parameter=-mmi -ma -app $ProductName$ -app_path "[SETUP PATH]\$MainExeFile$" +;*** LOCALIZE ME BABY *** +Parameter=-mmi -ma -app "$ProductNameInternal$ $UserAgent$" -app_path "[SETUP PATH]\$MainExeFile$" SupersedeType=GRE SupersedeWinReg0=HKEY_LOCAL_MACHINE\Software\mozilla.org\GRE -SupersedeVersion0=1.3.0.0 -SupersedeMinVersion=1.3.0.0 -SupersedeMaxVersion=1.3.0.0 +SupersedeVersion0=$GreFileVersion$ +SupersedeMinVersion= +SupersedeMaxVersion= [Component Navigator] Description Short=Navigator @@ -1004,7 +1005,7 @@ Reg Key Root0=HKEY_LOCAL_MACHINE Product Name0=Mozilla Product Reg Key0=Software\Mozilla.org\Mozilla Current Version0=$UserAgent$ -; + Reg Key Root1=HKEY_CURRENT_USER Product Name1=Mozilla Product Reg Key1=Software\Mozilla.org\Mozilla diff --git a/mozilla/xpinstall/packager/windows/makeall.pl b/mozilla/xpinstall/packager/windows/makeall.pl index 75a67e30456..5d6d4ee7d6a 100644 --- a/mozilla/xpinstall/packager/windows/makeall.pl +++ b/mozilla/xpinstall/packager/windows/makeall.pl @@ -31,12 +31,6 @@ use File::Copy; use File::Path; use File::Basename; -# Make sure there are at least four arguments -if($#ARGV < 3) -{ - PrintUsage(); -} - $DEPTH = "../../.."; $topsrcdir = GetTopSrcDir(); # ensure that Packager.pm is in @INC, since we might not be called from @@ -45,32 +39,14 @@ push(@INC, "$topsrcdir/xpinstall/packager"); require StageUtils; require "$topsrcdir/config/zipcfunc.pl"; -$inDefaultProductVersion = $ARGV[0]; -# $ARGV[0] has the form maj.min.release.bld where maj, min, release -# and bld are numerics representing version information. -# Other variables need to use parts of the version info also so we'll -# split out the dot seperated values into the array @versionParts -# such that: -# -# $versionParts[0] = maj -# $versionParts[1] = min -# $versionParts[2] = release -# $versionParts[3] = bld -@versionParts = split /\./, $inDefaultProductVersion; - -# We allow non-numeric characters to be included as the last -# characters in fields of $ARG[1] for display purposes (mostly to -# show that we have moved past a certain version by adding a '+' -# character). Non-numerics must be stripped out of $inDefaultProductVersion, -# however, since this variable is used to identify the the product -# for comparison with other installations, so the values in each field -# must be numeric only: -$inDefaultProductVersion =~ s/[^0-9.][^.]*//g; -print "The raw version id is: $inDefaultProductVersion\n"; - -# $inDefaultGreVersion is the version that will be used to build GRE. It is -# passed to win_gre/makeall.pl. -$inDefaultGreVersion = $ARGV[1]; +$inDefaultProductVersion = StageUtils::GetProductY2KVersion($topsrcdir, $topsrcdir); +# The mozilla's milestone is the same as the GRE's milestone version. +# initEmptyValues indicates to GetProductMilestoneVersion() whether or not to +# prefill the missing version values with '0's: +# ie: if milestone version is 1.4a +# initEmptyValues dictate whether is should be 1.4a.0.0 or not. +$initEmptyValues = 1; +$inDefaultGreVersion = StageUtils::GetProductMilestoneVersion($topsrcdir, $topsrcdir, $initEmptyValues); $inStagePath = "$topsrcdir/stage"; $inDistPath = "$topsrcdir/dist"; $inXpiURL = "ftp://not.supplied.invalid"; @@ -84,18 +60,46 @@ $seuzFileNameSpecific = "mozillauninstall.zip"; $seiGreFileNameSpecific = "gre-win32-installer.exe"; $seizGreFileNameSpecific = "gre-win32-installer.zip"; +ParseArgv(@ARGV); + +print "\n"; +print " Building Mozilla\n"; +print " Raw version id : $inDefaultProductVersion\n"; + +# $inDefaultProductVersion has the form maj.min.release.bld where maj, min, release +# and bld are numerics representing version information. +# Other variables need to use parts of the version info also so we'll +# split out the dot seperated values into the array @versionParts +# such that: +# +# $versionParts[0] = maj +# $versionParts[1] = min +# $versionParts[2] = release +# $versionParts[3] = bld +@versionParts = split /\./, $inDefaultProductVersion; + +# We allow non-numeric characters to be included as the last +# characters in fields of $inDefaultProductVersion for display purposes (mostly to +# show that we have moved past a certain version by adding a '+' +# character). Non-numerics must be stripped out of $inDefaultProductVersion, +# however, since this variable is used to identify the the product +# for comparison with other installations, so the values in each field +# must be numeric only: +$inDefaultProductVersion =~ s/[^0-9.][^.]*//g; + # set environment vars for use by other .pl scripts called from this script. if($versionParts[2] eq "0") { - $versionMain = "$versionParts[0]\.$versionParts[1]"; + $versionMain = "$versionParts[0].$versionParts[1]"; } else { - $versionMain = "$versionParts[0]\.$versionParts[1]\.$versionParts[2]"; + $versionMain = "$versionParts[0].$versionParts[1].$versionParts[2]"; } -print "The display version is: $versionMain\n"; -ParseArgv(@ARGV); +print " Display version : $versionMain\n"; +print " Xpinstall version: $inDefaultProductVersion\n"; +print "\n"; $gDirPackager = "$topsrcdir/xpinstall/packager"; $gDirStageProduct = "$inStagePath/mozilla"; @@ -103,9 +107,9 @@ $gDirDistInstall = "$inDistPath/install"; $gDirDistInstGre = "$inDistPath/inst_gre"; # Build GRE installer package first before building Mozilla! GRE installer is required by the mozilla installer. -if(system("perl \"$gDirPackager/win_gre/makeall.pl\" $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) +if(system("perl \"$gDirPackager/win_gre/makeall.pl\" -productVer $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) { - die "\n Error: perl \"$gDirPackager/win_gre/makeall.pl\" $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; + die "\n Error: perl \"$gDirPackager/win_gre/makeall.pl\" -productVer $inDefaultGreVersion -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; } # Create the stage area here. @@ -135,10 +139,27 @@ $ENV{WIZ_fileUninstallZip} = $seuzFileNameSpecific; # the installer. $ENV{WIZ_userAgent} = "$versionMain ($versionLanguage)"; $ENV{WIZ_userAgentShort} = "$versionMain"; -$ENV{WIZ_xpinstallVersion} = "$versionMain"; +$ENV{WIZ_xpinstallVersion} = "$inDefaultProductVersion"; $ENV{WIZ_distInstallPath} = "$gDirDistInstall"; +# GetGreFileVersion() will return the actual version of xpcom.dll used by GRE. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre version would be: 1.4.20030.30610 +$ENV{WIZ_greFileVersion} = StageUtils::GetGreFileVersion($topsrcdir); + +# GetGreSpecialID() will return the GRE ID to be used in the windows registry. +# This ID is also the same one being querried for by the mozilla glue code. +# ie: +# given milestone.txt : 1.4a +# given nsBuildID.h : 2003030610 +# gre special ID would be: 1.4a_2003030610 +$ENV{WIZ_greUniqueID} = StageUtils::GetGreSpecialID($topsrcdir); + print "\n"; +print " GRE file version : $ENV{WIZ_greFileVersion}\n"; +print " GRE special version: $ENV{WIZ_greUniqueID}\n"; print "\n"; print " Building $ENV{WIZ_nameProduct} $ENV{WIZ_userAgent}...\n"; print "\n"; @@ -396,16 +417,19 @@ sub MakeExeZip sub PrintUsage { - die "usage: $0 [options] - - default app version: y2k compliant based date version to be used for mozilla. - ie: 5.0.0.2000040413 - - default GRE version: version to be used to build GRE. - ie: 1.3b.0.0 + die "usage: $0 [options] options include: + -productVer : Version of the product. By default it will acquire the + version listed in mozilla/config/milestone.txt and + mozilla/config/nsBuildID.h files. + ie: 1.4a.0.2003030410 + + -greVer : Version of GRE. By default it will acquire the + version listed in mozilla/config/milestone.txt file. + ie: 1.4a.0.0 + -stagePath : full path to where the mozilla components are staged at Default stage path, if this is not set, is: [mozilla]/stage @@ -435,6 +459,22 @@ sub ParseArgv { PrintUsage(); } + elsif($myArgv[$counter] =~ /^[-,\/]productVer$/i) + { + if($#myArgv >= ($counter + 1)) + { + ++$counter; + $inDefaultProductVersion = $myArgv[$counter]; + } + } + elsif($myArgv[$counter] =~ /^[-,\/]greVer$/i) + { + if($#myArgv >= ($counter + 1)) + { + ++$counter; + $inDefaultGreVersion = $myArgv[$counter]; + } + } elsif($myArgv[$counter] =~ /^[-,\/]stagePath$/i) { if($#myArgv >= ($counter + 1)) diff --git a/mozilla/xpinstall/packager/windows/makecfgini.pl b/mozilla/xpinstall/packager/windows/makecfgini.pl index 45710724b4f..faebd2e160e 100644 --- a/mozilla/xpinstall/packager/windows/makecfgini.pl +++ b/mozilla/xpinstall/packager/windows/makecfgini.pl @@ -93,6 +93,8 @@ $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; $fileUninstallZip = $ENV{WIZ_fileUninstallZip}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; $inDomain; $inRedirDomain; @@ -203,6 +205,8 @@ while($line = ) $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; $line =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } } diff --git a/mozilla/xpinstall/packager/windows/makeuninstallini.pl b/mozilla/xpinstall/packager/windows/makeuninstallini.pl index 16f01c17ca5..0cd8a893155 100644 --- a/mozilla/xpinstall/packager/windows/makeuninstallini.pl +++ b/mozilla/xpinstall/packager/windows/makeuninstallini.pl @@ -64,6 +64,8 @@ $nameProduct = $ENV{WIZ_nameProduct}; $nameProductInternal = $ENV{WIZ_nameProductInternal}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; +$greFileVersion = $ENV{WIZ_greFileVersion}; +$greUniqueID = $ENV{WIZ_greUniqueID}; # Get the name of the file replacing the .it extension with a .ini extension @inItFileSplit = split(/\./,$inItFile); @@ -91,6 +93,8 @@ while($line = ) $line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi; $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; + $line =~ s/\$GreFileVersion\$/$greFileVersion/gi; + $line =~ s/\$GreUniqueID\$/$greUniqueID/gi; print fpOutIni $line; } diff --git a/mozilla/xpinstall/packager/windows/xpcom.jst b/mozilla/xpinstall/packager/windows/xpcom.jst index f1d6547e137..10a6d815b60 100644 --- a/mozilla/xpinstall/packager/windows/xpcom.jst +++ b/mozilla/xpinstall/packager/windows/xpcom.jst @@ -1,66 +1,3 @@ -function registerMainKeys(winreg) -{ - var subkey; //the name of the subkey you are poking around in - var err; - - winreg.createKey("SOFTWARE\\$CompanyName$",""); - - subkey = "SOFTWARE\\$CompanyName$\\$ProductName$"; - winreg.createKey(subkey,""); - err = winreg.setValueString(subkey, "CurrentVersion", "$UserAgent$"); - - winreg.createKey("SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$",""); - - subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Main"; - winreg.createKey(subkey,""); - err = winreg.setValueString(subkey, "Install Directory", fProgram); - - subkey = "SOFTWARE\\$CompanyName$\\$ProductName$\\$UserAgent$\\Uninstall"; - winreg.createKey(subkey,""); - err = winreg.setValueString(subkey, "Uninstall Log Folder", szUninstall); - err = winreg.setValueString(subkey, "Description", "$ProductName$ ($UserAgentShort$)"); -} - -function updateWinReg() -{ - //Notes: - // can't use a double backslash before subkey - Windows already puts it in. - // subkeys have to exist before values can be put in. - var winreg = getWinRegistry(); - var subkey; //the name of the subkey you are poking around in - var restrictedAccess; - var ikwDefined; - - if(winreg != null) - { - /* This will check to see if the user has restricted access or not. - * It checks to see if HKEY_LOCALMACHINE\SOFTWARE is writable. If - * it is, then access is not restricted. This is only used to - * determine which Desktop, Programs, and Start Menu folders - * are to used: common or per user - */ - restrictedAccess = false; - ikwDefined = typeof(winreg.isKeyWritable); - logComment("winreg.isKeyWritable(): " + ikwDefined); - if(ikwDefined == "function") - { - winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE); - if(!winreg.isKeyWritable("SOFTWARE")) - restrictedAccess = true; - } - - logComment("restrictedAccess value: " + restrictedAccess); - if(!restrictedAccess) - { - winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE); - registerMainKeys(winreg); - } - - winreg.setRootKey(winreg.HKEY_CURRENT_USER); - registerMainKeys(winreg); - } -} - function upgradeCleanup() { deleteThisFile("Program", "zlib.dll"); @@ -160,8 +97,6 @@ if(verifyDiskSpace(fProgram, srDest)) // check return value if( err == SUCCESS ) { - updateWinReg(); - err = performInstall(); logComment("performInstall() returned: " + err); } diff --git a/mozilla/xpinstall/wizard/windows/builder/build.pl b/mozilla/xpinstall/wizard/windows/builder/build.pl index 7fb8813fe36..37fd10a41b4 100644 --- a/mozilla/xpinstall/wizard/windows/builder/build.pl +++ b/mozilla/xpinstall/wizard/windows/builder/build.pl @@ -55,17 +55,14 @@ ParseArgv(@ARGV); $DEPTH = "$topsrcdir" if !defined($DEPTH); $cwdBuilder = "$topsrcdir/xpinstall/wizard/windows/builder"; -$verPartial = "1.3.0."; -$ver = $verPartial . GetVersion($DEPTH); -$verGre = $verPartial . "0"; $gDistInstallPath = "$inDistPath/install"; $gPackagerPath = "$topsrcdir/xpinstall/packager"; # mozilla's makeall.pl will call GRE's makeall.pl chdir("$gPackagerPath/windows"); -if(system("perl makeall.pl $ver $verGre -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) +if(system("perl makeall.pl -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) { - die "\n Error: perl makeall.pl $ver $verGre -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; + die "\n Error: perl makeall.pl -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; } chdir($cwdBuilder); diff --git a/mozilla/xpinstall/wizard/windows/builder/build_gre.pl b/mozilla/xpinstall/wizard/windows/builder/build_gre.pl index a26bed2937e..66b84d9ee27 100644 --- a/mozilla/xpinstall/wizard/windows/builder/build_gre.pl +++ b/mozilla/xpinstall/wizard/windows/builder/build_gre.pl @@ -55,20 +55,14 @@ ParseArgv(@ARGV); $DEPTH = "$topsrcdir" if !defined($DEPTH); $cwdBuilder = "$topsrcdir/xpinstall/wizard/windows/builder"; -$verPartial = "1.3b.0."; -$ver = $verPartial . GetVersion($DEPTH); $stageDir = "$topsrcdir/stage"; $gDistInstallPath = "$inDistPath/inst_gre"; $gPackagerPath = "$topsrcdir/xpinstall/packager"; -print "\n"; -print " Building GRE...\n"; -print "\n"; - chdir("$gPackagerPath/win_gre"); -if(system("perl makeall.pl $ver -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) +if(system("perl makeall.pl -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) { - die "\n Error: perl makeall.pl $ver -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; + die "\n Error: perl makeall.pl -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; } chdir($cwdBuilder); diff --git a/mozilla/xpinstall/wizard/windows/builder/build_mfcembed.pl b/mozilla/xpinstall/wizard/windows/builder/build_mfcembed.pl index 21017a1c937..7f8174489fd 100644 --- a/mozilla/xpinstall/wizard/windows/builder/build_mfcembed.pl +++ b/mozilla/xpinstall/wizard/windows/builder/build_mfcembed.pl @@ -54,16 +54,13 @@ ParseArgv(@ARGV); $DEPTH = "$topsrcdir" if !defined($DEPTH); $builderPath = "$topsrcdir/xpinstall/wizard/windows/builder"; -$verPartial = "1.0.0."; -$ver = $verPartial . GetVersion($DEPTH); -$verGre = "1.3b.0." . GetVersion($DEPTH); $gDistInstallPath = "$inDistPath/inst_mfcembed"; $gPackagerPath = "$topsrcdir/xpinstall/packager"; chdir("$gPackagerPath/win_mfcembed"); -if(system("perl \"$gPackagerPath/win_mfcembed/makeall.pl\" $ver $verGre -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) +if(system("perl \"$gPackagerPath/win_mfcembed/makeall.pl\" -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL")) { - die "\n Error: perl \"$gPackagerPath/win_mfcembed/makeall.pl\" $ver $verGre -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; + die "\n Error: perl \"$gPackagerPath/win_mfcembed/makeall.pl\" -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n"; } chdir($builderPath); diff --git a/mozilla/xpinstall/wizard/windows/setup/dialogs.c b/mozilla/xpinstall/wizard/windows/setup/dialogs.c index 6f4dd20234f..211d2de3026 100644 --- a/mozilla/xpinstall/wizard/windows/setup/dialogs.c +++ b/mozilla/xpinstall/wizard/windows/setup/dialogs.c @@ -2940,11 +2940,6 @@ void CommitInstall(void) * GRE path. */ //AddGrePathToApplicationAppPathsKey(); - /* POST_LAUNCHAPP process file manipulation functions */ - ProcessFileOpsForAll(T_POST_LAUNCHAPP); - /* DEPEND_REBOOT process file manipulation functions */ - ProcessFileOpsForAll(T_DEPEND_REBOOT); - // Refresh system icons if necessary if(gSystemInfo.bRefreshIcons) RefreshIcons(); @@ -2956,6 +2951,11 @@ void CommitInstall(void) CleanupArgsRegistry(); CleanupPreviousVersionRegKeys(); + + /* POST_LAUNCHAPP process file manipulation functions */ + ProcessFileOpsForAll(T_POST_LAUNCHAPP); + /* DEPEND_REBOOT process file manipulation functions */ + ProcessFileOpsForAll(T_DEPEND_REBOOT); } CleanupXpcomFile(); diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.c b/mozilla/xpinstall/wizard/windows/setup/extra.c index d2f64cdd056..083cc0e63e1 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.c +++ b/mozilla/xpinstall/wizard/windows/setup/extra.c @@ -6180,10 +6180,6 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) if (sgProduct.szProductNameInternal[0] == 0) lstrcpy(sgProduct.szProductNameInternal, sgProduct.szProductName); - /* this is a default value so don't change it if it has already been set */ - if (sgProduct.szRegPath[0] == 0) - wsprintf(sgProduct.szRegPath, "Software\\%s\\%s", sgProduct.szCompanyName, sgProduct.szProductNameInternal); - GetPrivateProfileString("General", "Product Name Previous", "", sgProduct.szProductNamePrevious, MAX_BUF, szFileIniConfig); GetPrivateProfileString("General", "Uninstall Filename", "", sgProduct.szUninstallFilename, MAX_BUF, szFileIniConfig); GetPrivateProfileString("General", "User Agent", "", sgProduct.szUserAgent, MAX_BUF, szFileIniConfig); @@ -6193,6 +6189,10 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) if(lstrcmpi(szBuf, "TRUE") == 0) sgProduct.bLockPath = TRUE; + /* this is a default value so don't change it if it has already been set */ + if (sgProduct.szRegPath[0] == 0) + wsprintf(sgProduct.szRegPath, "Software\\%s\\%s\\%s", sgProduct.szCompanyName, sgProduct.szProductNameInternal, sgProduct.szUserAgent); + gbRestrictedAccess = VerifyRestrictedAccess(); if(gbRestrictedAccess) {