]> git.donarmstrong.com Git - bin.git/commitdiff
* fix a few minor errors in the generated packages
authorDon Armstrong <don@donarmstrong.com>
Wed, 1 Apr 2009 00:31:35 +0000 (00:31 +0000)
committerDon Armstrong <don@donarmstrong.com>
Wed, 1 Apr 2009 00:31:35 +0000 (00:31 +0000)
cran2deb

index cfd91a1f3bc8dfbbaf8dc989fb73d6062f97d11f..7ac54bc0965b1c8db3cb42461faec8ccd4b21411 100755 (executable)
--- a/cran2deb
+++ b/cran2deb
@@ -53,8 +53,11 @@ use Cwd;
 use POSIX qw(strftime);
 
 use Text::Wrap qw(wrap);
+use IO::File;
 
-use vars qw($DEBUG);
+use vars qw($DEBUG $VERSION);
+
+$VERSION='0.1';
 
 my %options = (debug           => 0,
               help            => 0,
@@ -70,9 +73,9 @@ pod2usage({verbose=>2}) if $options{man};
 $DEBUG = $options{debug};
 
 my @USAGE_ERRORS;
-if (1) {
-     push @USAGE_ERRORS,"You must pass something";
-}
+#if (1) {
+#     push @USAGE_ERRORS,"You must pass something";
+#}
 
 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
 
@@ -107,7 +110,7 @@ sub write_rules {
 #!/usr/bin/make -f
 # -*- makefile -*-
 # debian/rules file for the Debian/GNU Linux package \'r-$repository-$name\'
-# Copyright 2004-$year by $maintainer\n";
+# Copyright 2004-$year by $maintainer
 #
 # automatically generated on $now by cran2deb (DLA mod)
 
@@ -130,8 +133,7 @@ EOF
 sub isbinary {
     my ($pkg) = @_;
     if ( !exists( $pkg->{isBinary} ) ) {
-        if (   areHereFilesToCompile( $pkg->{BuildDir} . "/src" )
-            or areHereFilesToCompile( $pkg->{BuildDir} ) )
+        if (-e "$pkg->{BuildDir}/src")
         {
             $pkg->{isBinary} = 1;
         }
@@ -267,11 +269,11 @@ sub write_copyright {
     my $copyright = IO::File->new($file,'w') or die "unable to open $file for writing: $!";
     print "generating copyright ...\n" if $DEBUG;
     print {$copyright} <<EOT;
-This is the Debian GNU/Linux r-$repository-$pkg->{DebName} package of $pkg->{Package}.
+This is the Debian GNU/Linux $pkg->{DebName} package of $pkg->{Package}.
 It was written by $pkg->{Author}.
 
 This package was created by $maintainer
-using the automated build script cran2deb version $main::VERSION. Cran2deb 
+using the automated build script cran2deb version $VERSION. Cran2deb 
 is a modified and extended version of Albrecht Gebhardt's build script
        http://www.math.uni-klu.ac.at/~agebhard/build-R-contrib-debs.pl
 The package sources were downloaded from 
@@ -316,7 +318,7 @@ sub write_readme {
        $repository_url = 'http://cran.r-project.org/';
     }
     print {$readme} <<EOF;
-r-$pkg->{Repository}-$pkg->{DebName} for Debian
+$pkg->{DebName} for Debian
 
 This Debian package was created from sources on the
 $repository site, accessible at
@@ -375,7 +377,7 @@ my $description_fh = IO::File->new('DESCRIPTION','r') or
 my $description = '';
 {
     local $/;
-    $description = <>;
+    $description = <$description_fh>;
 }
 $description =~ s/^\#[^\n]+//g;
 $description =~ s/\n\s+//g;
@@ -386,11 +388,15 @@ $pkg{BuildDir} = getcwd;
 $pkg{Repository} = 'cran';
 $pkg{DebName} = 'r-cran-'.lc($description{package});
 $pkg{DebNamePackage} = $pkg{DebName};
+$pkg{Package} = $description{package};
+$pkg{Author} = $description{author};
+$pkg{DebRelease} = $description{version}.'-1';
 $pkg{Title} = $description{title};
 $pkg{Description} = defined $description{contains}?$description{bundledescription}:$description{description};
 $pkg{License} = $description{license};
+$pkg{section} = 'main';
 mkdir('debian') if not -d 'debian';
-my $maint = 'Don Armstrong don@debian.org';
+my $maint = 'Don Armstrong <don@debian.org>';
 isbinary(\%pkg);
 write_control(\%pkg,$maint);
 write_copyright(\%pkg,$maint);