File: gpt-config

package info (click to toggle)
grid-packaging-tools 3.2globus2-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,816 kB
  • ctags: 1,621
  • sloc: perl: 19,536; sh: 3,047; makefile: 320; exp: 89
file content (299 lines) | stat: -rwxr-xr-x 7,426 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
#!/usr/bin/perl

use Getopt::Long;
use Cwd;
use Config;


my ($dir, $perl, $probe, $ignore, $help, $version, $man, $archivetar,
   $strict);
$list++ if ! @ARGV;

my $options_result = GetOptions( 
                                'location=s' => \$dir,
                                'help|?' => \$help,
                                'man' => \$man,
                                'version' => \$version,
                                'perl=s' => \$perl,
                                'gtar=s' => \$mode{'gtar'},
                                'gzip=s' => \$mode{'gzip'},
                                'gunzip=s' => \$mode{'gunzip'},
                                'gmake=s' => \$mode{'gmake'},
                                'rpm=s' => \$mode{'rpm'},
                                'rpmbuild=s' => \$mode{'rpmbuild'},
                                'license=s' => \$mode{'license'},
                                'vendor=s' => \$mode{'vendor'},
                                'ftpsite=s' => \$mode{'ftpsite'},
                                'url=s' => \$mode{'url'},
                                'packager=s' => \$mode{'packager'},
                                'prefix=s' => \$mode{'prefix'},
                                'force=s' => \$mode{'force'},
                                'list' => \$list,
                                'use-archive-tar' => \$archivetar,
                                'probe' => \$probe,
                                'ignore-errors' => \$ignore,
                                'strict' => \$strict
                              );

#
# read in the main GPT environment variables
#

my $gpath = $dir;

if (!defined($gpath))
{
  $gpath = $ENV{GPT_LOCATION};
}

if (!defined($gpath))
{
   $gpath = "/usr";
}

if (!defined($gpath))
{
     die "GPT_LOCATION or GLOBUS_LOCATION needs to be set before running this script";
}

#
# alter the include path
#

@INC = ("$gpath/lib/perl", "$gpath/lib/perl/$Config{'archname'}", @INC);

if ( ! ( defined eval "require Grid::GPT::GPTObject" ) )
{
    die("$gpath does not appear to hold a valid GPT installation\n");
}

require Pod::Usage;

Pod::Usage::pod2usage(2) if ! $options_result;
Pod::Usage::pod2usage(0) if defined $help;
Pod::Usage::pod2usage(-verbose => 2) if defined $man;

require Grid::GPT::GPTIdentity;



if (defined $version) {
  Grid::GPT::GPTIdentity::print_gpt_version();
  exit 0;
}

if (defined $list) {
  die "ERROR: GPT has not been configured\n" 
    if ! defined eval "require Grid::GPT::LocalEnv;";

  require Grid::GPT::LocalEnv;

  Grid::GPT::LocalEnv::listconfig();

  exit 0;

}

require Grid::GPT::Localize;

if ( defined eval "require Grid::GPT::LocalEnv;" and ! defined $probe)
{

  require Grid::GPT::LocalEnv;


  for $m (Grid::GPT::Localize::get_rpm_settings_list()) {

    $mode{$m} = Grid::GPT::LocalEnv::get_rpm_setting($m) 
      if ! defined $mode{$m};
  }

  for $m (Grid::GPT::Localize::get_tool_list()) {

    $mode{$m} = Grid::GPT::LocalEnv::get_tool_location($m) 
      if ! defined $mode{$m};
  }

}


my $localizer = new Grid::GPT::Localize(%mode, 
                                        ignore_errors => $ignore,
                                        gpath => $gpath,
                                        systar => defined $archivetar ? undef : 1,
                                       );


if (defined $perl or defined $probe) {

  $perl = $localizer->set_perl( location => $perl, version => '5.005');
  die "ERROR: No compatible Perl executable found\n" if ! defined $perl;
  modify_gpt_scripts();

}

$localizer->probe_for_tools() if defined $probe;
$localizer->set_tools();

if ($localizer->getsub('rpm') eq 'Not Available') {
  $localizer->clear_rpm_settings();
} else {
  $localizer->set_rpm_settings();
}

for $m (Grid::GPT::Localize::get_rpm_settings_list()) {

  $localizer->setsub($m, $mode{$m}) if defined $mode{$m};

}

$localizer->check_for_usr_sbin_check();
$localizer->localize();



sub modify_gpt_scripts {
  open LIST, "$gpath/share/globus/gpt_scripts_list";

  my $list = <LIST>;

  my @scripts = split /\s+/, $list;

  for $s (@scripts) {
    next if $s !~ m!\w+!;

    open SCRIPT, "$gpath/sbin/$s";

    my @contents = <SCRIPT>;
    close SCRIPT;

    open SCRIPT, ">$gpath/sbin/$s";

    my $done;
    my $with_w = defined $strict ? " -w" : "";
    for $c (@contents) {
      if ($c =~ /\#!/ and ! defined $done) {
        print SCRIPT "#!$perl$with_w\n";
        $done++;
        next;
      }
        print SCRIPT $c;
    }
  }
}


__END__

=head1 NAME

B<gpt-config> - Configure the current installation of GPT

=head1 SYNOPSIS

B<gpt-config> [options]

  Help-Related Options:
    --help             brief help message
    --man              full documentation
    --location         location of the GPT installation
    --perl             location of the perl program
    --gtar             location of the GNU tar program
    --gunzip           location of the GNU unzip program
    --gmake            location of the GNU make program
    --rpm              location of the rpm program
    --rpm              location of the rpmbuild program
    --license          value used for the software license in RPM packages
    --vendor           value used for the software vendor in RPM packages
    --ftpsite          value used for the software ftp site in RPM packages
    --url              value used for the URL for the software in RPM packages
    --packager         value used for the packager of the  RPM packages
    --prefix           value used for the installation directory of RPM packages
    --use-archive-tar  Use the Archive::Tar module instead of the system tar program
    --list             list the current configuration
    --probe            probe for the various programs that GPT needs
    --ignore           ignore any missing programs

=head1 DESCRIPTION

B<gpt-config> is a runtime configuration script that is used to
localize a GPT installation.  GPT uses various programs and packaging
parameters to do its job.  These items can be listed and modified by
this script.

Configuration information for GPT is stored in the module
$GPT_LOCATION/lib/perl/Grid/GPT/LocalEnv.pm.  This module is
regenerated when gpt-config is used to change the configuration.

=head1 OPTIONS

=over 4

=item I<-builddir>

Specifies the where the source tar files should be untarred and the
code is built.


=item I<-location>

=item I<-perl>

=item I<-gtar>

=item I<-gunzip>

=item I<-gmake>

=item I<-rpm>

=item I<-rpmbuild>

Location of various programs that GPT uses.  These switches will
override any searching done by the -probe switch..


=item I<-license>

=item I<-vendor>

=item I<-ftpsite>

=item I<-url>

=item I<-packager>

=item I<-prefix>

Values that are used by GPT when generating RPM packages.  These
values are not configured when the platform does not support RPM.


=item I<-list>

List the current configuration.


=item I<-probe>

Probe for the various programs that GPT needs.  The probe examines
each directory listed in the B<$PATH> variable for these programs.


=item I<-use-archive-tar>

Skip the probes for a system tar and unzip programs.  Use Archive::Tar
module to untar source packages.  Using this modules slows down the
build noticably.

=item I<-ignore>

Ignore any missing programs and continue with the configuring.

=back

=head1 AUTHOR

Written by Chase Phillips and Michael Bletzinger.

=cut