#! perl use strict; use Getopt::Long; use File::Find; 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 = $ENV{GLOBUS_LOCATION}; } 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"); } my $VERSION = "0.01"; require Pod::Usage; # declare all of the option variables my $startdir = cwd(); my $man = 0; my $help = 0; my $pkgdir = "$startdir/binaries"; my ($verbose, $version, $rpm, $all, $logfile, $buildno, $debug, $installdir, $rpmprefix, $rpmlicense); # # if rpmprefix is not passed in, then it should be set to "/usr/grid" by # the Grid::GPT::Archive module # # process the -option options GetOptions( 'installdir=s' => \$installdir, 'location=s' => \$installdir, 'pkgdir=s' => \$pkgdir, 'buildnumber|buildno=i' => \$buildno, 'native' => \$rpm, 'rpmprefix=s' => \$rpmprefix, 'rpmlicense=s' => \$rpmlicense, 'all' => \$all, 'log' => \$logfile, 'verbose!' => \$verbose, 'debug' => \$debug, 'help|?' => \$help, 'man' => \$man, 'version' => \$version) or Pod::Usage::pod2usage(0); Pod::Usage::pod2usage(0) if $help; Pod::Usage::pod2usage(-verbose => 2) if $man; require Grid::GPT::GPTIdentity; Grid::GPT::GPTIdentity::print_gpt_version() if defined $version; require Grid::GPT::PkgMngmt::Archive; require Grid::GPT::FilelistFunctions; require Grid::GPT::Installation; my @pkgnames = @ARGV; Pod::Usage::pod2usage(-verbose => 0, -exitval => 1, -output => \*STDERR, -message => "ERROR: No packages specified!") if ! @pkgnames and ! defined $all; # Create package directory Grid::GPT::FilelistFunctions::mkinstalldir("$pkgdir"); $pkgdir = Grid::GPT::FilelistFunctions::abspath($pkgdir); my $log = new Grid::GPT::PkgMngmt::Inform(verbose => $verbose, log => $logfile, debug => $debug); my $locations = new Grid::GPT::Locations( installdir => $installdir, ); my $installation = new Grid::GPT::Installation(locations => $locations, with_filelists => 1); my $packager = new Grid::GPT::PkgMngmt::Archive(locations => $locations, gpt_rpm_prefix => $rpmprefix, buildno => $buildno, verbose => $log->{'verbose'}, license => $rpmlicense, rpm => $rpm, log=> $log); my $pkgs; if (defined $all) { @$pkgs = grep { $_->pkgname() ne 'globus_core' } @{$installation->pkgs()}; } else { $pkgs = []; for my $pn (@pkgnames) { my $mypkgs = $installation->query(pkgname => $pn); die "ERROR: Package $pn not found\n" if( ! @$mypkgs ); push @$pkgs, @$mypkgs; } } chdir $pkgdir; $packager->archive($pkgs); chdir $startdir; exit 0; __END__ =head1 NAME B - Creates flavored binary packages out of an installation =head1 SYNOPSIS B [options] packages Options: -verbose Print copious output -help Print usage -man Print man page. -version Print GPT version. -native Create native pkgs as well as GPT pkgs (RPMs only). -all Archive everything in the package directory.. -installdir=PATH Override $GLOBUS_LOCATION -pkgdir=PATH Directory to put the packages -rpmprefix=PATH Absolute path encoded in the RPM. -buildnumber=NUMBER Build number used for pgm_static packages -rpmlicense=LABEL License Label added to the RPM header [packages] List of packages to be archived =head1 DESCRIPTION B Creates binary packages from an installation. The installation needs to contain GPT packaging data files. An installation is created by running I on a collection of source packages or bundles. =head1 FILES IN PGM PACKAGES Installed files such as executables that are found in pgm and ptm_static packages will overwrite one another when multiple flavors of the same package are built by gpt-build. To preserve multiple flavors of these files, gpt-build copies them into flavored subdirectories. For example, the program $GLOBUS_LOCATION/bin/foo will be copied into the location $GLOBUS_LOCATION/bin/gcc32/shared if it was built with dynamically with the gcc32 flavor. B retrieves these files and copies them back to their proper location before packaging them. Thus gpt-pkg will also overwrite these files as it archives the different flavors of a pgm package. =head1 OPTIONS =over 8 =item B<-installdir> Specify the directory in which the installed files currently live. If this argument is not supplied, the value of the environment variable GLOBUS_LOCATION is used instead. =item B<-all> Packages all of the binaries in an installation. =item B<-native> Creates a package in the native packaging format. Currently only rpm is supported. =item B<-rpmprefix=> This should be set to the path to your GLOBUS_LOCATION. GPT will use a value of "/usr/grid" if this option is not specified. =item B<-rpmlicense=