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

harris41 lon-capa-cvs@mail.lon-capa.org
Tue, 20 Aug 2002 18:01:34 -0000


harris41		Tue Aug 20 14:01:34 2002 EDT

  Modified files:              
    /modules/sharrison/autocpan	make_source_cpan_rpms.pl 
  Log:
  generalizing the directory name of the rpm install location (should
  not have a number)
  
  
Index: modules/sharrison/autocpan/make_source_cpan_rpms.pl
diff -u modules/sharrison/autocpan/make_source_cpan_rpms.pl:1.1 modules/sharrison/autocpan/make_source_cpan_rpms.pl:1.2
--- modules/sharrison/autocpan/make_source_cpan_rpms.pl:1.1	Sun Aug 11 19:02:32 2002
+++ modules/sharrison/autocpan/make_source_cpan_rpms.pl	Tue Aug 20 14:01:34 2002
@@ -1,7 +1,7 @@
 # make_source_cpan_rpms.pl - compiles cpan source contents as RPMs
 
 # Scott Harrison, sharrison@users.sourceforge.net, 2002
-# $Id: make_source_cpan_rpms.pl,v 1.1 2002/08/11 23:02:32 harris41 Exp $
+# $Id: make_source_cpan_rpms.pl,v 1.2 2002/08/20 18:01:34 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
@@ -36,7 +36,9 @@
     $tardownload2=~s/\-([^\-]*)\.tar\.gz/-$dversion.tar.gz/;
     print "Most Recent=$mostrecent; Version requested=$dversion\n";
     print "Download... $tardownload2\n";
+    unless (-e "$sdir/$tardownload2") {
     `cd $sdir; wget -nc http://www.cpan.org/$tardownload2 2>\&1 > /dev/null`;
+    }
     if ($?) {
        print "**** ERROR **** Cannot find http://www.cpan.org/$tardownload2\n";
 	exit(1);
@@ -48,10 +50,13 @@
     `cd $sdir; tar --no-same-owner -xzf $tarfile`;
     # Try and make an RPM.
     print "Vee shall try and make an RPM ya...\n";
+    if (-d "$sdir/$tardir") {
+	`cd $sdir; ln -s $tardir $dname`;
+    }
     my @filelist=`cd $sdir; tar tzvf $tarfile`;
     my $tmptardir=$tardir;
     $tmptardir=~s/\-[^\-]*$//;
-    foreach my $file (@filelist) {chomp $file;$file=~s/^.*?($tmptardir.*)/$1/;$file="$sdir/$file";print "file $file\n";}
+    foreach my $file (@filelist) {chomp $file;$file=~s/^.*?($tmptardir.*)/$1/;$file="$sdir/$file";$file=~s/\/$tardir/$dname/;print "file $file\n";}
     my %metadata=(
 		  'vendor'=>'CPAN distribution processed by RPM-Tools',
 		  'summary'=>"http://search.cpan.org/dist/$dname",