Bug 570689 - Convert perl scripts to python. Patch 1 - remove unused perl scripts. r=ted.mielczarek

This commit is contained in:
Robert Strong 2010-06-22 19:10:30 -07:00
Родитель 4e5e5e9639
Коммит 22683bd184
4 изменённых файлов: 0 добавлений и 615 удалений

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

@ -1,133 +0,0 @@
#!/usr/bin/perl
#
# ***** 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.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Samir Gehani <sgehani@netscape.com>
# Benjamin Smedberg <benjamin@smedbergs.us>
#
# 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 *****
# Initialize global installer environment variables. This information comes
# from the application's installer.cfg file which specifies such things as name
# and installer executable file names.
package CFGParser;
sub ParseInstallerCfg
{
my ($cfgFile) = @_;
$ENV{WIZ_distSubdir} = "bin";
$ENV{WIZ_packagesFile} = "packages-static";
open(fpInstallCfg, $cfgFile) || die"\ncould not open $cfgFile: $!\n";
while ($line = <fpInstallCfg>)
{
if (substr($line, -2, 2) eq "\r\n") {
$line = substr($line, 0, length($line) - 2) . "\n";
}
($prop, $value) = ($line =~ m/(\w*)\s+=\s+(.*)\n/);
if ($prop eq "VersionLanguage") {
$ENV{WIZ_versionLanguage} = $value;
}
elsif ($prop eq "NameCompany") {
$ENV{WIZ_nameCompany} = $value;
}
elsif ($prop eq "NameProduct") {
$ENV{WIZ_nameProduct} = $value;
}
elsif ($prop eq "ShortNameProduct") {
$ENV{WIZ_shortNameProduct} = $value;
}
elsif ($prop eq "NameProductInternal") {
$ENV{WIZ_nameProductInternal} = $value;
}
elsif ($prop eq "VersionProduct") {
$ENV{WIZ_versionProduct} = $value;
}
elsif ($prop eq "FileInstallerEXE") {
$ENV{WIZ_fileInstallerExe} = $value;
}
elsif ($prop eq "FileMainEXE") {
$ENV{WIZ_fileMainExe} = $value;
}
elsif ($prop eq "FileInstallerNETRoot") {
$ENV{WIZ_fileNetStubRootName} = $value;
}
elsif ($prop eq "ComponentList") {
$ENV{WIZ_componentList} = $value;
}
elsif ($prop eq "7ZipSFXModule") {
$ENV{WIZ_sfxModule} = $value;
}
elsif ($prop eq "DistSubdir") {
$ENV{WIZ_distSubdir} = $value;
}
elsif ($prop eq "packagesFile") {
$ENV{WIZ_packagesFile} = $value;
}
elsif ($prop eq "GREVersion") {
$ENV{WIZ_greVersion} = $value;
}
elsif ($prop eq "LicenseFile") {
$ENV{WIZ_licenseFile} = $value;
}
}
close(fpInstallCfg);
# $gDefaultProductVersion 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 separated values into the array @versionParts
# such that:
#
# $versionParts[0] = maj
# $versionParts[1] = min
# $versionParts[2] = release
# $versionParts[3] = bld
@versionParts = split /\./, $ENV{WIZ_versionProduct};
if($versionParts[2] eq "0" || $versionParts[2] == "") {
$versionMain = "$versionParts[0].$versionParts[1]";
}
else {
$versionMain = "$versionParts[0].$versionParts[1].$versionParts[2]";
}
$ENV{WIZ_userAgentShort} = "$versionMain";
}
1;

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

@ -1,59 +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 Firefox installer build scripts.
#
# The Initial Developer of the Original Code is
# Benjamin Smedberg <benjamin@smedbergs.us>
#
# Portions created by the Initial Developer are Copyright (C) 2005
# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
#
# Contributor(s):
#
# 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 *****
# Read a removed-files manifest and create a set of
# deleteThisFile/deleteThisFolder instructions suitable for an install.js
# script. This simply processes <> to stdout.
print "function removeOldFiles() {\n";
while (<>) {
m|^\s*(\S+)\s*$|;
my $file = $1;
next if ($file eq "");
if ($file =~ m|/$|) {
chop $file;
print " deleteThisFolder(\"Program\", \"$file\");\n";
}
else {
print " deleteThisFile(\"Program\", \"$file\");\n";
}
}
print "}\n";

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

@ -1,364 +0,0 @@
#!c:\perl\bin\perl
#
# ***** 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 client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Sean Su <ssu@netscape.com>
# Howard Chu <hyc@symas.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 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
#
# version
# - version to display on the blue background
#
# Path to staging area
# - path on where the seamonkey built bits are staged to
#
# xpi path
# - path on where xpi files will be located at
#
# redirect file url
# - url to where the redirect.ini file will be staged at.
# Either ftp:// or http:// can be used
# ie: ftp://ftp.netscape.com/pub/seamonkey
#
# xpi url
# - url to where the .xpi files will be staged at.
# Either ftp:// or http:// can be used
# ie: ftp://ftp.netscape.com/pub/seamonkey/xpi
#
# ie: perl makecfgini.pl config.it 5.0.0.1999120608 k:\windows\32bit\5.0 d:\builds\mozilla\dist\win32_o.obj\install\xpi ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10 ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10/xpi
#
#
# Make sure there are at least two arguments
if($#ARGV < 5)
{
die "usage: $0 <.it file> <version> <staging path> <.xpi path> <redirect file url> <xpi url>
.it file : input ini template file
version : version to be shown in setup. Typically the same version
as show in mozilla.exe.
staging path : path to where the components are staged at
.xpi path : path to where the .xpi files have been built to
ie: d:/builds/mozilla/dist/win32_o.obj/install/xpi
redirect file : url to where the redirect.ini file will be staged at.
xpi url : url to where the .xpi files will be staged at.
Either ftp:// or http:// can be used
ie: ftp://ftp.netscape.com/pub/seamonkey/xpi
\n";
}
$inItFile = $ARGV[0];
$inVersion = $ARGV[1];
$inStagePath = $ARGV[2];
$inXpiPath = $ARGV[3];
$inRedirIniUrl = $ARGV[4];
$inUrl = $ARGV[5];
# get environment vars
$userAgent = $ENV{WIZ_userAgent};
$userAgentShort = $ENV{WIZ_userAgentShort};
$xpinstallVersion = $ENV{WIZ_xpinstallVersion};
$nameCompany = $ENV{WIZ_nameCompany};
$nameProduct = $ENV{WIZ_nameProduct};
$shortNameProduct = $ENV{WIZ_shortNameProduct};
$nameProductInternal = $ENV{WIZ_nameProductInternal};
$fileMainExe = $ENV{WIZ_fileMainExe};
$greBuildID = $ENV{WIZ_greBuildID};
$greFileVersion = $ENV{WIZ_greFileVersion};
$greUniqueID = $ENV{WIZ_greUniqueID};
$inDomain;
$inRedirDomain;
$inServerPath;
$inRedirServerPath;
($inDomain, $inServerPath) = ParseDomainAndPath($inUrl);
($inRedirDomain, $inRedirServerPath) = ParseDomainAndPath($inRedirIniUrl);
# 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];
if (substr($componentName, -2, 2) eq "\r\n") {
$componentName = substr($componentName, 0, length($componentName) - 2) . "\n";
}
else {
chop($componentName);
}
$installSize = OutputInstallSize("$inStagePath/$componentName");
if($componentName =~ /gre/i)
{
$installSize = int($installSize * 4.48);
}
}
# 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";
}
elsif($line =~ /\$InstallSizeArchive\$/i)
{
$installSizeArchive = 0;
# split read line by ":" deliminator
@colonSplit = split(/:/, $line);
if($#colonSplit >= 0)
{
$componentName = $colonSplit[1];
if (substr($componentName, -2, 2) eq "\r\n") {
$componentName = substr($componentName, 0, length($componentName) - 2) . "\n";
}
else {
chop($componentName);
}
$installSizeArchive = OutputInstallSizeArchive("$inXpiPath/$componentName");
}
print fpOutIni "Install Size Archive=$installSizeArchive\n";
}
elsif($line =~ /\$FileCount\$/i)
{
if (!($componentName eq ""))
{
$stageDir = "$inStagePath/$componentName";
$stageDir =~ s/(.xpi|.zip)\b//i;
if (substr($stageDir, -1, 1) eq "\n") {
chop($stageDir);
}
$fileCount = `find $stageDir -type f | wc -l`;
if (substr($fileCount, -1, 1) eq "\n") {
chop($fileCount);
}
$line =~ s/\$FileCount\$/$fileCount/i;
print fpOutIni $line;
}
}
else
{
# For each line read, search and replace $Version$ with the version passed in
$line =~ s/\$Version\$/$inVersion/gi;
$line =~ s/\$Domain\$/$inDomain/gi;
$line =~ s/\$ServerPath\$/$inServerPath/gi;
$line =~ s/\$RedirIniUrl\$/$inRedirIniUrl/gi;
$line =~ s/\$ArchiveServerPath\$/$inServerPath/gi;
$line =~ s/\$ArchiveUrl\$/$inUrl/gi;
$line =~ s/\$RedirectServerPath\$/$inRedirServerPath/gi;
$line =~ s/\$RedirectUrl\$/$inRedirUrl/gi;
$line =~ s/\$UserAgent\$/$userAgent/gi;
$line =~ s/\$UserAgentShort\$/$userAgentShort/gi;
$line =~ s/\$XPInstallVersion\$/$xpinstallVersion/gi;
$line =~ s/\$CompanyName\$/$nameCompany/gi;
$line =~ s/\$ProductName\$/$nameProduct/gi;
$line =~ s/\$ProductNameInternal\$/$nameProductInternal/gi;
$line =~ s/\$ProductShortName\$/$shortNameProduct/gi;
$line =~ s/\$MainExeFile\$/$fileMainExe/gi;
$line =~ s/\$GreBuildID\$/$greBuildID/gi;
$line =~ s/\$GreFileVersion\$/$greFileVersion/gi;
$line =~ s/\$GreUniqueID\$/$greUniqueID/gi;
print fpOutIni $line;
}
}
print " done!\n";
# end of script
exit(0);
sub ParseDomainAndPath()
{
my($aUrl) = @_;
my($aDomain, $aServerPath);
@slashSplit = split(/\//, $aUrl);
if($#slashSplit >= 0)
{
for($i = 0; $i <= $#slashSplit; $i++)
{
if($i <= 2)
{
if($aDomain eq "")
{
$aDomain = "$slashSplit[$i]";
}
else
{
$aDomain = "$aDomain/$slashSplit[$i]";
}
}
else
{
if($aServerPath eq "")
{
$aServerPath = "/$slashSplit[$i]";
}
else
{
$aServerPath = "$aServerPath/$slashSplit[$i]";
}
}
}
}
return($aDomain, $aServerPath);
}
sub OutputInstallSize()
{
my($inPath) = @_;
my($installSize);
print " calculating size for $inPath\n";
my ($inPathWin);
if($^O =~ msys)
{
$inPathWin = $inPath;
} else {
$inPathWin = `cygpath -wa $inPath`;
chomp($inPathWin);
$inPathWin =~ s/\\/\\\\/g;
}
$installSize = `$ENV{WIZ_distInstallPath}/ds32.exe -D -L0 -A -S -C 32768 $inPathWin`;
$installSize += 32768; # take into account install.js
$installSize = int($installSize / 1024);
$installSize += 1;
return($installSize);
}
sub OutputInstallSizeArchive()
{
my($inPath) = @_;
my($installSizeArchive);
my($dev, $ino, $mode, $nlink, $uid, $gui, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks);
print " calculating size for $inPath\n";
($dev, $ino, $mode, $nlink, $uid, $gui, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $inPath;
$installSizeArchive += 32768; # take into account install.js
$installSizeArchive = int($size / 1024);
$installSizeArchive += 1;
return($installSizeArchive);
}
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 " calculating size for $inPath/$_";
$installSizeSystem += `$ENV{WIZ_distInstallPath}/ds32.exe /D /L0 /A /S /C 32768 $inPath/$_`;
}
}
}
$installSizeSystem = int($installSizeSystem / 1024);
$installSizeSystem += 1;
return($installSizeSystem);
}
sub ParseUserAgentShort()
{
my($aUserAgent) = @_;
my($aUserAgentShort);
@spaceSplit = split(/ /, $aUserAgent);
if($#spaceSplit >= 0)
{
$aUserAgentShort = $spaceSplit[0];
}
return($aUserAgentShort);
}

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

@ -1,59 +0,0 @@
#!/usr/bin/perl
#
# ***** 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.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Samir Gehani <sgehani@netscape.com>
# Benjamin Smedberg <benjamin@smedbergs.us>
#
# 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 *****
use File::Basename;
die ("Usage: $0 <cfgFile> <itFile>") if (scalar(@ARGV) != 2);
my ($cfgFile, $itFile) = @ARGV;
# ensure that CFGParser.pm is in @INC, since we might not be called from
# mozilla/toolkit/mozapps/installer
my $top_path = $0;
$top_path =~ s/\\/\//g if $win32;
$top_path = dirname($top_path);
push(@INC, $top_path);
require CFGParser;
CFGParser::ParseInstallerCfg($cfgFile);
system("perl $top_path/makecfgini.pl $itFile $ENV{WIZ_versionProduct} . . ftp://not.supplied.invalid ftp://not.supplied.invalid") == 0 ||
die("Could not create ini file.");