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

harris41 lon-capa-cvs@mail.lon-capa.org
Tue, 20 Aug 2002 17:59:27 -0000


harris41		Tue Aug 20 13:59:27 2002 EDT

  Modified files:              
    /modules/sharrison/autocpan	make_build_cpan_rpms.pl 
  Log:
  various fixes; now works to generate a temporary binary directory installation
  
  
Index: modules/sharrison/autocpan/make_build_cpan_rpms.pl
diff -u modules/sharrison/autocpan/make_build_cpan_rpms.pl:1.1 modules/sharrison/autocpan/make_build_cpan_rpms.pl:1.2
--- modules/sharrison/autocpan/make_build_cpan_rpms.pl:1.1	Mon Aug 19 16:09:58 2002
+++ modules/sharrison/autocpan/make_build_cpan_rpms.pl	Tue Aug 20 13:59:27 2002
@@ -1,7 +1,7 @@
 # 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 $
+# $Id: make_build_cpan_rpms.pl,v 1.2 2002/08/20 17:59:27 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
@@ -30,30 +30,38 @@
     my ($dname,$dversion) = split(/\s+/);
     my $tag = "cpanbuild-$dname";
     $tag =~ s/\-/\_/g;
+    $sdname = $dname;
+    $sdname =~ s/\-/\_/g;
     unless 
      (-e "../../../loncom/build/system_dependencies/cpanbuild/$dname.commands")
       {
+	print `cp -v make_cpan_rpm.pl tmpbuildrpms/usr/local/cpanbuild/$dname.make_cpan_rpm.pl`;
         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");
+        print(OUT 'cd /usr/local/cpansource/'.$dname.'; '.
+	      'perl Makefile.PL PREFIX="/usr/local/cpansource/'.$dname.
+	      '/TempBinaryDir/usr"; make; '.
+	      'make install'."\n");
+        print(OUT 'cd /usr/local/cpansource/'.$dname.'; '.
+	      'cp -v /usr/local/cpanbuild/'.$dname.'.make_cpan_rpm.pl make_cpan_rpm.pl; find TempBinaryDir | perl make_cpan_rpm.pl cpan_'.$sdname."\n");
+	      
 	close(OUT);
       }
     else
       {
         open(OUT,">tmpbuildrpms/usr/local/cpanbuild/$dname");
         print(OUT '#!/bin/sh'."\n");
-        print(OUT 'cd /usr/local/cpansrc/'.$dname.';');
+        print(OUT 'cd /usr/local/cpansource/'.$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");
+	print(OUT 'cd /usr/local/cpansource/'.$dname.';'.
+	      'make install'."\n");
 	close(OUT);
       }
-
+    `chmod a+rx tmpbuildrpms/usr/local/cpanbuild/$dname`;
     # Try and make an RPM.
     print "Vee shall try and make an RPM ya...\n";
-    my @filelist = ("tmpbuildrpms/usr/local/cpanbuild/$dname");
+    my @filelist = ("tmpbuildrpms/usr/local/cpanbuild/$dname",
+	           "tmpbuildrpms/usr/local/cpanbuild/$dname.make_cpan_rpm.pl");
     my %metadata =
 	         (
 		  'vendor'=>'CPAN build commands for LON-CAPA',
@@ -67,7 +75,7 @@
 				'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."',
+               'pre'=>'echo "Installing CPAN building commands into /usr/local/cpanbuild/.  This only helps build the source of a CPAN distribution.  This will not yet add functionality to your system."',
 		  );
     my %doc;
     my %conf;