[pkg-bioc] svn commit r312 r312 - /trunk/tools/CRAN2DEB.pm
psychedelys-guest at users.alioth.debian.org
psychedelys-guest at users.alioth.debian.org
Sun Sep 16 16:55:48 UTC 2007
Author: psychedelys-guest
Date: Sun Sep 16 16:55:48 2007
New Revision: 312
URL: http://svn.debian.org/wsvn/pkg-bioc/?sc=1&rev=312
Log:
actived the use strict + corrected the problem in CRAN2DEB.pm
Modified:
trunk/tools/CRAN2DEB.pm
Modified: trunk/tools/CRAN2DEB.pm
URL: http://svn.debian.org/wsvn/pkg-bioc/trunk/tools/CRAN2DEB.pm?rev=312&op=diff
==============================================================================
--- trunk/tools/CRAN2DEB.pm (original)
+++ trunk/tools/CRAN2DEB.pm Sun Sep 16 16:55:48 2007
@@ -7,8 +7,8 @@
package CRAN2DEB;
-require strict;
-require warnings;
+use strict;
+use warnings;
require Exporter;
use Data::Dumper;
@@ -17,8 +17,8 @@ use Text::Wrap;
use File::Copy;
use Cwd;
- at ISA = qw(Exporter); # make these symbols known
- at EXPORT = qw(lowerCase
+our @ISA = qw(Exporter); # make these symbols known
+our @EXPORT = qw(lowerCase
getDepth
areHereFilesToCompile
writeRules
@@ -35,15 +35,15 @@ use Cwd;
# writePostinst
# writePostrm
- at EXPORT_OK = qw( );
-%EXPORT_TAGS = ( all => [@EXPORT_OK] );
+our @EXPORT_OK = qw( );
+our %EXPORT_TAGS = ( all => [@EXPORT_OK] );
my $VERSION = sprintf( "%d.%d", q$Revision: 1.39 $ =~ /(\d+)\.(\d+)/ );
my $DEBVERPREPEND = "0.r2d.";
# function for lowcasing package names:
-sub lowerCase {
+sub lowerCase ($) {
my $name = shift;
#my $oldname=$name;
@@ -75,7 +75,7 @@ sub areHereFilesToCompile($) {
my $d = shift;
if ( !-r $d ) {
- $dd = "../$d";
+ my $dd = "../$d";
if ( !-r $dd ) {
print STDERR "Could not find anything readable at '$d' or '$dd'\n";
@@ -92,7 +92,7 @@ sub areHereFilesToCompile($) {
# not cached. May be a programming error unless the R packages
# start generating C code.
open( PIPE, "find $d|" )
- or die "Cannot run find(1) as '$command' on '$d' with CWD = "
+ or die "Cannot run find(1) as '\$command' on '$d' with CWD = "
. getcwd() . "\n";
}
elsif ( -r $d ) {
@@ -123,7 +123,7 @@ sub writeRules($$$) {
my $repository = $main::repository;
my $file = $pkg->{DebDir} . "/debian/rules";
- sysopen( FILE, $file, O_WRONLY | O_CREAT | O_ECXL, 0755 )
+ sysopen( FILE, $file, O_WRONLY | O_CREAT | O_EXCL, 0755 )
or die "cannot open $file";
print "generating rules ...\n" if $main::verbose;
@@ -147,10 +147,12 @@ include /usr/share/dpatch/dpatch.make
EOT
;
+
+ # TODO : check the next block, as it's seam to be too strange,...
if ( defined($targets) ) {
print "*** Found extra targets for package " . $pkg->{Package} . "\n";
- foreach my $aref ( $extraTaget{ $pkg->{Package} } ) {
- foreach my $tref ( @{$targets} ) {
+ foreach my $aref ( $targets->{ $pkg->{Package} } ) {
+ foreach my $tref ( @{$aref} ) {
my @t = @$tref;
print " Adding target " . $t[0] . "\n";
print FILE $t[0] . " " . $t[1] . "\n\t" . $t[2] . "\n\n";
@@ -159,7 +161,7 @@ EOT
}
else {
print "*** No extra targets found for package " . $pkg->{Package} . "\n"
- if $verbose;
+ if $main::verbose;
}
close(FILE);
chmod( 0755, $file ) or die "Cannot chmod $file\n";
@@ -172,13 +174,13 @@ sub writeConfig($$$$) {
#print Dumper(\$pkg);
my $file = $pkg->{DebDir} . "/debian/control";
- sysopen( FILE, $file, O_WRONLY | O_CREAT | O_ECXL, 0644 )
+ sysopen( FILE, $file, O_WRONLY | O_CREAT | O_EXCL, 0644 )
or die "cannot open $file";
print "generating control ...\n" if $main::verbose;
#$indep="-Indep"; # I think this is not correct since we need all packages anyway for compilation
# and against Debian Policy
- $indep = "";
+ my $indep = "";
if ( !exists( $pkg->{isBinary} ) ) {
if ( areHereFilesToCompile( $pkg->{DebDir} . "/src" )
or areHereFilesToCompile( $pkg->{DebDir} ) )
@@ -201,13 +203,13 @@ sub writeConfig($$$$) {
$pkg->{archdeps} = "";
}
- $dps = "";
- foreach $dep ( @{ $pkg->{debiandependencies} } ) {
+ my $dps = "";
+ foreach my $dep ( @{ $pkg->{debiandependencies} } ) {
$dps = $dps . ", " . $dep;
}
- $bdps = "";
- foreach $dep ( @{ $pkg->{debianbuilddependencies} } ) {
+ my $bdps = "";
+ foreach my $dep ( @{ $pkg->{debianbuilddependencies} } ) {
$bdps = $bdps . ", " . $dep;
}
@@ -245,6 +247,7 @@ sub writeConfig($$$$) {
print FILE wrap( " ", " ", $pkg->{Title}, ".\n" );
}
+ my $desc;
if ( !defined( $pkg->{Contains} ) ) {
$desc = $pkg->{Description};
}
@@ -271,10 +274,10 @@ sub writeConfig($$$$) {
}
if ( exists( $pkg->{Tag} ) ) {
if ( defined( $pkg->{Tag} ) ) {
- print FILE "Tag: " . $pkg->{Tag} . "\n" if $tagsincontrol;
- if ($tagsfile) {
- if ( open( TAGSFILE, ">>$tagsfile" )
- or print "Could not open tagsfile at '$tagsfile'.\n" )
+ print FILE "Tag: " . $pkg->{Tag} . "\n" if $main::tagsincontrol;
+ if ($main::tagsfile) {
+ if ( open( TAGSFILE, ">>$main::tagsfile" )
+ or print "Could not open tagsfile at '$main::tagsfile'.\n" )
{
print TAGSFILE $pkg->{DebNamePackage} . ": "
. $pkg->{Tag} . "\n";
@@ -291,6 +294,7 @@ sub writeCopyright($$) {
my ( $pkg, $maintainer ) = @_;
my $repository = $main::repository;
+ my $license;
if ( !defined( ( $pkg->{License} ) ) ) {
$license = "unknown";
}
@@ -299,7 +303,7 @@ sub writeCopyright($$) {
$license =~ s/\n//g;
}
my $file = $pkg->{DebDir} . "/debian/copyright";
- sysopen( FILE, $file, O_RDWR | O_CREAT | O_ECXL, 0644 )
+ sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCL, 0644 )
or die "cannot open file '$file'\n";
print "generating copyright ...\n" if $main::verbose;
print FILE <<EOT
@@ -337,19 +341,19 @@ sub writeReadme($$) {
my ( $pkg, $maintainer ) = @_;
my $file = $pkg->{DebDir} . "/debian/README.Debian";
- sysopen( FILE, $file, O_RDWR | O_CREAT | O_ECXL, 0644 )
+ sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCL, 0644 )
or die "cannot open $file";
print "generating README.Debian ...\n" if $main::verbose;
- $date = POSIX::strftime "%a, %e %b %Y %H:%M:%S %z", localtime;
- print FILE "r-$repository-$pkg->{DebName} for Debian\n\n";
+ my $date = POSIX::strftime "%a, %e %b %Y %H:%M:%S %z", localtime;
+ print FILE "r-$main::repository-$pkg->{DebName} for Debian\n\n";
print FILE "This Debian package was created from sources on the \n";
- print FILE "Comprehensive R Archive Network" if $repository =~ /cran/;
- print FILE "BioConductor project" if $repository =~ /bioc/;
- print FILE "Omegahat" if $repository =~ /omegahat/;
+ print FILE "Comprehensive R Archive Network" if $main::repository =~ /cran/;
+ print FILE "BioConductor project" if $main::repository =~ /bioc/;
+ print FILE "Omegahat" if $main::repository =~ /omegahat/;
print FILE " site, accessible at ";
- print FILE "http://cran.r-project.org/" if $repository =~ /cran/;
- print FILE "http://www.bioconductor.org/" if $repository =~ /cran/;
- print FILE "http://www.omegahat.org/" if $repository =~ /cran/;
+ print FILE "http://cran.r-project.org/" if $main::repository =~ /cran/;
+ print FILE "http://www.bioconductor.org/" if $main::repository =~ /cran/;
+ print FILE "http://www.omegahat.org/" if $main::repository =~ /cran/;
print FILE ".\n";
print FILE <<EOT
@@ -392,11 +396,12 @@ sub getDebianVersion($$$) {
# check if the versions of CRAN2DEB.pm and cran2deb.pl have
# changed
# First get the versions used for the last build
- open( DBFILE, "$dbfile" );
+ open( DBFILE, "$dbfile" ) or die "cannot open $dbfile";
my $clPMversion = "";
+ my $clPLversion = "";
my $done = 0;
my $okVersion = $debversion;
- while ( ( my $line = <DBFILE> ) && !$done ) {
+ while ( defined( my $line = <DBFILE> ) && !$done ) {
print "CL: $line" if $main::verbose;
if ( $line =~ /$pkg->{DebName} \($pkg->{DebVersion}-(.*)\)/ ) {
$okVersion = $1;
@@ -434,14 +439,14 @@ sub getDebianVersion($$$) {
$debversion = "$DEBVERPREPEND" . $counter;
print "Trying deb version $debversion\n" if $main::verbose;
my $failed = 0;
- open( DBFILE, "$dbfile" );
- while ( ( my $line = <DBFILE> ) && !$failed ) {
+ open( DBFILE, "$dbfile" ) or die "cannot open $dbfile";
+ while ( defined( my $line = <DBFILE> ) && !$failed ) {
print "CL: $line" if $main::verbose;
if ( $line =~ /$pkg->{DebName} \($pkg->{DebVersion}-$debversion\)/ )
{
print "Version $debversion already used!" if $main::verbose;
$failed = 1;
- break;
+ die "Version $debversion already used!";
}
}
close(DBFILE);
@@ -467,7 +472,7 @@ sub writeChangelog($$$$) {
sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCL, 0644 )
or die "cannot open $file";
- $date = POSIX::strftime "%a, %e %b %Y %H:%M:%S %z", localtime;
+ my $date = POSIX::strftime "%a, %e %b %Y %H:%M:%S %z", localtime;
print FILE <<EOT
$pkg->{DebName} ($pkg->{DebRelease}) unstable; urgency=low
@@ -503,7 +508,7 @@ EOT
# my $repository = $main::repository;
# my $file = $pkg->{DebDir} . "/debian/postinst";
-# sysopen( FILE, $file, O_RDWR | O_CREAT | O_ECXL, 0644 )
+# sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCL, 0644 )
# or die "cannot open $file";
# print "generating postinst ...\n" if $main::verbose;
@@ -541,7 +546,7 @@ EOT
# my $repository = $main::repository;
# my $file = $pkg->{DebDir} . "/debian/postrm";
-# sysopen( FILE, $file, O_RDWR | O_CREAT | O_ECXL, 0644 )
+# sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCX, 0644 )
# or die "cannot open $file";
# print "generating postrm ...\n" if $main::verbose;
@@ -575,38 +580,38 @@ EOT
# chmod( 0755, $file ) or die "Cannot chmod $file\n";
# }
-sub writeFiles($$) { # not really needed
- my ( $pkg, $maintainer ) = @_;
-
- my $file = $pkg->{DebDir} . "/debian/files";
- sysopen( FILE, $file, O_RDWR | O_CREAT | O_ECXL, 0644 )
- or die "cannot open $file";
- print "generating files ...\n" if $main::verbose;
-
- if ( defined( $pkg->{Contains} ) ) {
- @subpackages = split( /\s+/, $pkg->{Contains} );
- }
-
- if ( !defined( $pkg->{Contains} ) ) {
- print FILE <<EOT
-$prefix/lib/R/site-library/$pkg->{Package}
-EOT
- ;
- }
- else {
- foreach $subdir (@subpackages) {
- print FILE <<EOT
-$prefix/lib/R/site-library/$subdir
-EOT
- ;
- }
- }
- close(FILE);
-}
+#sub writeFiles($$) { # not really needed
+# my ( $pkg, $maintainer ) = @_;
+#
+# my $file = $pkg->{DebDir} . "/debian/files";
+# sysopen( FILE, $file, O_RDWR | O_CREAT | O_EXCL, 0644 )
+# or die "cannot open $file";
+# print "generating files ...\n" if $main::verbose;
+#
+# my @subpackages;
+# if ( defined( $pkg->{Contains} ) ) {
+# @subpackages = split( /\s+/, $pkg->{Contains} );
+# }
+#
+# if ( !defined( $pkg->{Contains} ) ) {
+# print FILE <<EOT
+#$prefix/lib/R/site-library/$pkg->{Package}
+#EOT
+# ;
+# }
+# else {
+# foreach my $subdir (@subpackages) {
+# print FILE <<EOT
+#$prefix/lib/R/site-library/$subdir
+#EOT
+# ;
+# }
+# }
+# close(FILE);
+#}
sub writePatches($$) {
- my $pkg = shift;
- my $patchlistref = shift;
+ my ( $pkg, $patchlistref) = @_ ;
my $patchessourcedir = "../patches";
if ( !-d $patchessourcedir ) {
print STDERR
@@ -614,7 +619,7 @@ sub writePatches($$) {
. getcwd() . "\n";
print STDERR " *** continuing anyway\n";
}
- $prefix = $pkg->{DebDir} . "/debian";
+ my $prefix = $pkg->{DebDir} . "/debian";
if ( !-d "$prefix/patches" ) {
mkdir("$prefix/patches")
or die "Could not create directory $prefix/patches.\n";
@@ -638,7 +643,7 @@ sub writePatches($$) {
}
else {
print "*** No patches found for package " . $pkg->{Package} . "\n"
- if $verbose;
+ if $main::verbose;
}
}
@@ -667,7 +672,7 @@ Options:
between repositories (set to '$main::dbname')
--binarch arch binary architecture
--maxsize <MB> set max size of source package in Megabyte
- (set to $maxsize MB)
+ (set to $main::maxsize MB)
--subset regexp regular expression to match package name
(set to '$main::subsetstring')
--repository path repository
More information about the pkg-bioc-devel
mailing list