1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/config/milestone.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +#!/usr/bin/perl -w 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +use Getopt::Long; 1.10 + 1.11 +use strict; 1.12 +use vars qw( 1.13 + $OBJDIR 1.14 + $SRCDIR 1.15 + $TOPSRCDIR 1.16 + $SCRIPTDIR 1.17 + @TEMPLATE_FILE 1.18 + $MILESTONE_FILE 1.19 + $MILESTONE 1.20 + $MILESTONE_NUM 1.21 + @MILESTONE_PARTS 1.22 + $MINI_VERSION 1.23 + $MICRO_VERSION 1.24 + $opt_debug 1.25 + $opt_template 1.26 + $opt_uaversion 1.27 + $opt_symbolversion 1.28 + $opt_help 1.29 + ); 1.30 + 1.31 +$SCRIPTDIR = $0; 1.32 +$SCRIPTDIR =~ s/[^\/]*$//; 1.33 +push(@INC,$SCRIPTDIR); 1.34 + 1.35 +require "Moz/Milestone.pm"; 1.36 + 1.37 +&GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template', 'uaversion', 'symbolversion'); 1.38 + 1.39 +if (defined($opt_help)) { 1.40 + &usage(); 1.41 + exit; 1.42 +} 1.43 + 1.44 +if (defined($opt_template)) { 1.45 + @TEMPLATE_FILE = @ARGV; 1.46 + if ($opt_debug) { 1.47 + print("TEMPLATE_FILE = --@TEMPLATE_FILE--\n"); 1.48 + } 1.49 +} 1.50 + 1.51 +if (!defined($SRCDIR)) { $SRCDIR = '.'; } 1.52 +if (!defined($OBJDIR)) { $OBJDIR = '.'; } 1.53 + 1.54 +$MILESTONE_FILE = "$TOPSRCDIR/config/milestone.txt"; 1.55 +@MILESTONE_PARTS = (0, 0, 0, 0); 1.56 + 1.57 +# 1.58 +# Grab milestone (top line of $MILESTONE_FILE that starts with a digit) 1.59 +# 1.60 +my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE); 1.61 + 1.62 +if (@TEMPLATE_FILE) { 1.63 + my $TFILE; 1.64 + 1.65 + foreach $TFILE (@TEMPLATE_FILE) { 1.66 + my $BUILT_FILE = "$OBJDIR/$TFILE"; 1.67 + $TFILE = "$SRCDIR/$TFILE.tmpl"; 1.68 + 1.69 + if (-e $TFILE) { 1.70 + 1.71 + Moz::Milestone::build_file($TFILE,$BUILT_FILE); 1.72 + 1.73 + } else { 1.74 + warn("$0: No such file $TFILE!\n"); 1.75 + } 1.76 + } 1.77 +} elsif(defined($opt_uaversion)) { 1.78 + # Only expose the major milestone in the UA string, hide the patch level 1.79 + # (bugs 572659 and 870868). 1.80 + my $uaversion = Moz::Milestone::getMilestoneMajor($milestone) . ".0"; 1.81 + print "$uaversion\n"; 1.82 +} elsif(defined($opt_symbolversion)) { 1.83 + # Only expose major milestone and alpha version. Used for symbol versioning 1.84 + # on Linux. 1.85 + my $symbolversion = Moz::Milestone::getMilestoneMajor($milestone) . 1.86 + Moz::Milestone::getMilestoneABWithNum($milestone); 1.87 + print "$symbolversion\n"; 1.88 +} else { 1.89 + print "$milestone\n"; 1.90 +} 1.91 + 1.92 +sub usage() { 1.93 + print <<END 1.94 +`milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list] --uaversion --symbolversion` # will build file list from .tmpl files 1.95 +END 1.96 + ; 1.97 +}