From 12bb4a87e13838cdcd898e7d52a91943597dbf34 Mon Sep 17 00:00:00 2001 From: mertz Date: Fri, 13 May 2005 15:52:44 +0000 Subject: - the exported directory is again correctly version-numbered - the $VERSION in Tk::Zinc is computed automatically and updated. --- Perl/export2cpan | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'Perl') diff --git a/Perl/export2cpan b/Perl/export2cpan index 766422e..830e243 100755 --- a/Perl/export2cpan +++ b/Perl/export2cpan @@ -47,7 +47,24 @@ sub version4cpan { close (FD); - return "$major.$minor$patchlevel"; + return sprintf ("%d.%d%02d", $major,$minor,$patchlevel); +} + +sub filesubst { + my ($fileIn, $fileOut, $key, $val) = @_; + + open(FDIN, "<$fileIn") or die "Could not open input file $fileIn"; + open(FDOUT, ">$fileOut") or die "Could not open output file $fileOut"; + + while () { + if (/$key/) { + s/$key/$val/g; + } + print FDOUT $_; + } + + close(FDIN); + close(FDOUT); } my $VERSION; @@ -94,7 +111,7 @@ if ($FROM_CVS) { else { $VERSION = version4cpan; print "cd ..; ./configure\n"; - system ("cd ..; ./configure"); # for creating Zinc.pm and Makefile.pl from xxx.in files + system ("cd ..; ./configure"); # for creating Makefile.pl from xxx.in files } print "VERSION $VERSION\n"; @@ -137,8 +154,9 @@ foreach my $f (@files) { system("$CP $f $EXPORT_DIR/$VERSION_DIR"); } +# modifying the $VERSION of Zinc.pm with the correctly perl formated version scheme. +&filesubst ('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm", '^\$VERSION *=.*;', "\$VERSION = $VERSION;"); -system("$CP Zinc.pm $EXPORT_DIR/$VERSION_DIR"); system("$CP Makefile.PL $EXPORT_DIR/$VERSION_DIR"); system("$CP ../generic/*.c $EXPORT_DIR/$VERSION_DIR"); system("$CP ../generic/*.h $EXPORT_DIR/$VERSION_DIR"); -- cgit v1.1