[LON-CAPA-cvs] cvs: modules /sharrison/autocpan make_cpanauto.pl
harris41
lon-capa-cvs@mail.lon-capa.org
Tue, 20 Aug 2002 18:00:07 -0000
harris41 Tue Aug 20 14:00:07 2002 EDT
Modified files:
/modules/sharrison/autocpan make_cpanauto.pl
Log:
various fixes; by using "shar" now produces self-extracting-installing
binaries
Index: modules/sharrison/autocpan/make_cpanauto.pl
diff -u modules/sharrison/autocpan/make_cpanauto.pl:1.1 modules/sharrison/autocpan/make_cpanauto.pl:1.2
--- modules/sharrison/autocpan/make_cpanauto.pl:1.1 Wed Aug 14 13:36:41 2002
+++ modules/sharrison/autocpan/make_cpanauto.pl Tue Aug 20 14:00:07 2002
@@ -1,7 +1,7 @@
# 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 $
+# $Id: make_cpanauto.pl,v 1.2 2002/08/20 18:00:07 harris41 Exp $
# This currently is a placeholder that will eventually implement the
# new CPAN RPM distribution strategy.
@@ -28,16 +28,37 @@
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");
+ my $sdist_name=$dist_name;
+ $sdist_name=~s/\-/\_/g;
+ my $cpansrc=`ls cpansrc_${sdist_name}-*`; chomp($cpansrc);
+ my $cpanbuild=`ls cpanbuild_${sdist_name}-*`; chomp($cpanbuild);
+ `shar -s sharrison\@users.sourceforge.net $cpansrc $cpanbuild > $sdir/${dist_name}.bintmp`;
+ my $wc=`wc -l $sdir/${dist_name}.bintmp`; $wc=~s/\s*(\d+).*/$1/;
+ $wcm=$wc-1;
+ `head -$wcm $sdir/${dist_name}.bintmp > $sdir/${dist_name}.bin`;
+ `rm -f $sdir/${dist_name}.bintmp`;
+ open(OUT,">>$sdir/${dist_name}.bin");
+ print(OUT <<END);
+echo "Installing the source and build RPMs for ${dist_name}"
+rm -Rf /usr/local/cpansource/${dist_name}
+rpm -Uvh $cpansrc
+rpm -Uvh $cpanbuild
+echo "Trying to automatically compile the CPAN distribution ${dist_name}"
+/usr/local/cpanbuild/${dist_name}
+rpm -Uvh /usr/local/cpansource/${dist_name}/cpan_${sdist_name}*.rpm
+exit 0
+END
close(OUT);
+# 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`;
+#print `cd tmpbuild; tar czvf ../cpanauto.tar.gz cpanauto`;