Bug 299930 - Need nsIXULAppInfo.platformVersion, r=darin a=asa

This commit is contained in:
bsmedberg%covad.net 2005-07-14 20:29:06 +00:00
parent 95bb62374b
commit 67cd236a1d
10 changed files with 72 additions and 102 deletions

View File

@ -42,6 +42,7 @@ use vars qw($officialMilestone
local $Moz::Milestone::milestone;
local $Moz::Milestone::officialMilestone;
local $Moz::Milestone::milestoneEM;
#
# Usage: getOfficialMilestone($milestoneFile)
@ -52,19 +53,34 @@ sub getOfficialMilestone($) {
open(FILE,"$mfile") ||
die ("Can't open $mfile for reading!");
my $num = <FILE>;
while($num =~ /^\s*#/ || $num !~ /^\d/) {
$num = <FILE>;
while (defined(my $line = <FILE>)) {
if ($line =~ /^MILESTONE=(\S+)/) {
my $num = $1;
$Moz::Milestone::officialMilestone = $num;
$Moz::Milestone::milestone = &getMilestoneNum;
close FILE;
return $num;
}
}
close(FILE);
if ($num !~ /^\d/) { return; }
chomp($num);
# Remove extra ^M caused by using dos-mode line-endings
chop $num if (substr($num, -1, 1) eq "\r");
$Moz::Milestone::officialMilestone = $num;
$Moz::Milestone::milestone = &getMilestoneNum;
return $num;
close FILE;
}
sub getEMMilestone($) {
my $mfile = $_[0];
open(FILE,"$mfile") ||
die ("Can't open $mfile for reading!");
while (defined(my $line = <FILE>)) {
if ($line =~ /^MILESTONE_EM=(\S+)/) {
my $num = $1;
$Moz::Milestone::milestoneEM = $num;
close FILE;
return $num;
}
}
close FILE;
}
#
@ -82,9 +98,7 @@ sub getMilestoneNum {
$Moz::Milestone::milestone = $_[0];
}
if ($Moz::Milestone::milestone =~ /\+$/) { # for x.x.x+, strip off the +
$Moz::Milestone::milestone =~ s/\+$//;
}
$Moz::Milestone::milestone =~ s/\+$//;
return $Moz::Milestone::milestone;
}
@ -106,69 +120,6 @@ sub getMilestoneQualifier {
}
}
sub getMilestoneMajor {
my $milestoneMajor;
if (defined($Moz::Milestone::milestone)) {
$milestoneMajor = $Moz::Milestone::milestone;
} else {
$milestoneMajor = $_[0];
}
my @parts = split(/\./,$milestoneMajor);
return $parts[0];
}
sub getMilestoneMinor {
my $milestoneMinor;
if (defined($Moz::Milestone::milestone)) {
$milestoneMinor = $Moz::Milestone::milestone;
} else {
$milestoneMinor = $_[0];
}
my @parts = split(/\./,$milestoneMinor);
if ($#parts < 1 ) { return 0; }
return $parts[1];
}
sub getMilestoneMini {
my $milestoneMini;
if (defined($Moz::Milestone::milestone)) {
$milestoneMini = $Moz::Milestone::milestone;
} else {
$milestoneMini = $_[0];
}
my @parts = split(/\./,$milestoneMini);
if ($#parts < 2 ) { return 0; }
return $parts[2];
}
sub getMilestoneMicro {
my $milestoneMicro;
if (defined($Moz::Milestone::milestone)) {
$milestoneMicro = $Moz::Milestone::milestone;
} else {
$milestoneMicro = $_[0];
}
my @parts = split(/\./,$milestoneMicro);
if ($#parts < 3 ) { return 0; }
return $parts[3];
}
sub getMilestoneAB {
my $milestoneAB;
if (defined($Moz::Milestone::milestone)) {
$milestoneAB = $Moz::Milestone::milestone;
} else {
$milestoneAB = $_[0];
}
if ($milestoneAB =~ /a/) { return "alpha"; }
if ($milestoneAB =~ /b/) { return "beta"; }
return "final";
}
#
# build_file($template_file,$output_file)
#

View File

@ -52,6 +52,7 @@ use vars qw(
$opt_debug
$opt_template
$opt_help
$emversion
);
$SCRIPTDIR = $0;
@ -60,7 +61,7 @@ push(@INC,$SCRIPTDIR);
require "Moz/Milestone.pm";
&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template');
&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'emversion' => \$emversion, 'debug', 'help', 'template');
if (defined($opt_help)) {
&usage();
@ -80,11 +81,6 @@ if (!defined($OBJDIR)) { $OBJDIR = '.'; }
$MILESTONE_FILE = "$TOPSRCDIR/config/milestone.txt";
@MILESTONE_PARTS = (0, 0, 0, 0);
#
# Grab milestone (top line of $MILESTONE_FILE that starts with a digit)
#
my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE);
if (defined(@TEMPLATE_FILE)) {
my $TFILE;
@ -101,12 +97,16 @@ if (defined(@TEMPLATE_FILE)) {
}
}
} else {
print "$milestone\n";
if ($emversion) {
print Moz::Milestone::getEMMilestone($MILESTONE_FILE)."\n";
} else {
print Moz::Milestone::getOfficialMilestone($MILESTONE_FILE)."\n";
}
}
sub usage() {
print <<END
`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list]` # will build file list from .tmpl files
`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --emversion --template [file list]` # will build file list from .tmpl files
END
;
}

View File

@ -10,5 +10,5 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
1.8b3
MILESTONE=1.8b3
MILESTONE_EM=1.7+

View File

@ -376,7 +376,7 @@ function getGecko() {
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
// Use App info if possible
return appInfo.geckoBuildID;
return appInfo.platformBuildID;
}
catch(ex) {
return "00000000"; // 8 0's to ignore as we have historically

View File

@ -13,7 +13,7 @@ XULAppInfoService.prototype.ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
#expand XULAppInfoService.prototype.name = "__MOZ_APP_DISPLAYNAME__";
#expand XULAppInfoService.prototype.version = "__MOZ_APP_VERSION__";
#expand XULAppInfoService.prototype.appBuildID = "__BUILD_ID__";
#expand XULAppInfoService.prototype.geckoBuildID = "__BUILD_ID__";
#expand XULAppInfoService.prototype.platformBuildID = "__BUILD_ID__";
XULAppInfoService.prototype.QueryInterface =
function appinfo_QueryInterface(iid)

View File

@ -47,7 +47,7 @@ function nsRDFItemUpdater(aClientOS, aChromeLocale){
var app = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
this.appID = app.ID;
this.buildID = app.geckoBuildID;
this.buildID = app.platformBuildID;
this.clientOS = aClientOS;
this.chromeLocale = aChromeLocale;

View File

@ -534,7 +534,7 @@ nsPluginInstallerWizard.prototype.showPluginResults = function (){
// set the get more info link to contain the mimetypes we couldn't install.
notInstalledList +=
"&appID=" + app.ID +
"&appVersion=" + app.geckoBuildID +
"&appVersion=" + app.platformBuildID +
"&clientOS=" + this.getOS() +
"&chromeLocale=" + this.getChromeLocale();

View File

@ -186,6 +186,8 @@ DEFINES += \
$(NULL)
endif
DEFINES += -DTOOLKIT_EM_VERSION=\"$(shell $(PERL) $(topsrcdir)/config/milestone.pl --emversion --topsrcdir=$(topsrcdir))\"
export:: $(addprefix $(topsrcdir)/xpfe/bootstrap/, $(SHAREDCPPSRCS) $(SHAREDCMMSRCS)) $(STACKWALK_CPPSRCS)
ifeq ($(OS_ARCH),WINNT)
$(INSTALL) $^ $(srcdir)

View File

@ -424,6 +424,14 @@ nsXULAppInfo::GetVersion(nsACString& aResult)
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetPlatformVersion(nsACString& aResult)
{
aResult.AssignLiteral(TOOLKIT_EM_VERSION);
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetAppBuildID(nsACString& aResult)
{
@ -433,7 +441,7 @@ nsXULAppInfo::GetAppBuildID(nsACString& aResult)
}
NS_IMETHODIMP
nsXULAppInfo::GetGeckoBuildID(nsACString& aResult)
nsXULAppInfo::GetPlatformBuildID(nsACString& aResult)
{
aResult.Assign(NS_STRINGIFY(BUILD_ID));

View File

@ -44,7 +44,7 @@
* isn't frozen yet. Use with caution.
*/
[scriptable, uuid(1f4e76cb-414f-4c50-b31e-be52c43502ff)]
[scriptable, uuid(a61ede2a-ef09-11d9-a5ce-001124787b2e)]
interface nsIXULAppInfo : nsISupports
{
/**
@ -58,27 +58,36 @@ interface nsIXULAppInfo : nsISupports
*/
readonly attribute ACString name;
/**
* @see nsXREAppData.version
* @returns an empty string if nsXREAppData.version is not set.
*/
readonly attribute ACString version;
/**
* @see nsXREAppData.ID
* @returns an empty string if nsXREAppData.ID is not set.
*/
readonly attribute ACString ID;
/**
* This is the version of the XUL application. It is different than the
* version of the XULRunner platform. Be careful about which one you want.
*
* @see nsXREAppData.version
* @returns an empty string if nsXREAppData.version is not set.
*/
readonly attribute ACString version;
/**
* The build ID/date of the application. For xulrunner applications,
* this will be different than the build ID of gecko. Be careful
* this will be different than the build ID of the platform. Be careful
* about which one you want.
*/
readonly attribute ACString appBuildID;
/**
* The build ID/date of gecko and the xulrunner.
* The version of the XULRunner platform, in an extension-manager compatible
* format (1.7+, not 1.8b2).
*/
readonly attribute ACString geckoBuildID;
readonly attribute ACString platformVersion;
/**
* The build ID/date of gecko and the XULRunner platform.
*/
readonly attribute ACString platformBuildID;
};