r=chase
Make packager understand OSes other than Windows
This commit is contained in:
mkaply%us.ibm.com 2005-09-22 21:51:47 +00:00
Родитель 30e32ce6e5
Коммит 0b2277f8b3
4 изменённых файлов: 47 добавлений и 343 удалений

Просмотреть файл

@ -1,259 +0,0 @@
#!c:\perl\bin\perl -w
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# 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 Communicator.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corp.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# This script is used to create the stage area given a product. This script is
# used in conjunction with the stage_[product name].pl files.
# This script will load the stage_[product name].pl and call its StageProduct()
# function. Stage_[product name].pl will do the actual creation of the stage
# area.
use Cwd;
use File::Copy;
use File::Path;
use File::Basename;
use IO::Handle;
$DEPTH = "../../";
$gDirScripts = dirname($0); # directory of the running script
$gDirScripts =~ s/\\/\//g;
$gDirCwd = cwd();
# ensure that Packager.pm is in @INC, since we might not be called from
# mozilla/xpinstall/packager
push(@INC, $gDirScripts);
require StageUtils;
$gOsPkg = undef;
$inProductName = undef;
$inStagingScript = undef;
$inOs = undef;
ParseArgV(@ARGV);
if(!defined($topobjdir))
{
chdir($DEPTH);
$topobjdir = cwd();
chdir($gDirCwd);
}
$inDirDestStage = "$topobjdir/stage" if !defined($inDirDestStage);
$inDirSrcDist = "$topobjdir/dist" if !defined($inDirSrcDist);
if(defined($ENV{DEBUG_INSTALLER_BUILD}))
{
print "\n make_stage.pl\n";
print " topobjdir : $topobjdir\n";
print " gDirCwd : $gDirCwd\n";
print " inDirDestStage: $inDirDestStage\n";
print " inDirSrcDist : $inDirSrcDist\n";
}
if(!$inProductName || !$inOs)
{
PrintUsage();
}
if($inOs =~ /^win$/i)
{
$gOsPkg = "dos";
}
else
{
$gOsPkg = $inOs;
}
if(!$inStagingScript)
{
# Look for the stage script in cwd first, then look at the
# mozilla/xpinstall/packager dir.
$inStagingScript = "$gDirCwd/stage_$inProductName.pl";
}
if(-e $inStagingScript)
{
require "$inStagingScript";
}
else
{
# Look in mozilla/xpinstall/packager dir since the stage script
# was not found in cwd.
$inStagingScript = "$gDirScripts/stage_$inProductName.pl";
if(-e $inStagingScript)
{
require "$inStagingScript";
}
else
{
die "\n Could not locate stage_$inProductName.pl in:
$gDirCwd
$gDirScripts
\n";
}
}
# This is where the stage area is actually created.
&StageProduct($inDirSrcDist, $inDirDestStage, $inProductName, $gOsPkg);
chdir($gDirCwd);
exit(0);
sub ParseArgV
{
my(@myArgv) = @_;
my($counter);
for($counter = 0; $counter <= $#myArgv; $counter++)
{
if($myArgv[$counter] =~ /^[-,\/]h$/i)
{
PrintUsage();
}
elsif($myArgv[$counter] =~ /^[-,\/]objDir$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
$topobjdir = $myArgv[$counter];
$topobjdir =~ s/\\/\//g;
}
}
elsif($myArgv[$counter] =~ /^[-,\/]dd$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
$inDirSrcDist = $myArgv[$counter];
$inDirSrcDist =~ s/\\/\//g;
}
}
elsif($myArgv[$counter] =~ /^[-,\/]sd$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
$inDirDestStage = $myArgv[$counter];
$inDirDestStage =~ s/\\/\//g;
}
}
elsif($myArgv[$counter] =~ /^[-,\/]pn$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
$inProductName = $myArgv[$counter];
}
}
elsif($myArgv[$counter] =~ /^[-,\/]ss$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
$inStagingScript = $myArgv[$counter];
$inStagingScript =~ s/\\/\//g;
}
}
elsif($myArgv[$counter] =~ /^[-,\/]os$/i)
{
if($#myArgv >= ($counter + 1))
{
++$counter;
if(($myArgv[$counter] =~ /^win$/i) ||
($myArgv[$counter] =~ /^mac$/i) ||
($myArgv[$counter] =~ /^unix$/i))
{
$inOs = $myArgv[$counter];
}
}
}
}
}
sub PrintUsage
{
die "\n usage: $0 [options]
-h
Print this usage.
-dd [dist dir]
Directory for where the dist dir is at:
ie: $0 -dd c:/builds/output/dist
By default if '-dd' is not used, the dist dir is at:
[mozilla root]/dist
This path should contain both dist/bin and dist/packages
*** NOTE ***
The [dist dir] *cannot* be the parent dir of [stage dir].
This will cause copy problems during the stage dir
creation.
-sd [stage dir]
Optional stage directory:
ie: $0 -sd c:/builds/output/stage
By default if '-sd' is not used, the stage dir will be created at:
[mozilla root]/stage
*** NOTE ***
The [stage dir] *cannot* be a subdir of [dist dir].
This will cause copy problems during the stage dir
creation.
-ss [product's staging script]
Full path to the script used to create the staging area for the
product.
ie: c:/builds/mozilla/xpinstall/packager/stage_mozilla.pl
* -pn [product name]
Product name to create the stage dir under.
ie: [stage dir]/[product name]
Currently, supported products are:
gre
mozilla
* -os
win, mac, unix
'*' indicates required parameters.
\n";
}

Просмотреть файл

@ -41,28 +41,42 @@ return(1);
sub StageProduct sub StageProduct
{ {
my($aDirSrcDist, $aDirStage, $aProductName, $aOsPkg) = @_; my($aDirSrcDist, $aDirStage, $aProductName, $aInOs) = @_;
my($dirDistPackagesProductName) = "$aDirSrcDist/packages/$aProductName"; my($dirDistPackagesProductName) = "$aDirSrcDist/packages/$aProductName";
my($dirStageProductName) = "$aDirStage/$aProductName"; my($dirStageProductName) = "$aDirStage/$aProductName";
my($dirMozRoot) = StageUtils::GetAbsPath("moz_root"); my($dirMozRoot) = StageUtils::GetAbsPath("moz_root");
my($dirMozPackager) = StageUtils::GetAbsPath("moz_packager"); my($dirMozPackager) = StageUtils::GetAbsPath("moz_packager");
my($osPkg);
my($osPkgFile);
if($aInOs =~ /^win$/i)
{
$osPkg = "dos";
$osPkgFile = "win";
}
else
{
$osPkg = $aInOs;
$osPkgFile = $aInOs;
}
StageUtils::CleanupStage($aDirStage, $aProductName); StageUtils::CleanupStage($aDirStage, $aProductName);
StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName); StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-win.pkg", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-$osPkgFile.pkg", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/basebrowser-installer-win.pkg", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/basebrowser-installer-$osPkgFile.pkg", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/gre-installer-win.pkg", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/gre-installer-$osPkgFile.pkg", $dirDistPackagesProductName);
mkdir("$aDirStage", 0775) if (!(-e "$aDirStage")); mkdir("$aDirStage", 0775) if (!(-e "$aDirStage"));
mkdir("$aDirStage/$aProductName", 0775) if (!(-e "$aDirStage/$aProductName")); mkdir("$aDirStage/$aProductName", 0775) if (!(-e "$aDirStage/$aProductName"));
mkdir("$aDirStage/$aProductName/gre", 0775) if (!(-e "$aDirStage/$aProductName/gre")); mkdir("$aDirStage/$aProductName/gre", 0775) if (!(-e "$aDirStage/$aProductName/gre"));
# Call pkgcp.pl on each of the package list # Call pkgcp.pl on each of the package list
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/xpcom-win.pkg\" -o $aOsPkg -v"); system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/xpcom-$osPkgFile.pkg\" -o $osPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/gre\" -f \"$dirDistPackagesProductName/basebrowser-installer-win.pkg\" -o $aOsPkg -v"); system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/gre\" -f \"$dirDistPackagesProductName/basebrowser-installer-$osPkgFile.pkg\" -o $osPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/gre\" -f \"$dirDistPackagesProductName/gre-installer-win.pkg\" -o $aOsPkg -v"); system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/gre\" -f \"$dirDistPackagesProductName/gre-installer-$osPkgFile.pkg\" -o $osPkg -v");
# consolidate the .xpt files for each xpi into one file # consolidate the .xpt files for each xpi into one file
system("perl \"$dirMozPackager/xptlink.pl\" --source \"$aDirSrcDist\" --destination \"$dirStageProductName\" -o $aOsPkg --verbose"); system("perl \"$dirMozPackager/xptlink.pl\" --source \"$aDirSrcDist\" --destination \"$dirStageProductName\" -o $osPkg --verbose");
} }

Просмотреть файл

@ -1,69 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# 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 Communicator.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corp.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# It is required to return(1) so that the parent script performing a "require()"
# on this file does not think that it failed.
return(1);
sub StageProduct
{
my($aDirSrcDist, $aDirStage, $aProductName, $aOsPkg) = @_;
my($dirDistPackagesProductName) = "$aDirSrcDist/packages/$aProductName";
my($dirStageProductName) = "$aDirStage/$aProductName";
my($dirMozRoot) = StageUtils::GetAbsPath("moz_root");
my($dirMozPackager) = StageUtils::GetAbsPath("moz_packager");
StageUtils::CleanupStage($aDirStage, $aProductName);
StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-win.pkg", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win-supp", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/basebrowser-win-supp", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/gre-win-supp", $dirDistPackagesProductName);
mkdir("$aDirStage", 0775) if (!(-e "$aDirStage"));
mkdir("$aDirStage/$aProductName", 0775) if (!(-e "$aDirStage/$aProductName"));
mkdir("$aDirStage/$aProductName/mfcembed", 0775) if (!(-e "$aDirStage/$aProductName/mfcembed"));
# Call pkgcp.pl on each of the package list
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/xpcom-win.pkg\" -o $aOsPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win\" -o $aOsPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/gre_app_support\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win-supp\" -o $aOsPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/basebrowser-win-supp\" -o $aOsPkg -v");
system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/gre-win-supp\" -o $aOsPkg -v");
}

Просмотреть файл

@ -41,7 +41,7 @@ return(1);
sub StageProduct sub StageProduct
{ {
my($aDirSrcDist, $aDirStage, $aProductName, $aOsPkg) = @_; my($aDirSrcDist, $aDirStage, $aProductName, $aInOs) = @_;
my($dirDistPackagesProductName) = "$aDirSrcDist/packages/$aProductName"; my($dirDistPackagesProductName) = "$aDirSrcDist/packages/$aProductName";
my($dirStageProductName) = "$aDirStage/$aProductName"; my($dirStageProductName) = "$aDirStage/$aProductName";
my($dirMozRoot) = StageUtils::GetAbsPath("moz_root"); my($dirMozRoot) = StageUtils::GetAbsPath("moz_root");
@ -53,24 +53,42 @@ sub StageProduct
print " aDirSrcDist : $aDirSrcDist\n"; print " aDirSrcDist : $aDirSrcDist\n";
print " aDirStage : $aDirStage\n"; print " aDirStage : $aDirStage\n";
print " aProductName : $aProductName\n"; print " aProductName : $aProductName\n";
print " aOsPkg : $aOsPkg\n"; print " aInOs : $aInOs\n";
print " dirDistPackagesProductName : $dirDistPackagesProductName\n"; print " dirDistPackagesProductName : $dirDistPackagesProductName\n";
print " dirStageProductName : $dirStageProductName\n"; print " dirStageProductName : $dirStageProductName\n";
print " dirMozRoot : $dirMozRoot\n"; print " dirMozRoot : $dirMozRoot\n";
print " dirMozPackager : $dirMozPackager\n"; print " dirMozPackager : $dirMozPackager\n";
} }
my($osPkg);
my($osPkgFile);
if($aInOs =~ /^win$/i)
{
$osPkg = "dos";
$osPkgFile = "win";
}
elsif($aInOs =~ /^os2$/i)
{
$osPkg = "dos";
$osPkgFile = "os2";
}
else
{
$osPkg = $aInOs;
$osPkgFile = $aInOs;
}
StageUtils::CleanupStage($aDirStage, $aProductName); StageUtils::CleanupStage($aDirStage, $aProductName);
StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName); StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-win.pkg", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-$osPkgFile.pkg", $dirDistPackagesProductName);
StageUtils::CopyAdditionalPackage("$dirMozPackager/packages-win", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozPackager/packages-$osPkgFile", $dirDistPackagesProductName);
# StageUtils::GeneratePackagesFromSinglePackage($inOs, "$dirMozPackager/packages-win", $dirDistPackagesProductName); # StageUtils::GeneratePackagesFromSinglePackage($inOs, "$dirMozPackager/packages-win", $dirDistPackagesProductName);
# Call CreateStage() to create the aProductName stage dir using the packages # Call CreateStage() to create the aProductName stage dir using the packages
# in dist/packages. # in dist/packages.
StageUtils::CreateStage($aDirSrcDist, $dirStageProductName, $dirDistPackagesProductName, $aOsPkg); StageUtils::CreateStage($aDirSrcDist, $dirStageProductName, $dirDistPackagesProductName, $osPkg);
# consolidate the .xpt files for each xpi into one file # consolidate the .xpt files for each xpi into one file
system("perl \"$dirMozPackager/xptlink.pl\" --source \"$aDirSrcDist\" --destination \"$dirStageProductName\" -o $aOsPkg --verbose"); system("perl \"$dirMozPackager/xptlink.pl\" --source \"$aDirSrcDist\" --destination \"$dirStageProductName\" -o $osPkg --verbose");
} }