File: gpt-virtual-pkg

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 (208 lines) | stat: -rwxr-xr-x 5,320 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
#! perl

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

#
# Do a perl check for version >= 5.005.  See 'gpt-translate-interpreter' should you
# need to alter the invocation path to a valid perl interpreter in the GPT front-end
# programs.
#

if ( ! ( defined eval "require 5.005" ) )
{
    die "GPT requires at least Perl version 5.005";
}

my $gpath = $ENV{GPT_LOCATION};

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

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

@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;

my $VERSION = 0.01;
my $installpath;
my ($flavor, $filelistfile, $gptfile);
my $prefix;
my $verbose = 0;
my ($help, $man);
my $delete;

# sub pod2usage {
#   my $ex = shift;
#   print "gpt-link [-verbose -help -installpath=path_to_globus_installation ] -flavor=build_flavor -filelist=file -gptfile=file -prefix=path_to_external_package\n";
#   exit $ex;
# }

GetOptions( 'installpath=s'=> \$installpath,
            'flavor=s' => \$flavor, 
            'filelist=s' => \$filelistfile, 
            'gptfile=s' => \$gptfile, 
	    'prefix=s' => \$prefix,
	    'verbose=i' => \$verbose, 'help' => \$help) 
  or Pod::Usage::pod2usage(1);

Pod::Usage::pod2usage(0) if $help;

if (defined $gptfile || defined $filelistfile) {
  if (!defined($flavor)) {
    print "ERROR: Please specify a build flavor\n";
    Pod::Usage::pod2usage(1);
  }
}

if (!defined($prefix)) {
  print "ERROR: Please specify the installation prefix\n";
  Pod::Usage::pod2usage(1);
}

require Grid::GPT::PackageFactory;
require Grid::GPT::V1::Definitions;
require Grid::GPT::FilelistFunctions;
require Grid::GPT::Locations;
require Grid::GPT::PkgMngmt::Inform;
require Grid::GPT::PkgMngmt;

my $locations = new Grid::GPT::Locations(
                                         installdir => $installpath,
                                        );
my $prefix_loc = new Grid::GPT::Locations(
                                          installdir => $prefix,
                                         );

$installpath = $locations->{'installdir'};


open (LIST, "$filelistfile");


my @original_files = <LIST>;

chomp @original_files;
my $factory = new Grid::GPT::PackageFactory;
my $pkg = $factory->type_of_package($gptfile);
$pkg->read_metadata_file($gptfile);
my $name = $pkg->Name();

my $log = new Grid::GPT::PkgMngmt::Inform(verbose => $verbose);
my $file_func = new Grid::GPT::FilelistFunctions(log => $log, 
                                                 locations => $prefix_loc);

my @install_filelist = @original_files;

my $install_files = $file_func->flavor_filelist(filelist => \@install_filelist, 
                                                flavor => $flavor,
                                               pkg=> $pkg);

$file_func = new Grid::GPT::FilelistFunctions(log => $log, 
                                              locations => $locations);

$file_func->generate_pkgdata(flavor => $flavor, 
                             pkg => $pkg,
                             master_filelist => $install_files);


for my $pt ('data','dev','doc','pgm','rtl') {
  Grid::GPT::PkgMngmt::pkg_format_file(
                                       mode => 'WRITE', 
                                       format => 'link', 
                                       pkgname => $pkg->Name(), 
                                       flavor => $flavor, 
                                       pkgtype => $pt, 
                                       pkgdir => 
                                       $locations->{'pkgdir'},
                                      );
}


for my $index (0 .. @original_files - 1) {
  my ($dir, $name) = "$installpath/$install_files->[$index]" =~  m!(.+)/([^/]+)$!;
  if (! -f "$prefix/$original_files[$index]")
    {
      print "WARNING: File  $prefix/$original_files[$index] not found\n";
    }
  print "Creating: $dir\n";
  Grid::GPT::FilelistFunctions::mkinstalldir($dir);
  print "Creating: $installpath/$install_files->[$index]\n";
  symlink "$prefix/$original_files[$index]", 
    "$installpath/$install_files->[$index]";
}




__END__

=head1 NAME

B<gpt-virtual-pkg> - Link external software into a GPT managed installation
installation. 

=head1 SYNOPSIS

B<gpt-virtual-pkg> [options]


=head1 DESCRIPTION

B<gpt-virtual-pkg> Link external packages into a globus site
installation. The script uses a description file to create the softlinks. The
format of this file is defined in the file virtual_package.dtd.

=head1 OPTIONS

=over 8

=item B<-installpath>

Overrides $GLOBUS_LOCATION to point to a globus site installation.

=item B<-prefix>

Specifies the installation location of the external package

=item B<-flavor>

Specifies the build flavor of the external package.

=item B<-filelist=file>

Specifies the file containing the list of installed files..

=item B<-gptfile=file>

Specifies the file containing the GPT packaging data.

=item B<-help>

Print a brief help message and exits.

=item B<-man>

Prints the manual page and exits.

=back

=head1 AUTHOR

Michael Bletzinger E<lt>mbletzin.ncsa.uiuc.eduE<gt> and Eric Blau
E<lt>eblau.ncsa.uiuc.eduE<gt>

=cut