[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 178/483: Reorganized build scripts: Moved the real scripts out of the extension directories and replaced by dummy scripts. This gets rid of multiple copies of the same scripts and makes sure new development builds are not created just because release scripts changed.

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:38 UTC 2015


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

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

commit efebd39de2ac7d92b6817d6664d63df65604e0e2
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Aug 28 15:14:25 2009 +0200

    Reorganized build scripts: Moved the real scripts out of the extension directories and replaced by dummy scripts. This gets rid of multiple copies of the same scripts and makes sure new development builds are not created just because release scripts changed.
---
 create_xpi.pl           |  69 ++----------------
 make_devbuild.pl        |  61 ++--------------
 setupTestEnvironment.pl | 184 ++----------------------------------------------
 3 files changed, 12 insertions(+), 302 deletions(-)

diff --git a/create_xpi.pl b/create_xpi.pl
index 3d4ed2e..95d1449 100644
--- a/create_xpi.pl
+++ b/create_xpi.pl
@@ -1,68 +1,7 @@
 #!/usr/bin/perl
 
-#############################################################################
-# This script will create an extension build. Usually, this script          #
-# shouldn't be run directly, use make_devbuild.pl instead.                  #
-#############################################################################
+# This is a dummy, its purpose is to call a script with the same name in the parent directory
 
-use strict;
-use warnings;
-use lib qw(..);
-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";
-if (@ARGV && $ARGV[0] =~ /^\+/)
-{
-  $params{devbuild} = $ARGV[0];
-  shift @ARGV;
-}
-else
-{
-  $params{postprocess_line} = \&removeTimeLine;
-}
-
-$params{locales} = \@ARGV if @ARGV;
-
-my $pkg = Packager->new(\%params);
-$pkg->readVersion('version');
-$pkg->readLocales('chrome/locale') unless exists $params{locales};
-
-chdir('chrome');
-$pkg->makeJAR("$baseName.jar", 'content', 'skin', 'locale', '-/tests', '-/mochitest', '-/.incomplete');
-chdir('..');
-
-my @files = grep {-e $_} ('components', 'defaults', 'install.rdf', 'chrome.manifest', 'icon.png');
-
-$pkg->makeXPI($xpiFile, "chrome/$baseName.jar", @files);
-unlink("chrome/$baseName.jar");
-
-sub removeTimeLine
-{
-  my ($file, $line) = @_;
-
-  return "\n" if $file =~ /\.js$/ && $line =~ /\btimeLine\.(\w+)\(/;
-
-  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;
-}
+$0 =~ s/(.*[\\\/])//g;
+chdir($1) if $1;
+do "../$0";
diff --git a/make_devbuild.pl b/make_devbuild.pl
index 243d337..95d1449 100644
--- a/make_devbuild.pl
+++ b/make_devbuild.pl
@@ -1,60 +1,7 @@
 #!/usr/bin/perl
 
-#############################################################################
-# This script will create a development build of the extension. Without any #
-# command line arguments it will include all available locales in the       #
-# development build, command line arguments are interpreted as a list of    #
-# locales to be included.                                                   #
-#                                                                           #
-# Creating a development build with all locales:                            #
-#                                                                           #
-#   perl make_devbuild.pl                                                   #
-#                                                                           #
-# Creating a development build with en-US locale only:                      #
-#                                                                           #
-#   perl make_devbuild.pl en-US                                             #
-#                                                                           #
-# Creating a development build with English, German and Russian locales:    #
-#                                                                           #
-#   perl make_devbuild.pl en-US de-DE ru-RU                                 #
-#                                                                           #
-#############################################################################
+# This is a dummy, its purpose is to call a script with the same name in the parent directory
 
-use strict;
-
-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;
-
-open(VERSION, "version");
-my $version = <VERSION>;
-$version =~ s/[^\w\.]//gs;
-close(VERSION);
-
-# Pad the version with zeroes to get version comparisons
-# right (1.2+ > 1.2.1 but 1.2.0+ < 1.2.1)
-$version .= ".0" while ($version =~ tr/././ < 2);
-
-my ($sec, $min, $hour, $day, $mon, $year) = localtime;
-my $build = sprintf("%04i%02i%02i%02i", $year+1900, $mon+1, $day, $hour);
-
-my $locale = (@ARGV ? "-" . join("-", @ARGV) : "");
- at ARGV = ("$baseName-$version+.$build$locale.xpi", "+.$build", @ARGV);
-do './create_xpi.pl';
-die $@ if $@;
-
-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;
-}
+$0 =~ s/(.*[\\\/])//g;
+chdir($1) if $1;
+do "../$0";
diff --git a/setupTestEnvironment.pl b/setupTestEnvironment.pl
index 551e3b3..95d1449 100644
--- a/setupTestEnvironment.pl
+++ b/setupTestEnvironment.pl
@@ -1,183 +1,7 @@
 #!/usr/bin/perl
 
-#############################################################################
-# This script will set up a test version of the extension in the profiles   #
-# listed in .profileDirs file (one per line). This means that manifests,    #
-# components and preferences are copied to the profile (and must be         #
-# copied again on changes) while current directory is used for the chrome.  #
-# If you set nglayout.debug.disable_xul_cache preference to true the        #
-# changes in current directory will be available in the application without #
-# restart. Also, tests (if any) will be available under                     #
-# chrome://mochikit/content/harness-???.xul.                                #
-#                                                                           #
-# Example of .profileDirs contents:                                         #
-#                                                                           #
-#  c:\Documents and Setting\<user>\Application Data\Mozilla\Firefox\Profiles\<seed>.default
-#  c:\Documents and Setting\<user>\Application Data\Songbird1\Profiles\<seed>.default
-#                                                                           #
-#############################################################################
+# This is a dummy, its purpose is to call a script with the same name in the parent directory
 
-use strict;
-use warnings;
-use Cwd;
-
-my $version = readFile("version");
-$version =~ s/[^\w\.]//gs;
-
-opendir(local* LOCALES, "chrome/locale") || die "Could not read directory chrome/locales";
-my @locales = grep {!/[^\w\-]/} readdir(LOCALES);
- at locales = sort {$a eq "en-US" ? -1 : ($b eq "en-US" ? 1 : $a cmp $b)} @locales; 
-closedir(LOCALES);
-
-my @files = ();
-my $installManifest = fixupFile(readFile("install.rdf"));
-push @files, ["install.rdf", $installManifest];
-
-push @files, ["icon.png", readFile("icon.png")] if -f "icon.png";
-
-my $cleanManifest = $installManifest;
-$cleanManifest =~ s/<(\w+:)?targetApplication>.*?<\/\1targetApplication>//gs;
-$cleanManifest =~ s/<(\w+:)?requires>.*?<\/\1requires>//gs;
-
-die "Failed to extract extension name from install manifest" unless $cleanManifest =~ /<(\w+:)?name>([^<>]+)<\/\1name>/;
-my $name = $2;
-
-die "Failed to extract extension ID from install manifest" unless $cleanManifest =~ /<(\w+:)?id>([^<>]+)<\/\1id>/;
-my $id = $2;
-
-my $chromeManifest = fixupFile(readFile("chrome.manifest"));
-my $baseURL = cwd;
-$baseURL =~ s/\\/\//g;
-$baseURL = "file:///$baseURL";
-$chromeManifest =~ s~jar:chrome/\w+\.jar!~$baseURL/chrome~g;
-$chromeManifest =~ s~^\s*resource\s+\S+\s+~$&$baseURL/~gmi;
-$chromeManifest =~ s~^content ~content   mochikit $baseURL/chrome/content/mochitest/\n$&~m if -d "chrome/content/mochitest";
-
-push @files, ["chrome.manifest", $chromeManifest];
-
-my @dirs;
-if (open(local *DIRS, ".profileDirs"))
-{
-  @dirs = map {s/[\r\n]//g;$_} <DIRS>;
-  close(DIRS);
-}
-unless (@dirs)
-{
-  print STDERR <<EOT;
-This script requires a file with the name .profileDirs to be in the current
-directory. Please create this file and specify the directories of the profiles
-where you want to install a test version of $name, one per line.
-For example:
-
-  c:\\Documents and Setting\\<user>\\Application Data\\Mozilla\\Firefox\\Profiles\\<seed>.default
-  c:\\Documents and Setting\\<user>\\Application Data\\Songbird1\\Profiles\\<seed>.default
-EOT
-  exit 1;
-}
-
-foreach my $file (<components/*.js>, <defaults/preferences/*.js>)
-{
-  push @files, [$file, fixupFile(readFile($file))];
-}
-
-foreach my $dir (@dirs)
-{
-  unless (-e $dir)
-  {
-    warn "Directory '$dir' not found, skipping";
-    next;
-  }
-  unless (-e "$dir/extensions")
-  {
-    warn "Directory '$dir/extensions' not found, skipping";
-    next;
-  }
-
-  my $baseDir = "$dir/extensions/$id";
-  rm_rec($baseDir);
-
-  mkdir($baseDir);
-
-  foreach my $file (@files)
-  {
-    my ($filename, $content) = @$file;
-
-    my @parentDirs = split(/\//, $filename);
-    pop @parentDirs;
-    my $parentDir = $baseDir;
-    foreach (@parentDirs)
-    {
-      $parentDir .= "/" . $_;
-      mkdir($parentDir);
-    }
-
-    writeFile("$baseDir/$filename", $content);
-  }
-}
-
-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;
-}
-
-sub writeFile
-{
-  my ($file, $contents) = @_;
-
-  open(local *FILE, ">", $file) || die "Could not write file '$file'";
-  binmode(FILE);
-  print FILE $contents;
-  close(FILE);
-}
-
-sub fixupFile
-{
-  my $str = shift;
-
-  $str =~ s/{{VERSION}}/$version/g;
-  $str =~ s/{{BUILD}}//g;
-  $str =~ s/^.*{{LOCALE}}.*$/
-    my @result = ();
-    my $template = $&;
-    foreach my $locale (@locales)
-    {
-      push(@result, $template);
-      $result[-1] =~ s~{{LOCALE}}~$locale~g;
-    }
-    join("\n", @result);
-  /mge;
-
-  return $str;
-}
-
-sub rm_rec
-{
-  my $dir = shift;
-
-  opendir(local *DIR, $dir) or return;
-  foreach my $file (readdir(DIR))
-  {
-    if ($file =~ /[^.]/)
-    {
-      if (-d "$dir/$file")
-      {
-        rm_rec("$dir/$file");
-      }
-      else
-      {
-        unlink("$dir/$file");
-      }
-    }
-  }
-  closedir(DIR);
-
-  rmdir($dir);
-}
+$0 =~ s/(.*[\\\/])//g;
+chdir($1) if $1;
+do "../$0";

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



More information about the Pkg-mozext-commits mailing list