~ubuntu-branches/ubuntu/maverick/adblock-plus/maverick-updates

« back to all changes in this revision

Viewing changes to buildtools/make_babelzilla_build.pl

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-01-07 17:25:17 UTC
  • mfrom: (0.2.7 upstream)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20100107172517-zvjiuls0mbezz8et
Tags: upstream-1.1.3
ImportĀ upstreamĀ versionĀ 1.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
#############################################################################
 
4
# This script will create a special development build meant only for upload #
 
5
# to Babelzilla.                                                            #
 
6
#############################################################################
 
7
 
 
8
use strict;
 
9
use warnings;
 
10
use lib qw(buildtools);
 
11
use Packager;
 
12
 
 
13
sub Packager::fixLocales() {}
 
14
 
 
15
my $manifest = readFile("chrome.manifest");
 
16
unless ($manifest =~ /\bjar:chrome\/(\S+?)\.jar\b/)
 
17
{
 
18
  die "Could not find JAR file name in chrome.manifest";
 
19
}
 
20
my $baseName = $1;
 
21
 
 
22
my %params = ();
 
23
$params{version} = shift @ARGV;
 
24
die "Please specify version number on command line" unless $params{version};
 
25
 
 
26
my $xpiFile = "$baseName-$params{version}.xpi";
 
27
 
 
28
my $pkg = Packager->new(\%params);
 
29
$pkg->readLocales('chrome/locale', 1);
 
30
$pkg->readLocaleData('chrome/locale');
 
31
 
 
32
chdir('chrome');
 
33
$pkg->makeJAR("$baseName.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete');
 
34
chdir('..');
 
35
 
 
36
my @files = grep {-e $_} ('components', 'defaults', 'install.rdf', 'chrome.manifest', 'icon.png');
 
37
 
 
38
my $targetAppNum = 0;
 
39
$pkg->{postprocess_line} = \&postprocessInstallRDF;
 
40
$pkg->makeXPI($xpiFile, "chrome/$baseName.jar", @files);
 
41
unlink("chrome/$baseName.jar");
 
42
 
 
43
sub postprocessInstallRDF
 
44
{
 
45
  my ($file, $line) = @_;
 
46
 
 
47
  return $line unless $file eq "install.rdf";
 
48
 
 
49
  if ($line =~ /\btargetApplication\b/)
 
50
  {
 
51
    $targetAppNum++;
 
52
    return "" if $targetAppNum > 6;
 
53
  }
 
54
 
 
55
  return "" if $targetAppNum > 6 && $targetAppNum % 2 == 1;
 
56
 
 
57
  return $line;
 
58
}
 
59
 
 
60
sub readFile
 
61
{
 
62
  my $file = shift;
 
63
 
 
64
  open(local *FILE, "<", $file) || die "Could not read file '$file'";
 
65
  binmode(FILE);
 
66
  local $/;
 
67
  my $result = <FILE>;
 
68
  close(FILE);
 
69
 
 
70
  return $result;
 
71
}