Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/usr/bin/perl -w |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | use Getopt::Long; |
michael@0 | 7 | |
michael@0 | 8 | use strict; |
michael@0 | 9 | use vars qw( |
michael@0 | 10 | $OBJDIR |
michael@0 | 11 | $SRCDIR |
michael@0 | 12 | $TOPSRCDIR |
michael@0 | 13 | $SCRIPTDIR |
michael@0 | 14 | @TEMPLATE_FILE |
michael@0 | 15 | $MILESTONE_FILE |
michael@0 | 16 | $MILESTONE |
michael@0 | 17 | $MILESTONE_NUM |
michael@0 | 18 | @MILESTONE_PARTS |
michael@0 | 19 | $MINI_VERSION |
michael@0 | 20 | $MICRO_VERSION |
michael@0 | 21 | $opt_debug |
michael@0 | 22 | $opt_template |
michael@0 | 23 | $opt_uaversion |
michael@0 | 24 | $opt_symbolversion |
michael@0 | 25 | $opt_help |
michael@0 | 26 | ); |
michael@0 | 27 | |
michael@0 | 28 | $SCRIPTDIR = $0; |
michael@0 | 29 | $SCRIPTDIR =~ s/[^\/]*$//; |
michael@0 | 30 | push(@INC,$SCRIPTDIR); |
michael@0 | 31 | |
michael@0 | 32 | require "Moz/Milestone.pm"; |
michael@0 | 33 | |
michael@0 | 34 | &GetOptions('topsrcdir=s' => \$TOPSRCDIR, 'srcdir=s' => \$SRCDIR, 'objdir=s' => \$OBJDIR, 'debug', 'help', 'template', 'uaversion', 'symbolversion'); |
michael@0 | 35 | |
michael@0 | 36 | if (defined($opt_help)) { |
michael@0 | 37 | &usage(); |
michael@0 | 38 | exit; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | if (defined($opt_template)) { |
michael@0 | 42 | @TEMPLATE_FILE = @ARGV; |
michael@0 | 43 | if ($opt_debug) { |
michael@0 | 44 | print("TEMPLATE_FILE = --@TEMPLATE_FILE--\n"); |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | if (!defined($SRCDIR)) { $SRCDIR = '.'; } |
michael@0 | 49 | if (!defined($OBJDIR)) { $OBJDIR = '.'; } |
michael@0 | 50 | |
michael@0 | 51 | $MILESTONE_FILE = "$TOPSRCDIR/config/milestone.txt"; |
michael@0 | 52 | @MILESTONE_PARTS = (0, 0, 0, 0); |
michael@0 | 53 | |
michael@0 | 54 | # |
michael@0 | 55 | # Grab milestone (top line of $MILESTONE_FILE that starts with a digit) |
michael@0 | 56 | # |
michael@0 | 57 | my $milestone = Moz::Milestone::getOfficialMilestone($MILESTONE_FILE); |
michael@0 | 58 | |
michael@0 | 59 | if (@TEMPLATE_FILE) { |
michael@0 | 60 | my $TFILE; |
michael@0 | 61 | |
michael@0 | 62 | foreach $TFILE (@TEMPLATE_FILE) { |
michael@0 | 63 | my $BUILT_FILE = "$OBJDIR/$TFILE"; |
michael@0 | 64 | $TFILE = "$SRCDIR/$TFILE.tmpl"; |
michael@0 | 65 | |
michael@0 | 66 | if (-e $TFILE) { |
michael@0 | 67 | |
michael@0 | 68 | Moz::Milestone::build_file($TFILE,$BUILT_FILE); |
michael@0 | 69 | |
michael@0 | 70 | } else { |
michael@0 | 71 | warn("$0: No such file $TFILE!\n"); |
michael@0 | 72 | } |
michael@0 | 73 | } |
michael@0 | 74 | } elsif(defined($opt_uaversion)) { |
michael@0 | 75 | # Only expose the major milestone in the UA string, hide the patch level |
michael@0 | 76 | # (bugs 572659 and 870868). |
michael@0 | 77 | my $uaversion = Moz::Milestone::getMilestoneMajor($milestone) . ".0"; |
michael@0 | 78 | print "$uaversion\n"; |
michael@0 | 79 | } elsif(defined($opt_symbolversion)) { |
michael@0 | 80 | # Only expose major milestone and alpha version. Used for symbol versioning |
michael@0 | 81 | # on Linux. |
michael@0 | 82 | my $symbolversion = Moz::Milestone::getMilestoneMajor($milestone) . |
michael@0 | 83 | Moz::Milestone::getMilestoneABWithNum($milestone); |
michael@0 | 84 | print "$symbolversion\n"; |
michael@0 | 85 | } else { |
michael@0 | 86 | print "$milestone\n"; |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | sub usage() { |
michael@0 | 90 | print <<END |
michael@0 | 91 | `milestone.pl [--topsrcdir TOPSRCDIR] [--objdir OBJDIR] [--srcdir SRCDIR] --template [file list] --uaversion --symbolversion` # will build file list from .tmpl files |
michael@0 | 92 | END |
michael@0 | 93 | ; |
michael@0 | 94 | } |