Hi,
I'm wondering why the package_config_xmls_to_database script is so broken in
trunk. I see:
- two times the call to GetOptions
- two different sets of command line options
- a bunch of identically replicated code (below)
> # first try the environmental variable
> if ( exists $ENV{OSCAR_HOME} ) {
> $oscar_home = $ENV{OSCAR_HOME};
> die "$0: bad OSCAR_HOME environmental variable value <$oscar_home>"
> if ( ! -d "$oscar_home");
> }
> # or if that fails, try to figure out the directory we're running from
> else {
> $oscar_home = $0;
> my $cwd = `pwd`;
> chomp $cwd;
> $oscar_home = $cwd . '/' . $oscar_home
> if $oscar_home !~ /^\//; # prepend current dir if not abs
> $oscar_home =~ s,/\.\./[^/][^/][^/]+/,/,g; # change /../???*/ to /
> $oscar_home =~ s,/\.\./[^\./][^\./]/,/,g; # change /../??/ to /
> $oscar_home =~ s,/\./,/,g; # change /./ to /
> $oscar_home =~ s,/packages/[^/]+/scripts/,/,g;
> $oscar_home =~ s,/[^/]+$,,; # Remove the name of the program
> die "$0: bad calculated oscar base directory $oscar_home"
> if ( ! -d "$oscar_home");
> $ENV{OSCAR_HOME} = $oscar_home;
> }
The "else" part can be thrown in the bin anyway, if $OSCAR_HOME isn't set here
things running earlier (wizard_prep) already had lots of chances to break.
I'll try to clean this up in my "sandbox", but we need some code scanning when
things get checked in...
Erich
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Oscar-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oscar-devel