From dab28022cb58e90c6ab61ca17c7572b0b1962a60 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 1 Apr 2009 00:31:35 +0000 Subject: [PATCH] * fix a few minor errors in the generated packages --- cran2deb | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/cran2deb b/cran2deb index cfd91a1..7ac54bc 100755 --- 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} <{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} <{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 '; isbinary(\%pkg); write_control(\%pkg,$maint); write_copyright(\%pkg,$maint); -- 2.39.5