[Pkg-mozext-commits] [adblock-plus] 64/464: Moved basename extraction from create_xpi.pl into packager module

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:03 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 67428adc195292c9db7c74ab85700cbf76eb707c
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Jan 18 15:58:50 2010 +0100

    Moved basename extraction from create_xpi.pl into packager module
---
 Packager.pm   | 11 +++++++++++
 create_xpi.pl | 31 +++++++------------------------
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/Packager.pm b/Packager.pm
index 74702c1..5e4164b 100644
--- a/Packager.pm
+++ b/Packager.pm
@@ -33,6 +33,17 @@ sub readVersion
   close(FILE);
 }
 
+sub readBasename
+{
+  my ($self, $manifestFile) = @_;
+
+  my $data = $self->readFile($manifestFile);
+  die "Could not open manifest file $manifestFile" unless defined $data;
+  die "Could not find JAR file name in $manifestFile" unless $data =~ /\bjar:chrome\/(\S+?)\.jar\b/;
+
+  $self->{baseName} = $1;
+}
+
 sub readLocales
 {
   my ($self, $localesDir, $includeIncomplete) = @_;
diff --git a/create_xpi.pl b/create_xpi.pl
index ae2a0bc..ba5a106 100644
--- a/create_xpi.pl
+++ b/create_xpi.pl
@@ -10,16 +10,9 @@ use warnings;
 use lib qw(buildtools);
 use Packager;
 
-my $manifest = readFile("chrome.manifest");
-unless ($manifest =~ /\bjar:chrome\/(\S+?)\.jar\b/)
-{
-  die "Could not find JAR file name in chrome.manifest";
-}
-my $baseName = $1;
-
 my %params = ();
 
-my $xpiFile = shift @ARGV || "$baseName.xpi";
+my $xpiFile = shift @ARGV;
 if (@ARGV && $ARGV[0] =~ /^\+/)
 {
   $params{devbuild} = $ARGV[0];
@@ -34,17 +27,20 @@ $params{locales} = \@ARGV if @ARGV;
 
 my $pkg = Packager->new(\%params);
 $pkg->readVersion('version');
+$pkg->readBasename('chrome.manifest');
 $pkg->readLocales('chrome/locale') unless exists $params{locales};
 $pkg->readLocaleData('chrome/locale');
 
+$xpiFile = "$pkg->{baseName}.xpi" unless $xpiFile;
+
 chdir('chrome');
-$pkg->makeJAR("$baseName.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete', '-/meta.properties');
+$pkg->makeJAR("$pkg->{baseName}.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete', '-/meta.properties');
 chdir('..');
 
 my @files = grep {-e $_} ('components', 'defaults', 'install.rdf', 'chrome.manifest', 'icon.png');
 
-$pkg->makeXPI($xpiFile, "chrome/$baseName.jar", @files);
-unlink("chrome/$baseName.jar");
+$pkg->makeXPI($xpiFile, "chrome/$pkg->{baseName}.jar", @files);
+unlink("chrome/$pkg->{baseName}.jar");
 
 sub removeTimeLine
 {
@@ -54,16 +50,3 @@ sub removeTimeLine
 
   return $line;
 }
-
-sub readFile
-{
-  my $file = shift;
-
-  open(local *FILE, "<", $file) || die "Could not read file '$file'";
-  binmode(FILE);
-  local $/;
-  my $result = <FILE>;
-  close(FILE);
-
-  return $result;
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list