version 1.1, 2004/07/28 16:32:36
|
version 1.2, 2005/06/04 00:52:29
|
|
|
#!/usr/bin/perl | #!/usr/bin/perl |
|
#//%2005//////////////////////////////////////////////////////////////////////// |
|
#// |
|
#// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
|
#// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
#// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
#// IBM Corp.; EMC Corporation, The Open Group. |
|
#// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
#// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
#// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
#// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
#// |
|
#// Permission is hereby granted, free of charge, to any person obtaining a copy |
|
#// of this software and associated documentation files (the "Software"), to |
|
#// deal in the Software without restriction, including without limitation the |
|
#// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
#// sell copies of the Software, and to permit persons to whom the Software is |
|
#// furnished to do so, subject to the following conditions: |
|
#// |
|
#// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
#// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
#// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
#// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
#// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
#// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
#// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
#// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
#// |
|
#//============================================================================== |
use strict; | use strict; |
#use warnings; | #use warnings; |
my $HELP_FILE = "SetConfig_EnvVar.help"; | my $HELP_FILE = "SetConfig_EnvVar.help"; |
|
|
| |
print "\n\n"; | print "\n\n"; |
print "=================================================\n"; | print "=================================================\n"; |
|
print "All your build options have been saved in ",$STATUS_FILE,"\n"; |
|
print "If you need to modify anything, please do so now.\n"; |
|
print "\nNOTE:\n"; |
print "The PATH enviroment variables needs to be modified\n"; | print "The PATH enviroment variables needs to be modified\n"; |
print "to have",$component_value{"PEGASUS_HOME"},"/bin\n"; | print "to have",$component_value{"PEGASUS_HOME"},"/bin\n"; |
print "if you wish to run the unit tests.\n"; | print "if you wish to run the unit tests.\n"; |
print "\n"; | print "\n"; |
print "You might also need to set this enviroment variable\n"; | print "You might also need to set this enviroment variable\n"; |
print "PEGASUS_ROOT=",$component_value{"PEGASUS_ROOT"},"\n"; | print "PEGASUS_ROOT=",$component_value{"PEGASUS_ROOT"},"\n"; |
|
print "\n\nLastly, to compile OpenPegasus, type make\n"; |
print "=================================================\n"; | print "=================================================\n"; |
| |
} | } |
|
|
foreach $c (sort keys(%component_value)) | foreach $c (sort keys(%component_value)) |
{ | { |
print OUTPUT ("# ", $short_descr_hash{$c},"\n"); | print OUTPUT ("# ", $short_descr_hash{$c},"\n"); |
|
if ($component_value{$c} eq "No") |
|
{ |
|
print OUTPUT ("# ",$c,"=",$component_value{$c},"\n"); |
|
} |
|
else |
|
{ |
print OUTPUT ($c,"=",$component_value{$c},"\n"); | print OUTPUT ($c,"=",$component_value{$c},"\n"); |
} | } |
|
} |
close OUTPUT; | close OUTPUT; |
| |
} | } |
|
|
| |
my $c=""; | my $c=""; |
my $d=""; | my $d=""; |
|
my $component_that_has_depend=""; |
my $loop_question=0; | my $loop_question=0; |
|
my $pass=0; |
|
my $skip=0; |
|
my $search_for_dependants=0; |
|
|
|
foreach $pass (0..1) { |
|
if ($pass == 0) { |
|
print "=================================================\n"; |
|
print "All your build options will be saved in ",$STATUS_FILE," file.\n"; |
|
print "If you need to modify anything, you can do it after this program finishes..\n"; |
|
print "=================================================\n"; |
|
} |
foreach $c (sort keys(%component_hash)) | foreach $c (sort keys(%component_hash)) |
{ | { |
| |
# check in the $argument_list to see if this option | # check in the $argument_list to see if this option |
# has been passed in. |
# has been passed in. But do it only on the first |
|
# pass |
|
if ($pass == 0) { |
foreach $d (sort keys(%argument_list)) | foreach $d (sort keys(%argument_list)) |
{ | { |
if ($d eq $enable_component_hash{$c}) | if ($d eq $enable_component_hash{$c}) |
{ | { |
#print $c," is set\n"; |
print $c," is set\n"; |
$component_value{$c}="Yes"; | $component_value{$c}="Yes"; |
next; | next; |
} | } |
} | } |
if ($component_value{$c} eq "") { |
} |
|
$skip = 0; |
|
# Does this build option have a dependency? |
|
if (!$depend_on_hash{$c} eq "" ) |
|
{ |
|
# Yes. Has the dependency been set? |
|
if ($component_value{$depend_on_hash{$c}} eq "") |
|
{ |
|
# It has not been set. Skip this pass. |
|
#print "Skip, this build option - ",$c," is dependent (",$depend_on_hash{$c},")\n"; |
|
$skip =1; |
|
} |
|
} |
|
# if this is the second pass, ignore the flag options. |
|
if ($pass != 0) |
|
{ |
|
if ($define_type_hash{$c} =~ /flag/) |
|
{ |
|
$skip =1; |
|
} |
|
} |
|
if (($component_value{$c} eq "") && ($skip == 0)) { |
# Ask the user. | # Ask the user. |
print "\n--------------------\n"; | print "\n--------------------\n"; |
print $long_descr_hash{$c},"\n"; | print $long_descr_hash{$c},"\n"; |
$loop_question=1; | $loop_question=1; |
if ($define_type_hash{$c} eq "boolean") |
$search_for_dependants=0; |
|
if ($define_type_hash{$c} =~ /boolean/) |
{ | { |
do | do |
{ | { |
|
|
if (/^y/i) | if (/^y/i) |
{ | { |
$component_value{$c}="Yes"; | $component_value{$c}="Yes"; |
|
# There are build options that are 'disable.' Meaning that 'yes' |
|
# sets all of the dependents to 'Yes' as well. |
$loop_question=0; | $loop_question=0; |
|
if ($c =~ /PEGASUS_DISABLE/i) |
|
{ |
|
$search_for_dependants=1; |
|
} |
} | } |
if (/^n/i) | if (/^n/i) |
{ | { |
# Maybe ask the user again? | # Maybe ask the user again? |
$loop_question=0; | $loop_question=0; |
|
$component_value{$c}="No"; |
|
# If the answer is No and it is a disable option, don't search |
|
# the dependatns. Why? B/c the user might want to disable some |
|
# more fine-grained options. |
|
if ($c =~ /PEGASUS_DISABLE/i) |
|
{ |
|
$search_for_dependants=0; |
|
} else |
|
{ |
|
$search_for_dependants=1; |
|
} |
|
} |
|
if ($search_for_dependants==1) { |
|
#print "Search for dependants of ",$c,"\n"; |
|
# Traverse through all the components to invalidate (set to No) |
|
# the dependants. |
|
foreach $component_that_has_depend (keys(%depend_on_hash)) |
|
{ |
|
# Filter out all of those build options that do not have any dependents. |
|
if (!$depend_on_hash{$component_that_has_depend} eq "") |
|
{ |
|
#print " ",$depend_on_hash{$component_that_has_depend}," ? ",$c,"\n"; |
|
# Does the dependant build option equal to the we are searching for? |
|
if ($depend_on_hash{$component_that_has_depend} eq $c) { |
|
#print "Found: ",$component_that_has_depend," depends on ",$c,"\n"; } |
|
$component_value{$component_that_has_depend}="No"; |
|
} |
|
} |
|
} |
} | } |
if ($loop_question==1) | if ($loop_question==1) |
{ | { |
|
|
} | } |
} while ($loop_question==1); | } while ($loop_question==1); |
| |
|
} # if type is boolean |
|
|
|
if ($define_type_hash{$c} =~ /flag/) |
|
{ |
|
print $c,"[]: "; |
|
$_ = <STDIN>; |
|
chomp($_); |
|
$component_value{$c}=$_; |
} | } |
if ($define_type_hash{$c} eq "path") |
if ($define_type_hash{$c} =~ /path/) |
{ | { |
do | do |
{ | { |
|
|
} | } |
} # componet_value eq ""; | } # componet_value eq ""; |
} | } |
|
|
} | } |
|
} |
|
|
sub check_arguments() { | sub check_arguments() { |
| |
my $c=""; | my $c=""; |
|
|
| |
foreach $c (sort keys(%component_hash)) { | foreach $c (sort keys(%component_hash)) { |
print " ",$enable_component_hash{$c}; | print " ",$enable_component_hash{$c}; |
if ($define_type_hash{$c} =~ /path/) |
if ($define_type_hash{$c} =~ /path/i) |
{ | { |
print "=<directory>"; | print "=<directory>"; |
} | } |
|
if ($define_type_hash{$c} =~ /flag/i) |
|
{ |
|
print "=<flag>"; |
|
} |
print "\t\t"; | print "\t\t"; |
print $short_descr_hash{$c},"\n" | print $short_descr_hash{$c},"\n" |
} | } |
|
|
my @temp = (); | my @temp = (); |
foreach $argnum (0..$#ARGV) { | foreach $argnum (0..$#ARGV) { |
| |
if (lc($ARGV[$argnum]) =~ /--help/) { |
if (lc($ARGV[$argnum]) =~ /--help/i) { |
&print_help(); | &print_help(); |
exit (0); | exit (0); |
} | } |
|
|
| |
if ($state == 1) { | if ($state == 1) { |
#<depend or (Boolean or Path) | #<depend or (Boolean or Path) |
|
#new option: flag |
# check for boolean or Path | # check for boolean or Path |
if (lc($token) =~ /boolean/ || /path/){ |
if (lc($token) =~ /boolean/ || /path/i || /flag/i){ |
#print "(",$token,")"; | #print "(",$token,")"; |
$define_type_hash{$component}=lc($token); | $define_type_hash{$component}=lc($token); |
$state = 3; | $state = 3; |
|
|
} | } |
close (HELP_FILE); | close (HELP_FILE); |
} | } |
|
|