[LON-CAPA-cvs] cvs: modules /sharrison/autocpan make_cpan_rpm.pl

harris41 lon-capa-cvs@mail.lon-capa.org
Sun, 18 Aug 2002 19:33:53 -0000


harris41		Sun Aug 18 15:33:53 2002 EDT

  Added files:                 
    /modules/sharrison/autocpan	make_cpan_rpm.pl 
  Log:
  working script that automatically generates an RPM from a CPAN distribution
  
  

Index: modules/sharrison/autocpan/make_cpan_rpm.pl
+++ modules/sharrison/autocpan/make_cpan_rpm.pl
# make_cpan_rpm.pl - takes in a CPAN distribution file list and builds an RPM.

# The RPM that this script builds is "custom-designed" for the machine it is
# built upon.  The "custom-designing" helps operate with the variable directory
# structures that exist underneath /usr/lib/perl5/ for different
# linux distributions and perl releases.

# Thus, a CPAN distribution can safely be installed, upgraded, installed,
# and verified through the RPM mechanism.

# Scott Harrison, sharrison@users.sourceforge.net, 2002
# $Id: make_cpan_rpm.pl,v 1.1 2002/08/18 19:33:53 harris41 Exp $

use RPM::Make;

my $tag=shift(@ARGV); # Default name of the software package.
# The "Manifest": list of files that will comprise the software package.
my @filelist;
while(<>) {
    chomp;
    push @filelist,$_;
}
my $pathprefix='TempBinaryDir';

my $version='0.1'; # Version number.
my $date=`date +"%Y%m%d%H%M%S"`;
chomp($date);
my $release=$date; # Release number (versions can have multiple releases).

my %metadata=(
	   'vendor'=>'Automatically generated with RPM-Tools',
	   'summary'=>$tag.' from CPAN',
	   'name'=>$tag,
	   'copyrightname'=>'2002',
	   'group'=>'Utilities/System',
	   'AutoReqProv'=>'no',
	   'requires'=>[('PreReq: setup',
			 'PreReq: passwd',
			 'PreReq: util-linux'
			 )],
	   'description'=>'This package is generated by RPM::Make. '.
	                  'This implements the '.$tag.' software package.  '.
	                 'THIS RPM WAS CUSTOM-BUILT FOR THIS SPECIFIC MACHINE'.
                         ' BY AN AUTOMATED PROCESS ASSOCIATED WITH A LON-CAPA'.
	                 ' INSTALLATION.',
);

my $buildloc='TempBuildLoc';
my $arch='i386';

# The "execute" subroutine coordinates all of the RPM building steps.
RPM::Make::execute($tag,$version,$release,$arch,$buildloc,$pathprefix,
		   \@filelist,\%doc,\%conf,\%confnoreplace,
		   \%metadata);