diff options
-rwxr-xr-x | Perl/export2cpan | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan index ca058f3..d57c002 100755 --- a/Perl/export2cpan +++ b/Perl/export2cpan @@ -5,6 +5,10 @@ # just pass the release tag as first parameter and the script # will leave a tarball in the current directory after chewing # a moment in /tmp. +# the first argument should be a CVS tag looking like cpan_3_2_95 +# or cpan_3_295. The second underscore will be removed for computing the +# + # In the other case (no parameters) the script supposes we are # in the Perl subdir of a Tkzinc working directory and it will # setup zinc-perl for compilation in export2cpan/tk-zinc-<version>. @@ -16,13 +20,11 @@ use strict; my $ZINC_PREFIX = 'tk-zinc'; my $DEFAULT_SERVER = 'liszt.pii.ath.cena.fr'; - +my $TMP = '/tmp'; sub version4cpan { my $configure_in = "../configure.in"; - $configure_in = $ARGV[0] if ($ARGV[0]); - open(FD, "<$configure_in") or die "Could not open file $configure_in"; my ($major, $minor, $patchlevel); @@ -83,20 +85,24 @@ if ($FROM_CVS) { $server = $ARGV[1]; } print "Building a CPAN release tarball from tag $cvstag.\n"; - $cvstag =~ /^.*?(\d.+)$/; + $cvstag =~ /^.*?([\d_]+)$/; my $tag_version = $1; if ($tag_version =~ /(\d+)_(\d+)_(\d+)/) { $tag_version = "$1_$2$3"; } - $VERSION = version4cpan; - if ($VERSION ne $tag_version) { + $VERSION = version4cpan; # version computed from the source directory + $DIR_FROM_CVS = "$ZINC_PREFIX-$VERSION"; + system("rm -rf $TMP/$DIR_FROM_CVS"); + chdir($TMP); + print "cvs -d :ext:$server:/pii/repository export -r $cvstag -d $DIR_FROM_CVS Tkzinc\n"; + my $error = system("cvs -d :ext:$server:/pii/repository export -r $cvstag -d $DIR_FROM_CVS Tkzinc"); + die "CVS extraction did not succeed" if $error; + chdir($DIR_FROM_CVS); + my $EXTRACTED_VERSION = version4cpan; # version gotten from the tagged CVS files + if ($EXTRACTED_VERSION ne $tag_version) { print "Oops! the tag version does not match the version in the sources, aborting\n"; exit(1); } - $DIR_FROM_CVS = "/tmp/$ZINC_PREFIX-$VERSION"; - system("rm -rf $DIR_FROM_CVS"); - system("cvs -d :ext:$server:/pii/repository export -r $cvstag -d $DIR_FROM_CVS Tkzinc"); - chdir($FROM_CVS); } else { $VERSION = version4cpan; @@ -151,5 +157,5 @@ if ($FROM_CVS) { system("tar zcf $CWD/$ZINC_PREFIX-$VERSION.tar.gz $VERSION_DIR"); chdir($CWD); print "The tarball is in $CWD/$ZINC_PREFIX-$VERSION.\n"; - print "You may want to clean up after testing in $DIR_FROM_CVS\n"; + print "You may want to clean up after testing in $TMP$DIR_FROM_CVS\n"; } |