use Cwd;
use POSIX qw(strftime);
-use vars qw($DEBUG);
+use Text::Wrap qw(wrap);
+use IO::File;
+
+use vars qw($DEBUG $VERSION);
+
+$VERSION='0.1';
my %options = (debug => 0,
help => 0,
$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;
#!/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)
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;
}
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
$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
sub write_changelog {
my ( $pkg, $maintainer) = @_;
- my $dbfile = $dbdir . "/" . $pkg->{DebName};
my $file = $pkg->{BuildDir} . "/debian/changelog";
- print "generating changelog ...\n" if $main::verbose;
+ print "generating changelog ...\n" if $DEBUG;
my $changelog = IO::File->new($file,'w') or die "unable to open $file for writing: $!";
my $description = '';
{
local $/;
- $description = <>;
+ $description = <$description_fh>;
}
$description =~ s/^\#[^\n]+//g;
$description =~ s/\n\s+//g;
-my %description = map {/^([^:]+):\s+(.+)/?(lc($1),$2):()} split /\n/ $description;
+my %description = map {/^([^:]+):\s+(.+)/?(lc($1),$2):()} split /\n/, $description;
my %pkg;
$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);