aboutsummaryrefslogtreecommitdiff
path: root/Perl/export2cpan
diff options
context:
space:
mode:
authorlecoanet2003-10-05 15:24:04 +0000
committerlecoanet2003-10-05 15:24:04 +0000
commit472e8356c2baba2c03eba13a06ffaf5564102b09 (patch)
treec1a5fe87f5271c5b5f3bf7b1050c2be2ed0bde6d /Perl/export2cpan
parent7e151c2001d673ee06e273ed47cdd354b4ba4f22 (diff)
downloadtkzinc-472e8356c2baba2c03eba13a06ffaf5564102b09.zip
tkzinc-472e8356c2baba2c03eba13a06ffaf5564102b09.tar.gz
tkzinc-472e8356c2baba2c03eba13a06ffaf5564102b09.tar.bz2
tkzinc-472e8356c2baba2c03eba13a06ffaf5564102b09.tar.xz
Added the capability to make a distrib/compile directory
directly out of repository by specifying a valid cvs tag. Merged the CPAN oriented features Christophe had made in CPANising-tkzinc.pl of which it is the intended successor.
Diffstat (limited to 'Perl/export2cpan')
-rwxr-xr-xPerl/export2cpan117
1 files changed, 93 insertions, 24 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan
index 1ed383e..41a8280 100755
--- a/Perl/export2cpan
+++ b/Perl/export2cpan
@@ -1,7 +1,23 @@
#!/usr/bin/perl
+#
+# If we want to extract a release right out of the repository
+# 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.
+# 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>.
+# The source files are taken from the working directory. This is
+# the anticipated behavior when developping/testing or making
+# a debian package from the rules file.
+
use strict;
+my $ZINC_PREFIX = 'tk-zinc';
+my $DEFAULT_SERVER = 'liszt.pii.ath.cena.fr';
+
+
sub version4cpan {
my $configure_in = "../configure.in";
@@ -50,37 +66,90 @@ sub filesubst {
close(FDOUT);
}
-my $version = version4cpan;
-
-print "VERSION $version\n";
-
-my $EXPORT_DIR="../export2cpan";
-if (! -d $EXPORT_DIR) {
- mkdir $EXPORT_DIR;
+my $VERSION;
+my $FROM_CVS = (scalar(@ARGV) != 0);
+my $DIR_FROM_CVS;
+my $CWD;
+chomp($CWD = `pwd`);
+#
+# See if parameters are given (there should be a cvs tag
+# and may be the repository machine).
+#
+if ($FROM_CVS) {
+ my $tag_version;
+ my $cvstag = $ARGV[0];
+ my $server = $DEFAULT_SERVER;
+ if (scalar(@ARGV) == 2) {
+ $server = $ARGV[1];
+ }
+ print "Building a CPAN release tarball from tag $cvstag.\n";
+ $cvstag =~ /^.*?(\d.+)$/;
+ my $tag_version = $1;
+ if ($tag_version =~ /(\d+)_(\d+)_(\d+)/) {
+ $tag_version = "$1_$2$3";
+ }
+ $VERSION = version4cpan;
+ if ($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;
}
-my $VERSION_DIR="$EXPORT_DIR/tk-zinc-$version";
+print "VERSION $VERSION\n";
-if (! -d $VERSION_DIR) {
- mkdir $VERSION_DIR;
+my $EXPORT_DIR = '../export2cpan';
+my $VERSION_DIR = "$ZINC_PREFIX-$VERSION";
+if (! -d $EXPORT_DIR) {
+ mkdir($EXPORT_DIR);
}
-else {
- system "rm -rf $VERSION_DIR";
- mkdir $VERSION_DIR;
+if (-d "$EXPORT_DIR/$VERSION_DIR") {
+ system("rm -rf $EXPORT_DIR/$VERSION_DIR");
}
+mkdir("$EXPORT_DIR/$VERSION_DIR");
-my @files=('t', 'Zinc.xs', 'trace', 'demos',
- 'Zinc', 'ZincTrace');
+
+my @files=('t', 'Zinc.xs', 'trace', 'demos', 'README', 'Zinc', 'ZincTrace');
foreach my $f (@files) {
- system "cp -r $f $VERSION_DIR";
+ system("cp -r $f $EXPORT_DIR/$VERSION_DIR");
}
-filesubst('Zinc.pm', "$VERSION_DIR/Zinc.pm", 'CONF_VERS', $version);
-filesubst('Makefile.PL', "$VERSION_DIR/Makefile.PL", 'CONF_VERS', $version);
+filesubst('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm", 'CONF_VERS', $VERSION);
+filesubst('Makefile.PL', "$EXPORT_DIR/$VERSION_DIR/Makefile.PL", 'CONF_VERS', $VERSION);
-#system "echo $version > $VERSION_DIR/VERSION";
+system("cp ../libtess/*.c $EXPORT_DIR/$VERSION_DIR");
+system("cp ../libtess/*.h $EXPORT_DIR/$VERSION_DIR");
+system("cp ../generic/*.c $EXPORT_DIR/$VERSION_DIR");
+system("cp ../generic/*.h $EXPORT_DIR/$VERSION_DIR");
+system("cp ../win/*.c $EXPORT_DIR/$VERSION_DIR");
+system("cp ../debian/changelog $EXPORT_DIR/$VERSION_DIR/Changes");
-system "cp ../libtess/*.c $VERSION_DIR";
-system "cp ../libtess/*.h $VERSION_DIR";
-system "cp ../generic/*.c $VERSION_DIR";
-system "cp ../generic/*.h $VERSION_DIR";
-system "cp ../win/*.c $VERSION_DIR";
+#
+# If working for an exported copy, build a tarball in the
+# current dir.
+#
+if ($FROM_CVS) {
+ chdir("$EXPORT_DIR/$VERSION_DIR");
+
+ #
+ # Remove the .cvsignore files
+ system('find . -name .cvsignore | xargs rm -f');
+
+ #
+ # Create the MANIFEST file
+ use ExtUtils::Manifest qw( mkmanifest );
+ $ExtUtils::Manifest::Quiet = 1;
+ &mkmanifest();
+
+ chdir('..');
+
+ 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";
+}