summaryrefslogtreecommitdiff
path: root/src/mozclient.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mozclient.pl')
-rwxr-xr-xsrc/mozclient.pl40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/mozclient.pl b/src/mozclient.pl
index 7671a8b..c367cdf 100755
--- a/src/mozclient.pl
+++ b/src/mozclient.pl
@@ -23,8 +23,27 @@ use strict;
use Getopt::Long qw(:config no_auto_abbrev no_ignore_case
require_order bundling);
-my $mozclient_dir = "/usr/share/mozilla-devscripts";
-my $pkg_conf_dir = "$mozclient_dir/mozclient";
+BEGIN {
+ my $conf_dir = "/usr/share/mozilla-devscripts/mozclient";
+ # We look for modules in ${conf_dir}/lib
+ # We can prefer another path by using '--conf-dir path' or '-c path'
+ unshift @INC, "$conf_dir/lib";
+
+ my @args = @ARGV;
+ while (1) {
+ my $arg = shift @args;
+ last unless defined $arg;
+ next unless $arg eq '-c' || $arg eq '--conf-dir';
+ my $path = shift @args;
+ die "Usage error: $arg needs an argument\n" unless defined $path;
+ unshift @INC, "$path/lib";
+ last;
+ }
+}
+
+$INC[0] =~ m,(.*)/lib$,;
+my $mozclient_dir = $1;
+my $pkg_conf_dir = "$mozclient_dir";
my $patches_dir = "$pkg_conf_dir/patches";
my $work_dir = "mozclient-tmp";
@@ -45,23 +64,6 @@ my $defaults = {
'MOZCLIENT_PATCHES' => "$patches_dir",
};
-BEGIN {
- # We look for modules in /usr/share/mozilla-devscripts/mozclient/lib
- # We can prefer another path by using '--conf-dir path' or '-c path'
- unshift @INC, "/usr/share/mozilla-devscripts/mozclient/lib";
-
- my @args = @ARGV;
- while (1) {
- my $arg = shift @args;
- last unless defined $arg;
- next unless $arg eq '-c' || $arg eq '--conf-dir';
- my $path = shift @args;
- die "Usage error: $arg needs an argument\n" unless defined $path;
- unshift @INC, $path;
- last;
- }
-}
-
sub help {
print <<EOF;
mozclient [-b branch] [-t tag] [-d YYYYMMDDtHHmm] project-name