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