From a6ad8b5bb1899b8526457f1eb9c54f0f4d1b94e4 Mon Sep 17 00:00:00 2001 From: Fabien Tassin Date: Fri, 6 Jun 2008 15:05:42 +0200 Subject: * [mozclient] Fix --conf-dir not looking for .conf files are the right place - update src/mozclient.pl --- src/mozclient.pl | 40 +++++++++++++++++++++------------------- 1 file 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 <