summaryrefslogtreecommitdiff
path: root/ext/mysql/libmysql/update_sources
diff options
context:
space:
mode:
authorMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
committerMySQL Team <mysql@php.net>2001-01-23 16:48:50 +0000
commit800f555b707c696798877c80352ded46289e87c4 (patch)
treec540242b6e6da4e9b99b46797a26b215abef0a64 /ext/mysql/libmysql/update_sources
parentd36858681a0d48414702524ebd16f31289b06fa8 (diff)
downloadphp-git-800f555b707c696798877c80352ded46289e87c4.tar.gz
Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
that the client can now connect to a server which is using a default charset other than latin1.
Diffstat (limited to 'ext/mysql/libmysql/update_sources')
-rwxr-xr-xext/mysql/libmysql/update_sources94
1 files changed, 94 insertions, 0 deletions
diff --git a/ext/mysql/libmysql/update_sources b/ext/mysql/libmysql/update_sources
new file mode 100755
index 0000000000..8a3919022e
--- /dev/null
+++ b/ext/mysql/libmysql/update_sources
@@ -0,0 +1,94 @@
+#! /usr/bin/perl -w
+
+# Maybe I should have used PHP instead? ;)
+
+use strict;
+$| = 1;
+
+-f "libmysql.c" or die "$0 must be run from the libmysql directory\n";
+
+my $command = shift || usage();
+$command =~ /^--(?:update|huh|restore)$/ or usage();
+
+my $from = shift || '/users/tim/my/work';
+my @source_dirs = qw/dbug strings mysys libmysql include/;
+my $source_re = qr/\.(?:cc?|h)$/;
+my %skip = (
+ 'ctype_autoconf.c' => 1,
+ 'ctype_extra_sources.c' => 1,
+ 'my_config.h' => 1,
+);
+
+opendir D, "."
+ or die "can't opendir .: $!\n";
+my @files = grep { /$source_re/ and !$skip{$_} } readdir D;
+closedir D;
+
+if ($command eq '--restore')
+{
+ foreach (@files)
+ {
+ -f "$_.orig" and
+ system("mv -f $_.orig $_") and die "can't restore $_: $!\n";
+ }
+ exit 0;
+}
+
+if ($command eq '--huh')
+{
+ diff_files();
+ exit 0;
+}
+
+my %sources;
+foreach my $d (@source_dirs)
+{
+ opendir D, "$from/$d" or die "opendir $from/$d: $!\n";
+ foreach (grep { /$source_re/ } readdir D)
+ {
+ $sources{$_} ||= "$d/$_";
+ }
+ closedir D;
+}
+
+foreach my $f (@files)
+{
+ my $s = $sources{$f} or die "can't find source file for $f\n";
+ unlink "$f.orig";
+ system("mv $f $f.orig") and die "can't move $f: $!\n";
+ #print ">> ", scalar(`ls -l $from/$s`), "\n";
+ print ">> $s\n";
+ system("cp $from/$s $f") and die "can't copy $from/$s: $!\n";
+ #print "]] ", scalar(`ls -l $f`), "\n";
+}
+
+system("chmod u+w @files") and die "can't set perms on files: $!\n";
+system("./fix_copyright @files") and die "can't fix copyright: $!\n";
+diff_files();
+
+exit 0;
+
+
+sub usage
+{
+ die <<"EOF";
+usage: $0 --update [mysql-source-dir]
+ $0 --huh
+ $0 --restore
+EOF
+}
+
+sub diff_files {
+ foreach my $f (@files)
+ {
+ if (!-f "$f.orig" or !system("diff -u $f.orig $f"))
+ {
+ print STDERR "SAME: $f\n";
+ unlink "$f.orig";
+ }
+ else
+ {
+ print STDERR "DIFF: $f\n";
+ }
+ }
+}