[LON-CAPA-cvs] cvs: modules /sharrison/autocpan make_build_cpan_rpms.pl
harris41
lon-capa-cvs@mail.lon-capa.org
Mon, 19 Aug 2002 20:09:58 -0000
harris41 Mon Aug 19 16:09:58 2002 EDT
Added files:
/modules/sharrison/autocpan make_build_cpan_rpms.pl
Log:
One more step along the long road of BUG #642.
Creates RPMs that have standard CPAN build mechanisms
(perl Makefile.PL; make; make PREFIX=TempBinaryLoc install);
as well as allowing for custom compilations to be prescribed
inside loncom/build/system_dependencies/cpanbuild/.
Index: modules/sharrison/autocpan/make_build_cpan_rpms.pl
+++ modules/sharrison/autocpan/make_build_cpan_rpms.pl
# make_build_cpan_rpms.pl - compiles cpan source contents as RPMs
# Scott Harrison, sharrison@users.sourceforge.net, 2002
# $Id: make_build_cpan_rpms.pl,v 1.1 2002/08/19 20:09:58 harris41 Exp $
# I am not using the CPAN.pm module because I do not want to introduce
# a software dependency. There would also be the multiple versions of
# CPAN.pm on existing RH6.* and RH7.* machines to account for.
# This helps automatically compile CPAN packages for automated installation,
# uninstallation, and management on a RedHat system. This script is
# structured to allow conditional incorporation of specialized build
# commands and patches.
# Temporary directory.
my $sdir="tmpbuildrpms/usr/local/cpanbuild/";
use RPM::Make;
# Get download location ready.
# `rm -Rf $sdir`;
`install -d $sdir`;
# Loop through and process the different cpan distributions.
open(IN,'<../../../loncom/build/system_dependencies/cpan_distributions.txt');
while(<IN>)
{
next if /^\#/;
next unless /\S/;
my ($dname,$dversion) = split(/\s+/);
my $tag = "cpanbuild-$dname";
$tag =~ s/\-/\_/g;
unless
(-e "../../../loncom/build/system_dependencies/cpanbuild/$dname.commands")
{
open(OUT,">tmpbuildrpms/usr/local/cpanbuild/$dname");
print(OUT '#!/bin/sh'."\n");
print(OUT 'cd /usr/local/cpansrc/'.$dname.'; '.
'perl Makefile.PL; make; '.
'make PREFIX="TempBinaryLoc/usr" install'."\n");
close(OUT);
}
else
{
open(OUT,">tmpbuildrpms/usr/local/cpanbuild/$dname");
print(OUT '#!/bin/sh'."\n");
print(OUT 'cd /usr/local/cpansrc/'.$dname.';');
`cat ../../../loncom/build/system_dependencies/cpanbuild/$dname.commands >> tmpbuildrpms/usr/local/cpanbuild/$dname`;
print(OUT 'cd /usr/local/cpansrc/'.$dname.';'.
'make PREFIX="TempBinaryLoc/usr" install'."\n");
close(OUT);
}
# Try and make an RPM.
print "Vee shall try and make an RPM ya...\n";
my @filelist = ("tmpbuildrpms/usr/local/cpanbuild/$dname");
my %metadata =
(
'vendor'=>'CPAN build commands for LON-CAPA',
'summary'=>"http://search.cpan.org/dist/$dname",
'name'=>$tag,
'copyrightname'=>'...',
'group'=>'Utilities/System',
'AutoReqProv'=>'no',
'requires'=>[('PreReq: setup',
'PreReq: passwd',
'PreReq: util-linux'
)],
'description'=>'This package is generated by a script. '. 'This implements build commands for the '.$tag.' software package',
'pre'=>'echo "Installing CPAN building commands into /usr/local/cpanbuild/. This only helps builds the source of a CPAN distribution. This will not yet add functionality to your system."',
);
my %doc;
my %conf;
my %confnoreplace;
my $version = $dversion;
my $release = 1;
my $arch = "i386";
my $buildloc = "TempBuildLoc";
my $pathprefix = "tmpbuildrpms";
RPM::Make::execute($tag,$version,$release,$arch,$buildloc,$pathprefix,
\@filelist,\%doc,\%conf,\%confnoreplace,
\%metadata);
}
close(IN);