Commit 8fed78b6 authored by unknown's avatar unknown

Fix for the windows src distribution script - SCRUM:

  -- To take care of .zip and .tar
  -- Initialization of 'data' directory without any host dependancy data
  -- Incorporate all changes from Monty


scripts/make_win_src_distribution.sh:
  Fix to take care of .zip and initialization of 'data' directory
scripts/mysql_install_db.sh:
  Changes for Windows related though 'WINDOWS' flag
parent 16cdf759
...@@ -15,18 +15,39 @@ TMP=/tmp ...@@ -15,18 +15,39 @@ TMP=/tmp
SUFFIX="" SUFFIX=""
OUTTAR=0 OUTTAR=0
SRCDIR=$SOURCE
DSTDIR=$TMP
# #
# This script must run from MySQL top directory # This script must run from MySQL top directory
# #
if [ ! -f scripts/make_win_src_distribution.sh ]; then if [ ! -f scripts/make_win_src_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory" echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1 exit 1
fi fi
#
# Check for source compilation/configuration
#
if [ ! -f sql/sql_yacc.cc ]; then
echo "ERROR : Sorry, you must run this script after the complete build,"
echo " hope you know what you are trying to do !!"
exit 1
fi
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMPDIR $TEMPDIR $TEMP
do
if [ $i ]; then
TMP=$i
break
fi
done
# #
# Usage of the script # Usage of the script
# #
...@@ -42,7 +63,7 @@ show_usage() { ...@@ -42,7 +63,7 @@ show_usage() {
echo " --tar Create a tar.gz package instead of .zip" echo " --tar Create a tar.gz package instead of .zip"
echo " --help Show this help message" echo " --help Show this help message"
exit 1 exit 0
} }
# #
...@@ -68,20 +89,6 @@ parse_arguments() { ...@@ -68,20 +89,6 @@ parse_arguments() {
parse_arguments "$@" parse_arguments "$@"
#
# Currently return an error if --tar is not used
#
if [ x$OUTTAR = x0 ] && [ x$DEBUG = x0 ]
then
echo "ERROR: The default .zip doesn't yet work on Windows, as it can't load"
echo " the workspace files due to LF->CR+LF issues, instead use --tar"
echo " to create a .tar.gz package "
echo ""
show_usage;
exit 1
fi
# #
# Create a tmp dest directory to copy files # Create a tmp dest directory to copy files
# #
...@@ -89,24 +96,36 @@ fi ...@@ -89,24 +96,36 @@ fi
BASE=$TMP/my_win_dist$SUFFIX BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then if [ -d $BASE ] ; then
if [ x$DEBUG = x1 ]; then
echo "Destination directory '$BASE' already exists, deleting it"
fi
rm -r -f $BASE rm -r -f $BASE
fi fi
$CP -r $SOURCE/VC++Files $BASE $CP -r $SOURCE/VC++Files $BASE
( (
find $BASE -name *.dsw -and -not -path \*SCCS\* -print find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
find $BASE -name *.dsp -and -not -path \*SCCS\* -print
)|( )|(
while read v while read v
do do
sed 's/$'"/`echo -e \\\r`/" $v > $v.tmp if [ x$DEBUG = x1 ]; then
echo "Replacing LF -> CRLF from '$v'"
fi
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v rm $v
mv $v.tmp $v mv $v.tmp $v
# awk '!/r\r$/ {print $0"\r"} /r\r$/ {print $0}' $v > $v
done done
) )
# move all error message files to root directory #
# Move all error message files to root directory
#
$CP -r $SOURCE/sql/share $BASE/ $CP -r $SOURCE/sql/share $BASE/
# #
...@@ -119,7 +138,6 @@ then ...@@ -119,7 +138,6 @@ then
rm -rf "$BASE/InstallShield/Script Files/SCCS" rm -rf "$BASE/InstallShield/Script Files/SCCS"
fi fi
mkdir $BASE/Docs $BASE/extra $BASE/include mkdir $BASE/Docs $BASE/extra $BASE/include
...@@ -130,32 +148,26 @@ mkdir $BASE/Docs $BASE/extra $BASE/include ...@@ -130,32 +148,26 @@ mkdir $BASE/Docs $BASE/extra $BASE/include
copy_dir_files() { copy_dir_files() {
for arg do for arg do
if [ x$DEBUG = x1 ]; then
echo "Copying files from directory '$arg'"
fi
cd $SOURCE/$arg/ cd $SOURCE/$arg/
( for i in *.c *.h *.ih *.i *.ic *.asm \
ls -A1|grep \\.[ch]$ README INSTALL* LICENSE
ls -A1|grep \\.ih$
ls -A1|grep \\.i$
ls -A1|grep \\.ic$
ls -A1|grep \\.asm$
ls -A1|grep README
ls -A1|grep INSTALL
ls -A1|grep LICENSE
)|(
while read v
do do
$CP $SOURCE/$arg/$v $BASE/$arg/$v if [ -f $i ]
then
$CP $SOURCE/$arg/$i $BASE/$arg/$i
fi
done done
) for i in *.cc
cd $SOURCE/$arg/
(
ls -A1|grep \\.cc$|sed 's/.cc$//g')|(
while read v
do do
$CP $SOURCE/$arg/$v.cc $BASE/$arg/$v.cpp if [ -f $i ]
then
i=`echo $i | sed 's/.cc$//g'`
$CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
fi
done done
)
done done
} }
...@@ -172,24 +184,18 @@ copy_dir_dirs() { ...@@ -172,24 +184,18 @@ copy_dir_dirs() {
if [ ! -d $BASE/$arg ]; then if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg mkdir $BASE/$arg
fi fi
copy_dir_files $arg copy_dir_files $arg
cd $SOURCE/$arg/ cd $SOURCE/$arg/
( for i in *
ls -l |grep "^d"|awk '{print($9)}' -
)|(
while read dir_name
do do
if [ x$dir_name != x"SCCS" ] if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then
then if [ ! -d $BASE/$basedir/$i ]; then
if [ ! -d $BASE/$basedir/$dir_name ]; then mkdir $BASE/$basedir/$i
mkdir $BASE/$basedir/$dir_name
fi fi
copy_dir_files $basedir/$dir_name copy_dir_files $basedir/$i
fi fi
done done
)
done done
} }
...@@ -197,49 +203,37 @@ copy_dir_dirs() { ...@@ -197,49 +203,37 @@ copy_dir_dirs() {
# Input directories to be copied # Input directories to be copied
# #
copy_dir_files 'bdb' for i in client dbug extra heap include isam \
copy_dir_files 'bdb/build_win32' libmysql libmysqld merge myisam \
copy_dir_files 'client' myisammrg mysys regex sql strings \
copy_dir_files 'dbug' vio zlib
copy_dir_files 'extra' do
copy_dir_files 'heap' copy_dir_files $i
copy_dir_files 'include' done
copy_dir_files 'innobase'
copy_dir_files 'isam'
copy_dir_files 'libmysql'
copy_dir_files 'libmysqld'
copy_dir_files 'merge'
copy_dir_files 'myisam'
copy_dir_files 'myisammrg'
copy_dir_files 'mysys'
copy_dir_files 'regex'
copy_dir_files 'sql'
copy_dir_files 'strings'
copy_dir_files 'vio'
copy_dir_files 'zlib'
# #
# Input directories to be copied recursively # Input directories to be copied recursively
# #
copy_dir_dirs 'bdb' for i in bdb innobase
copy_dir_dirs 'innobase' do
copy_dir_dirs $i
done
#
# Create dummy innobase configure header
#
# create dummy innobase configure header if [ -f $BASE/innobase/ib_config.h ]; then
if [ -f $BASE/innobase/ib_config.h ]
then
rm -f $BASE/innobase/ib_config.h rm -f $BASE/innobase/ib_config.h
touch $BASE/innobase/ib_config.h
fi fi
touch $BASE/innobase/ib_config.h
# #
# Copy miscellaneous files # Copy miscellaneous files
# #
$CP $SOURCE/myisam/myisampack.c $BASE/myisampack/
$CP $SOURCE/client/mysqlbinlog.cc $BASE/mysqlbinlog/mysqlbinlog.cpp
$CP $SOURCE/isam/pack_isam.c $BASE/pack_isam/pack_isam.c
cd $SOURCE cd $SOURCE
for i in COPYING ChangeLog README \ for i in COPYING ChangeLog README \
INSTALL-SOURCE INSTALL-WIN \ INSTALL-SOURCE INSTALL-WIN \
...@@ -248,6 +242,9 @@ for i in COPYING ChangeLog README \ ...@@ -248,6 +242,9 @@ for i in COPYING ChangeLog README \
Docs/mysqld_error.txt Docs/INSTALL-BINARY Docs/mysqld_error.txt Docs/INSTALL-BINARY
do do
if [ x$DEBUG = x1 ]; then
echo "Copying file '$i'"
fi
if [ -f $i ] if [ -f $i ]
then then
$CP $i $BASE/$i $CP $i $BASE/$i
...@@ -255,9 +252,16 @@ do ...@@ -255,9 +252,16 @@ do
done done
# #
# TODO: Initialize the initial data directory # Initialize the initial data directory
# #
if [ -f scripts/mysql_install_db ]; then
if [ x$DEBUG = x1 ]; then
echo "Initializing the 'data' directory"
fi
scripts/mysql_install_db -WINDOWS --datadir=$BASE/data
fi
# #
# Specify the distribution package name and copy it # Specify the distribution package name and copy it
...@@ -305,10 +309,14 @@ which_1 () ...@@ -305,10 +309,14 @@ which_1 ()
} }
# #
# Create the result zip file # Create the result zip/tar file
# #
if [ x$OUTTAR = x1 ]; then set_tarzip_options()
{
for arg
do
if [ x$arg = x"tar" ]; then
ZIPFILE1=gnutar ZIPFILE1=gnutar
ZIPFILE2=gtar ZIPFILE2=gtar
OPT=cvf OPT=cvf
...@@ -317,24 +325,40 @@ if [ x$OUTTAR = x1 ]; then ...@@ -317,24 +325,40 @@ if [ x$OUTTAR = x1 ]; then
if [ x$SILENT = x1 ] ; then if [ x$SILENT = x1 ] ; then
OPT=cf OPT=cf
fi fi
else else
ZIPFILE1=zip ZIPFILE1=zip
ZIPFILE2="" ZIPFILE2=""
OPT="-lvr" OPT="-vr"
EXT=".zip" EXT=".zip"
NEED_COMPRESS=0 NEED_COMPRESS=0
if [ x$SILENT = x1 ] ; then if [ x$SILENT = x1 ] ; then
OPT="-lr" OPT="-r"
fi
fi fi
done
}
if [ x$OUTTAR = x1 ]; then
set_tarzip_options 'tar'
else
set_tarzip_options 'zip'
fi fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2` tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = "" if test "$?" = "1" -o "$tar" = ""
then then
tar=tar tar=tar
set_tarzip_options 'tar'
fi
#
# Create the archive
#
if [ xDEBUG = x1 ]; then
echo "Using $tar to create archive"
fi fi
echo "Using $tar to create archive"
cd $TMP cd $TMP
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME $tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME
...@@ -342,19 +366,21 @@ cd $SOURCE ...@@ -342,19 +366,21 @@ cd $SOURCE
if [ x$NEED_COMPRESS = x1 ] if [ x$NEED_COMPRESS = x1 ]
then then
if [ xDEBUG = x1 ]; then
echo "Compressing archive" echo "Compressing archive"
fi
gzip -9 $NEW_NAME$EXT gzip -9 $NEW_NAME$EXT
EXT=".tar.gz" EXT="$EXT.gz"
fi fi
echo "Removing temporary directory" if [ xDEBUG = x1 ]; then
echo "Removing temporary directory"
fi
rm -r -f $BASE rm -r -f $BASE
echo "$NEW_NAME$EXT created successfully !!" echo "$NEW_NAME$EXT created successfully !!"
#
# End of script # End of script
#
......
...@@ -13,6 +13,12 @@ case "$1" in ...@@ -13,6 +13,12 @@ case "$1" in
IN_RPM="1"; shift IN_RPM="1"; shift
;; ;;
esac esac
windows=0
case "$1" in
-WINDOWS)
windows="1"; shift
;;
esac
defaults= defaults=
case "$1" in case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*) --no-defaults|--defaults-file=*|--defaults-extra-file=*)
...@@ -94,7 +100,7 @@ fi ...@@ -94,7 +100,7 @@ fi
mdata=$ldata/mysql mdata=$ldata/mysql
if test ! -x $execdir/mysqld if test "$windows" -eq 0 -a ! -x $execdir/mysqld
then then
if test "$IN_RPM" -eq 1 if test "$IN_RPM" -eq 1
then then
...@@ -110,7 +116,7 @@ fi ...@@ -110,7 +116,7 @@ fi
hostname=`@HOSTNAME@` # Install this too in the user table hostname=`@HOSTNAME@` # Install this too in the user table
# Check if hostname is valid # Check if hostname is valid
if test "$IN_RPM" -eq 0 -a $force -eq 0 if test "$windows" -eq 0 -a "$IN_RPM" -eq 0 -a $force -eq 0
then then
resolved=`$bindir/resolveip $hostname 2>&1` resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ] if [ $? -ne 0 ]
...@@ -134,7 +140,7 @@ then ...@@ -134,7 +140,7 @@ then
fi fi
# Create database directories mysql & test # Create database directories mysql & test
if test "$IN_RPM" -eq 0 if test "$IN_RPM" -eq 0 || "$windows" -eq 0
then then
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
...@@ -247,13 +253,19 @@ then ...@@ -247,13 +253,19 @@ then
c_u="$c_u comment='Users and global privileges';" c_u="$c_u comment='Users and global privileges';"
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); 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);
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);
REPLACE 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); REPLACE 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);
INSERT INTO user (host,user) values ('localhost','');"
if test "$windows" -eq 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);
REPLACE 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); REPLACE 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);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('$hostname','');" INSERT INTO user (host,user) values ('$hostname','');"
fi
fi fi
if test ! -f $mdata/func.frm if test ! -f $mdata/func.frm
...@@ -330,7 +342,7 @@ END_OF_DATA ...@@ -330,7 +342,7 @@ END_OF_DATA
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args" --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then then
echo "" echo ""
if test "$IN_RPM" -eq 0 if test "$IN_RPM" -eq 0 || "$windows" -eq 0
then then
echo "To start mysqld at boot time you have to copy support-files/mysql.server" echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system" echo "to the right place for your system"
...@@ -351,7 +363,7 @@ then ...@@ -351,7 +363,7 @@ then
echo "able to use the new GRANT command!" echo "able to use the new GRANT command!"
fi fi
echo echo
if test "$IN_RPM" -eq 0 if test "$IN_RPM" -eq 0 -a "$windows" -eq 0
then then
echo "You can start the MySQL daemon with:" echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &" echo "cd @prefix@ ; $bindir/mysqld_safe &"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment