aboutsummaryrefslogtreecommitdiff
path: root/Perl/export2cpan
diff options
context:
space:
mode:
authormertz2004-03-23 15:46:11 +0000
committermertz2004-03-23 15:46:11 +0000
commit782c6af524df52a7264875ab5defd7c9f43a3015 (patch)
tree655932533a947fbf9a72271b8c563a0b9998732a /Perl/export2cpan
parentbfcdb3b51ea88028b63f3f2d9577659e4119d20a (diff)
downloadtkzinc-782c6af524df52a7264875ab5defd7c9f43a3015.zip
tkzinc-782c6af524df52a7264875ab5defd7c9f43a3015.tar.gz
tkzinc-782c6af524df52a7264875ab5defd7c9f43a3015.tar.bz2
tkzinc-782c6af524df52a7264875ab5defd7c9f43a3015.tar.xz
- use now rsync if available rather than cp, to limit the need of
recompiling the whole Tkzinc for slight modification
Diffstat (limited to 'Perl/export2cpan')
-rwxr-xr-xPerl/export2cpan57
1 files changed, 43 insertions, 14 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan
index f40950e..6e385f9 100755
--- a/Perl/export2cpan
+++ b/Perl/export2cpan
@@ -112,31 +112,60 @@ else {
print "VERSION $VERSION\n";
+# using rsync if available rather than cp
+my $CP = 'cp -r';
+my $CPonlyIfDifferent = 'cp -r';
+my $RSYNC = 0;
+if (-x '/usr/bin/rsync') {
+ $CP = '/usr/bin/rsync -rp'; # the --delete option has been removed to avoid deleting Makefile in demos
+ $CPonlyIfDifferent = '/usr/bin/rsync -rc';
+# print "\$CP = '$CP'\n";
+ $RSYNC = 1;
+} elsif (-x '/usr/local/bin/rsync') {
+ $CP = '/usr/local/bin/rsync -rp'; # the --delete option has been removed to avoid deleting Makefile in demos
+ $CPonlyIfDifferent = '/usr/local/bin/rsync -rc';
+# print "\$CP = '$CP'\n";
+ $RSYNC = 1;
+}
+
my $EXPORT_DIR = '../export2cpan';
my $VERSION_DIR = "$ZINC_PREFIX-$VERSION";
+
+if (-d "$EXPORT_DIR/$VERSION_DIR" and !$RSYNC) {
+ system("rm -rf $EXPORT_DIR/$VERSION_DIR");
+}
+
if (! -d $EXPORT_DIR) {
mkdir($EXPORT_DIR);
}
-if (-d "$EXPORT_DIR/$VERSION_DIR") {
- system("rm -rf $EXPORT_DIR/$VERSION_DIR");
+if (! -d "$EXPORT_DIR/$VERSION_DIR") {
+ mkdir("$EXPORT_DIR/$VERSION_DIR");
}
-mkdir("$EXPORT_DIR/$VERSION_DIR");
symlink ("$EXPORT_DIR/$VERSION_DIR", "$EXPORT_DIR/$ZINC_PREFIX");
my @files=('t', 'Zinc.xs', 'demos', 'README', 'Zinc');
+
+
foreach my $f (@files) {
- system("cp -r $f $EXPORT_DIR/$VERSION_DIR");
+ system("$CP $f $EXPORT_DIR/$VERSION_DIR");
}
-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("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 ../debian/copyright $EXPORT_DIR/$VERSION_DIR/COPYRIGHT");
+
+filesubst('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm-new", 'CONF_VERS', $VERSION);
+system("$CPonlyIfDifferent $EXPORT_DIR/$VERSION_DIR/Zinc.pm-new $EXPORT_DIR/$VERSION_DIR/Zinc.pm");
+unlink "$EXPORT_DIR/$VERSION_DIR/Zinc.pm-new";
+
+filesubst('Makefile.PL', "$EXPORT_DIR/$VERSION_DIR/Makefile.PL-new", 'CONF_VERS', $VERSION);
+system("$CPonlyIfDifferent $EXPORT_DIR/$VERSION_DIR/Makefile.PL-new $EXPORT_DIR/$VERSION_DIR/Makefile.PL");
+unlink "$EXPORT_DIR/$VERSION_DIR/Makefile.PL-new";
+
+
+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 ../debian/copyright $EXPORT_DIR/$VERSION_DIR/COPYRIGHT");
#
# If working for an exported copy, build a tarball in the