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

harris41 lon-capa-cvs@mail.lon-capa.org
Wed, 14 Aug 2002 17:36:41 -0000


harris41		Wed Aug 14 13:36:41 2002 EDT

  Added files:                 
    /modules/sharrison/autocpan	make_cpanauto.pl 
  Log:
  make self-extracting binaries for automated installation of CPAN
  distributions; this is currently just a placeholder... the self-extracting
  binaries just tell the user to visit search.cpan.org/dist/DistName
  and do a manual install
  
  

Index: modules/sharrison/autocpan/make_cpanauto.pl
+++ modules/sharrison/autocpan/make_cpanauto.pl
# make_cpanauto.pl - compiles self-extracting binaries

# Scott Harrison, sharrison@users.sourceforge.net, 2002
# $Id: make_cpanauto.pl,v 1.1 2002/08/14 17:36:41 harris41 Exp $

# This currently is a placeholder that will eventually implement the
# new CPAN RPM distribution strategy.

# Temporary directory.
my $sdir="tmpbuild/cpanauto";

use RPM::Make;

# Get download location ready.
# `rm -Rf $sdir`;
`install -d $sdir`;

open(OUT,">README");
print(OUT <<END);
These files can be downloaded and executed to automatically install
CPAN distributions of perl modules.
END
close(OUT);

# 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 ($dist_name)=split(/\s+/);
    open(OUT,">$sdir/${dist_name}.bin");
    print(OUT '#!/bin/sh'."\n");
    print(OUT 'echo "Dist Name: '.$dist_name.'"'."\n");
    print(OUT 'echo "There is currently no automated installation supported '.
	  'for \''.$dist_name.'\'"'."\n");
    print(OUT 'echo "Please visit http://search.cpan.org/dist/'.
	  $dist_name.'"'."\n");
    print(OUT 'echo "and then perform a manual installation.'.'"'."\n");
    close(OUT);
    `chmod a+rx $sdir/${dist_name}.bin`;
}
close(IN);
print `cd tmpbuild; tar czvf ../cpanauto.tar.gz cpanauto`;