* On 2007-11-23 at 12:45 GMT, Daniel Fischer wrote:
> Can you please comment on the following patch, since you modified the file
> before me. It unbreaks mysql_install_db for out-of-directory builds in 5.1,
> e.g. make distcheck.
>
> > scripts/mysql_install_db.sh@stripped, 2007-11-23 13:38:54+01:00,
> df@stripped +19 -15
> > Give precedence to basedir if both basedir and srcdir are specified,
> > but set mysqld_opt, pkgdatadir and scriptdir always from srcdir if it
> > is specified. This is to unbreak out-of-directory builds like make
> > distcheck does, where we don't have binaries in srcdir.
Hi Danny,
My main concern with this is that --basedir and --srcdir are supposed to
be mutually exclusive options. I believe that this is the only way to
ensure that the operation (and readability) of the script stays simple,
and reduces the chance of unexpected behaviour.
Instead, I've attached a patch to add a --builddir argument (matching the
automake $top_builddir argument it uses) to be used in dist-hook, and made
the script bail out if --basedir and --srcdir are used together.
This should hopefully make usage of the script more clear for users.
What do you think?
--
Jonathan Perkin, Senior Production Engineer
MySQL AB, www.mysql.com
===== Makefile.am 1.144 vs edited =====
--- 1.144/Makefile.am 2007-10-30 19:06:46 +00:00
+++ edited/Makefile.am 2007-11-26 15:30:32 +00:00
@@ -54,7 +54,7 @@ dist-hook:
rm -rf `find $(distdir) -type d -name SCCS -print`
mkdir -p $(distdir)/win
scripts/mysql_install_db --no-defaults --windows \
- --basedir=$(top_builddir) \
+ --builddir=$(top_builddir) \
--datadir=$(distdir)/win/data \
--srcdir=$(top_srcdir)
===== scripts/mysql_install_db.sh 1.88 vs edited =====
--- 1.88/scripts/mysql_install_db.sh 2007-11-08 12:42:01 +00:00
+++ edited/scripts/mysql_install_db.sh 2007-11-26 16:50:31 +00:00
@@ -19,6 +19,7 @@
# All unrecognized arguments to this script are passed to mysqld.
basedir=""
+builddir=""
ldata="@localstatedir@"
srcdir=""
@@ -37,6 +38,9 @@ usage()
cat <<EOF
Usage: $0 [OPTIONS]
--basedir=path The path to the MySQL installation directory.
+ --builddir=path If using --srcdir with out-of-directory builds, you
+ will need to set this to the location of the build
+ directory where built files reside.
--datadir=path The path to the MySQL data directory.
--force Causes mysql_install_db to run even if DNS does not
work. In that case, grant table entries that normally
@@ -95,6 +99,7 @@ parse_arguments()
case "$arg" in
--force) force=1 ;;
--basedir=*) basedir=`parse_arg "$arg"` ;;
+ --builddir=*) builddir=`parse_arg "$arg"` ;;
--srcdir=*) srcdir=`parse_arg "$arg"` ;;
--ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
--user=*)
@@ -189,9 +194,18 @@ parse_arguments PICK-ARGS-FROM-ARGV "$@"
#
# or default to compiled-in locations.
#
+if test -n "$srcdir" && test -n "$basedir"
+then
+ echo "ERROR: Specify either --basedir or --srcdir, not both."
+ exit 1
+fi
if test -n "$srcdir"
then
- print_defaults="$srcdir/extra/my_print_defaults"
+ if test -z "$builddir"
+ then
+ builddir="$srcdir"
+ fi
+ print_defaults="$builddir/extra/my_print_defaults"
elif test -n "$basedir"
then
print_defaults=`find_in_basedir my_print_defaults bin extra`
@@ -213,10 +227,10 @@ parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
if test -n "$srcdir"
then
- basedir="$srcdir"
- bindir="$srcdir/client"
- extra_bindir="$srcdir/extra"
- mysqld="$srcdir/sql/mysqld"
+ basedir="$builddir"
+ bindir="$basedir/client"
+ extra_bindir="$basedir/extra"
+ mysqld="$basedir/sql/mysqld"
mysqld_opt="--language=$srcdir/sql/share/english"
pkgdatadir="$srcdir/scripts"
scriptdir="$srcdir/scripts"