diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.am | 9 | ||||
-rw-r--r-- | scripts/fill_help_tables.sh | 47 | ||||
-rw-r--r-- | scripts/make_sharedlib_distribution.sh | 117 | ||||
-rwxr-xr-x | scripts/make_win_src_distribution.sh | 61 | ||||
-rw-r--r-- | scripts/mysql_config.sh | 24 | ||||
-rw-r--r-- | scripts/mysql_create_system_tables.sh | 2 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sql | 35 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 14 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 22 |
9 files changed, 264 insertions, 67 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 7ccf35b9580..48592d2ff00 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -17,7 +17,6 @@ ## Process this file with automake to create Makefile.in bin_SCRIPTS = @server_scripts@ \ - make_win_src_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ @@ -34,9 +33,11 @@ bin_SCRIPTS = @server_scripts@ \ mysql_explain_log \ mysql_tableinfo \ mysqld_multi \ + make_win_src_distribution \ mysql_create_system_tables EXTRA_SCRIPTS = make_binary_distribution.sh \ + make_sharedlib_distribution.sh \ make_win_src_distribution.sh \ msql2mysql.sh \ mysql_config.sh \ @@ -69,7 +70,7 @@ dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql # failures with it. CLEANFILES = @server_scripts@ \ make_binary_distribution \ - make_win_src_distribution \ + make_sharedlib_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ @@ -83,6 +84,7 @@ CLEANFILES = @server_scripts@ \ mysqlhotcopy \ mysqldumpslow \ mysqld_multi \ + make_win_src_distribution \ fill_help_tables \ mysql_create_system_tables @@ -119,6 +121,7 @@ SUFFIXES = .sh -e 's!@''CLIENT_LIBS''@!@CLIENT_LIBS@!' \ -e 's!@''LIBS''@!@LIBS@!' \ -e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \ + -e 's!@''openssl_libs''@!@openssl_libs@!' \ -e 's!@''VERSION''@!@VERSION@!' \ -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \ -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \ @@ -140,7 +143,7 @@ SUFFIXES = .sh # Don't update the files from bitkeeper %::SCCS/s.% -all: fill_help_tables.sql make_win_src_distribution make_binary_distribution +all: fill_help_tables.sql make_win_src_distribution make_binary_distribution make_sharedlib_distribution fill_help_tables.sql: fill_help_tables ../Docs/manual.texi ./fill_help_tables < ../Docs/manual.texi > fill_help_tables.sql diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh index b8cf4ccb3a7..cb5437f7178 100644 --- a/scripts/fill_help_tables.sh +++ b/scripts/fill_help_tables.sh @@ -35,7 +35,7 @@ # @c example_for_help_topic <topic_name> # @example # .... -# @example +# @end example # # # Original version by Victor Vagin <vva@mysql.com> @@ -44,13 +44,16 @@ use strict; use Getopt::Long; -my $insert_portion_size= 25; -my $error_prefix= "help parsing error:"; +my $insert_portion_size= 15; +my $error_prefix= "---- help parsing errors :"; my $path_to_lex_file= "../sql/lex.h"; my $verbose_option= 0; my $help_option= 0; +my $cur_line= 0; +my $count_errors= 0; + GetOptions( "help",\$help_option, "verbose",\$verbose_option, @@ -92,19 +95,31 @@ my %keywords; $categories{Contents}->{__parent_category__}= ""; +sub print_error +{ + my ($text)= @_; + if ($count_errors==0) + { + print STDERR "$error_prefix\n"; + } + print STDERR "line $cur_line : $text"; + $count_errors++; +} + sub add_topic_to_category { my ($topic_name)= @_; $categories{$current_category}->{$topic_name}= $topics{$topic_name}; my $category= $categories{$current_category}; + $category->{__name__}= $current_category; if (exists($category->{__parent_category__})) { my $old_parent= $category->{__parent_category__}; if ($old_parent ne $current_parent_category) { - print STDERR "$error_prefix wrong parent for $current_category\n"; + print_error "wrong parent for $current_category\n"; } } @@ -118,7 +133,7 @@ sub add_topic_to_category my $old_category= $topics{$topic_name}->{category}; if ($old_category ne $category) { - print STDERR "$error_prefix wrong category for $topic_name\n"; + print_error "wrong category for $topic_name (first one's \"$old_category->{__name__}\" second one's \"$current_category\")\n"; } } @@ -133,7 +148,7 @@ sub add_example if (exists($topics{$topic_name}->{example})) { - print STDERR "$error_prefix double example for $topic_name\n"; + print_error "double example for $topic_name\n"; } $topics{$topic_name}->{example}= $example; @@ -148,7 +163,7 @@ sub add_description if (exists($topics{$topic_name}->{description})) { - print STDERR "$error_prefix double description for $topic_name\n"; + print_error "double description for $topic_name\n"; } $topics{$topic_name}->{description}= $description; add_topic_to_category($topic_name); @@ -164,7 +179,7 @@ sub add_keyword push(@{$topics{$topic_name}->{keywords}},$keyword); if (exists($keywords{$keyword}->{$topic_name})) { - print STDERR "$error_prefix double keyword $keyword for $topic_name\n"; + print_error "double keyword $keyword for $topic_name\n"; } $keywords{$keyword}->{$topic_name}= $topics{$topic_name}; } @@ -195,10 +210,12 @@ sub prepare_name $a =~ s/\@table \@code/ /g; $a =~ s/\(\)//g; $a =~ s/\"/\\\"/g; - + $a =~ s/((\w|\s)+)\(([\+-=><\/%*!<>\s]+)\)/$3/gxs; $a =~ s/([\+-=><\/%*!<>\s]+)\(((\w|\s)+)\)/$1/gxs; $a =~ s/((\w|\s)+)\((.+)\)/$1/gxs; + + $a =~ s/((\s)+)$//g; return $a; } @@ -278,12 +295,13 @@ sub parse_example while (<>) { + $cur_line++; last if ($_=~/\@end example/); $text .= $_; } $text= prepare_example($text); - + $topic_name= prepare_name($topic_name); add_example($topic_name,$text) if ($topic_name ne ""); } @@ -319,11 +337,13 @@ sub parse_description while (<>) { + $cur_line++; last if ($_=~/\@c end_description_for_help_topic/); $text .= $_; } $text= prepare_description($text); + $topic_name= prepare_name($topic_name); add_description($topic_name,$text); } @@ -354,6 +374,7 @@ while (<>) parse_example (); parse_description (); parse_category (); + $cur_line++; } # test results of parsing: @@ -542,3 +563,9 @@ if (scalar(@keywords_names)) } printf ";\n\n"; } + +if ($count_errors) +{ + print STDERR "$count_errors errors !!!\n"; + exit 1; +} diff --git a/scripts/make_sharedlib_distribution.sh b/scripts/make_sharedlib_distribution.sh new file mode 100644 index 00000000000..4104a315296 --- /dev/null +++ b/scripts/make_sharedlib_distribution.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# The default path should be /usr/local + +# Get some info from configure +# chmod +x ./scripts/setsomevars + +machine=@MACHINE_TYPE@ +system=@SYSTEM_TYPE@ +version=@VERSION@ +export machine system version +SOURCE=`pwd` +CP="cp -p" +MV="mv" + +STRIP=1 +DEBUG=0 +SILENT=0 +TMP=/tmp +SUFFIX="" + +parse_arguments() { + for arg do + case "$arg" in + --debug) DEBUG=1;; + --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; + --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; + --no-strip) STRIP=0 ;; + --silent) SILENT=1 ;; + *) + echo "Unknown argument '$arg'" + exit 1 + ;; + esac + done +} + +parse_arguments "$@" + +BASE=$TMP/my_dist$SUFFIX + +if [ -d $BASE ] ; then + rm -r -f $BASE +fi + +mkdir -p $BASE/lib + +for i in \ + libmysql/.libs/libmysqlclient.so* \ + libmysql_r/.libs/libmysqlclient_r.so* +do + if [ -f $i ] + then + $CP $i $BASE/lib + fi +done + +# Change the distribution to a long descriptive name +NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX +BASE2=$TMP/$NEW_NAME +rm -r -f $BASE2 +mv $BASE $BASE2 +BASE=$BASE2 + +#if we are debugging, do not do tar/gz +if [ x$DEBUG = x1 ] ; then + exit +fi + +# This is needed to prefer GNU tar instead of tar because tar can't +# always handle long filenames + +PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` +which_1 () +{ + for cmd + do + for d in $PATH_DIRS + do + for file in $d/$cmd + do + if test -x $file -a ! -d $file + then + echo $file + exit 0 + fi + done + done + done + exit 1 +} + +# +# Create the result tar file +# + +tar=`which_1 gnutar gtar` +if test "$?" = "1" -o "$tar" = "" +then + tar=tar +fi + +echo "Using $tar to create archive" +cd $TMP + +OPT=cvf +if [ x$SILENT = x1 ] ; then + OPT=cf +fi + +$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME +cd $SOURCE +echo "Compressing archive" +gzip -9 $NEW_NAME.tar +echo "Removing temporary directory" +rm -r -f $BASE + +echo "$NEW_NAME.tar.gz created" diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 02eb5366b01..2f1b7b2939a 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -114,37 +114,16 @@ done # Convert argument file from unix to DOS text # -if [ `which recode` ] -then - - print_debug "Using 'recode' to convert from unix to dos text" - - unix_to_dos() - { - for arg do - print_debug "Replacing LF -> CRLF from '$arg'" - - chmod u+w $arg - recode lat1..ibmpc $arg - done - } - -else - - print_debug "Using 'sed' to convert from unix to dos text" - - unix_to_dos() - { - for arg do - print_debug "Replacing LF -> CRLF from '$arg'" - - sed -e 's/$/\r/' $arg > $arg.tmp - rm -f $arg - mv $arg.tmp $arg - done - } +unix_to_dos() +{ + for arg do + print_debug "Replacing LF -> CRLF from '$arg'" -fi + cat $arg | awk '{sub(/$/,"\r");print}' > $arg.tmp + rm -f $arg + mv $arg.tmp $arg + done +} # @@ -169,6 +148,28 @@ find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print ) # +# Process version tags in InstallShield files +# + +vreplace() +{ + for arg do + unix_to_dos $arg + cat $arg | sed -e 's!@''VERSION''@!@VERSION@!' > $arg.tmp + rm -f $arg + mv $arg.tmp $arg + done +} + +for d in 4.0.XX-gpl 4.0.XX-pro 4.0.XX-classic +do + cd $BASE/InstallShield/$d/String\ Tables/0009-English + vreplace value.shl + cd ../../Setup\ Files/Compressed\ Files/Language\ Independent/OS\ Independent + vreplace infolist.txt +done + +# # Move all error message files to root directory # diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index e8cc9322eaf..6b543bf4a07 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -62,7 +62,7 @@ get_full_path () { case $1 in /*) echo "$1";; - ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/./;/;' ;; + ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/\./;/;' ;; *) which $1 ;; esac } @@ -84,18 +84,27 @@ port='@MYSQL_TCP_PORT@' ldflags='@LDFLAGS@' client_libs='@CLIENT_LIBS@' -libs="$ldflags -L'$pkglibdir' -lmysqlclient $client_libs" -libs=`echo $libs | sed -e 's; +;;'` -libs_r="$ldflags -L'$pkglibdir' -lmysqlclient_r $client_libs" -libs_r=`echo $libs_r | sed -e 's; +;;'` -cflags="-I'$pkgincludedir'" -embedded_libs="$ldflags -L'$pkglibdir' -lmysqld @LIBS@ @innodb_system_libs@" +# Create options, without end space + +libs="$ldflags -L$pkglibdir -lmysqlclient $client_libs" +libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` +libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@" +libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` +cflags="-I$pkgincludedir @CFLAGS@" +include="-I$pkgincludedir" +embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @innodb_system_libs@" +embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` + +# Remove some options that a client doesn't have to care about + +cflags=`echo "$cflags " | sed -e 's;\(-DDBUG_OFF\|-DSAFEMALLOC\|-USAFEMALLOC\|-DSAFE_MUTEX\|-DPEDANTIC_SAFEMALLOC\|-DUNIV_MUST_NOT_INLINE\|-DFORCE_INIT_OF_VARS\|-DEXTRA_DEBUG\|-DHAVE_purify\|-O[0-9]\|-W[-A-Za-z]*\) *;;g' | sed -e 's; *\$;;'` usage () { cat <<EOF Usage: $0 [OPTIONS] Options: --cflags [$cflags] + --include [$include] --libs [$libs] --libs_r [$libs_r] --socket [$socket] @@ -111,6 +120,7 @@ if test $# -le 0; then usage; fi while test $# -gt 0; do case $1 in --cflags) echo "$cflags" ;; + --include) echo "$include" ;; --libs) echo "$libs" ;; --libs_r) echo "$libs_r" ;; --socket) echo "$socket" ;; diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 1600fe051f3..c702a97f93d 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -151,7 +151,7 @@ then INSERT INTO user (host,user) values ('$hostname','');" else i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);" - if test "$windows" -eq 0 + if test "$windows" = "0" then i_u="$i_u INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 4adc0655434..4b571722bac 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -101,6 +101,41 @@ ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; # +# Create some possible missing tables +# +CREATE TABLE IF NOT EXISTS help_topic ( +help_topic_id int unsigned not null, +name varchar(64) not null, +help_category_id smallint unsigned not null, +description text not null, +example text not null, +url varchar(128) not null, +primary key (help_topic_id), unique index (name) +) comment='help topics'; + +CREATE TABLE IF NOT EXISTS help_category ( +help_category_id smallint unsigned not null, +name varchar(64) not null, +parent_category_id smallint unsigned null, +url varchar(128) not null, +primary key (help_category_id), +unique index (name) +) comment='help categories'; + +CREATE TABLE IF NOT EXISTS help_relation ( +help_topic_id int unsigned not null references help_topic, +help_keyword_id int unsigned not null references help_keyword, +primary key (help_keyword_id, help_topic_id) +) comment='keyword-topic relation'; + +CREATE TABLE IF NOT EXISTS help_keyword ( +help_keyword_id int unsigned not null, +name varchar(64) not null, +primary key (help_keyword_id), +unique index (name) +) comment='help keywords'; + +# # Create proc table if it doesn't exists # diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 09a720f273d..adaac0f3102 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -128,7 +128,7 @@ fi if test ! -x $mysqld then - if test "$in_rpm" -eq 1 + if test "$in_rpm" = 1 then echo "FATAL ERROR $mysqld not found!" exit 1 @@ -143,7 +143,7 @@ fi hostname=`@HOSTNAME@` # Check if hostname is valid -if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a $force -eq 0 +if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0 then resolved=`$bindir/resolveip $hostname 2>&1` if [ $? -ne 0 ] @@ -160,14 +160,14 @@ then fi echo "WARNING: The host '$hostname' could not be looked up with resolveip." echo "This probably means that your libc libraries are not 100 % compatible" - echo "with this binary MySQL version. The MySQL deamon, mysqld, should work" + echo "with this binary MySQL version. The MySQL daemon, mysqld, should work" echo "normally with the exception that host name resolving will not work." echo "This means that you should use IP addresses instead of hostnames" echo "when specifying MySQL privileges !" fi fi -if test "$ip_only" -eq 1 +if test "$ip_only" ="1" then ip=`echo "$resolved" | awk '/ /{print $6}'` hostname=$ip @@ -187,7 +187,7 @@ then c_d="yes" fi -if test $verbose -eq 1 +if test $verbose = 1 then create_option="verbose" else @@ -207,7 +207,7 @@ if ( ) | eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" then - if test "$in_rpm" -eq 0 -a "$windows" -eq 0 + if test "$in_rpm" = 0 -a "$windows" = 0 then echo "" echo "To start mysqld at boot time you have to copy support-files/mysql.server" @@ -231,7 +231,7 @@ then echo "able to use the new GRANT command!" fi echo - if test "$in_rpm" -eq 0 + if test "$in_rpm" = "0" then echo "You can start the MySQL daemon with:" echo "cd @prefix@ ; $bindir/mysqld_safe &" diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 1c056e963cb..ece4ba098f4 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -51,9 +51,9 @@ parse_arguments() { ;; # these two might have been set in a [mysqld_safe] section of my.cnf - # they get passed via environment variables to mysqld_safe - --socket=*) MYSQL_UNIX_PORT=`echo "$arg" | sed -e "s;--socket=;;"` ;; - --port=*) MYSQL_TCP_PORT=`echo "$arg" | sed -e "s;--port=;;"` ;; + # they are added to mysqld command line to override settings from my.cnf + --socket=*) mysql_unix_port=`echo "$arg" | sed -e "s;--socket=;;"` ;; + --port=*) mysql_tcp_port=`echo "$arg" | sed -e "s;--port=;;"` ;; # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])! --ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;; @@ -114,8 +114,7 @@ else ledir=@libexecdir@ fi -MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@} -MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@} +safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}} user=@MYSQLD_USER@ niceness=0 @@ -171,9 +170,14 @@ else fi test -z "$err_log" && err_log=$DATADIR/`@HOSTNAME@`.err -export MYSQL_UNIX_PORT -export MYSQL_TCP_PORT - +if test -n "$mysql_unix_port" +then + args="--socket=$mysql_unix_port $args" +fi +if test -n "$mysql_tcp_port" +then + args="--port=$mysql_tcp_port $args" +fi if test $niceness -eq 0 then @@ -296,7 +300,7 @@ echo "Starting $MYSQLD daemon with databases from $DATADIR" echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log while true do - rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety + rm -f $safe_mysql_unix_port $pid_file # Some extra safety if test -z "$args" then $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1 |