Commit 7ef61521 authored by lenz@mysql.com's avatar lenz@mysql.com

Merge mysql.com:/space/my/mysql-4.1

into mysql.com:/space/my/mysql-4.1-build
parents 75cfee68 a88acf4a
This diff is collapsed.
#!/bin/sh
WD=`pwd`
# Don't write a wrong path for BD !!!!!
if [ -w /my/tmp ]
then
BD=/my/tmp/BUILD
elif [ -n "$TMPDIR" ]
then
BD=$TMPDIR/BUILD
else
BD=/tmp/BUILD
fi
TMP_SCRIPT=$WD/Logs/00-temp-for-do-all-build-steps.$$
# We build on work
to_host=`hostname`
cc=gcc
ccc=gcc
EXTRA_CONFIG="--without-perl"
#AM_MAKEFLAGS="-j 2"
echo "Building on $to_host"
rm -rf $BD/*
rm -f $WD/binary/*
mkdir -p $WD/binary
mkdir -p $WD/Logs
mkdir -p $BD/Logs
cat > $TMP_SCRIPT <<END
# Show executed commands
set -x
# Move to the right place
cd "$WD"
# Create a build directory tree
bk export $BD
cd "$BD"
chmod -R u+rw,g+rw .
# Make it easy to remove an old build
umask 002
CC=$cc CXX=$ccc
export CC CXX
gmake -j 2 -k distclean
rm -f NEW-RPMS/*
# Stop on error
set -e
/bin/rm -f */.deps/*.P
/bin/rm -f config.cache
aclocal; autoheader; aclocal; automake; autoconf
(cd bdb/dist && sh s_all)
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
# A normal user starts here. We must use mit-threads, bdb and innodb.
# Otherwise they do not end up in the distribution.
./configure \
--with-unix-socket-path=/var/tmp/mysql.sock \
--with-low-memory \
--with-mit-threads=yes $EXTRA_CONFIG \
--enable-thread-safe-client \
--enable-local-infile \
--with-berkeley-db \
--with-innodb \
--with-vio \
--without-pstack \
--with-extra-tools \
--with-embedded-server
gmake -j 2
time gmake -j 2 distcheck \
EXTRA_CONF_ARGS="--with-unix-socket-path=/var/tmp/mysql.sock --with-low-memory $EXTRA_CONFIG"
sh $BD/Build-tools/Do-rpm $*
rm -f $TMP_SCRIPT
END
set -e
log=$WD/Logs/Log-distcheck-`date +%y%m%d-%H%M`
echo "Logging script $TMP_SCRIPT into $log"
if test $to_host = "mysql-work"
then
# Try to get the right user for MySQL builds on work so that all
# files is owned by the same user (mysql)
ssh -n $to_host -l my "time sh $TMP_SCRIPT" > $log 2>&1
else
time sh $TMP_SCRIPT > $log 2>&1
fi
# Create a commercial MySQL distribution (mysqlcom-VER.tar.gz) from
# the newly made source distribution
cd "$BD"
DIST=`ls -t mysql-*.tar.gz | head -1`
$BD/Build-tools/mysql-copyright --target=. $DIST
# move the binaries to the 'binary' directory
mv $BD/mysql*tar.gz $WD/binary
mv $BD/NEW-RPMS/* $WD/binary
This diff is collapsed.
#!/bin/bash
PM_FILES='Data-Dumper Data-ShowTable DBI Msql-Mysql-modules'
FILE_EXT='tar.gz'
ARCH=`uname -m | perl -p -e 's/^i[0-9]86$/i386/'`
# directories
[ -d /usr/src/redhat ] && RPM_SRC=/usr/src/redhat
[ -d /usr/src/packages ] && RPM_SRC=/usr/src/packages
SRC_DIR=/home/matt/work/pm_rpm/tarballs # pristine tarballs
DEST_DIR=${RPM_SRC}/SOURCES # RPM SOURCES (building area)
RPM_DEPOSIT=/var/tmp/ftp/RPMS # RPM production deposit
SRPM_DEPOSIT=/var/tmp/ftp/SRPMS # SRPM production deposit
# keyword replacement for SPEC templates
REPLACE_KEY='REPLACE_VERSION'
# paths to beloved programs
NEWEST=/home/matt/work/build_pm_rpms/newest
REPLACE=/usr/local/bin/replace
#++
# Copy the source tarballs up to staging area for RPM building.
#--
cd $SRC_DIR
for i in $PM_FILES
do
echo Copying $i...
cp ${SRC_DIR}/`$NEWEST -s $SRC_DIR -b $i -t $FILE_EXT` $DEST_DIR
done
#++
# Do keyword replacements on the SPEC templates, and build RPMS
#--
cd ${RPM_SRC}/SPECS
for i in $PM_FILES
do
cat ${i}.spec.template | $REPLACE $REPLACE_KEY `$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v` > ${i}.spec
rpm -ba ${i}.spec
rm ${i}.spec
done
#++
# Copy new RPMS and SRPMS to production deposit
#--
cd $RPM_SRC
# kludge code
PM_FILES=`echo $PM_FILES | $REPLACE Msql-Mysql-modules DBD-Mysql`
tmpv=`$NEWEST -s $DEST_DIR -b Msql-Mysql-modules -t $FILE_EXT -v`
mv SOURCES/Msql-Mysql-modules-${tmpv}.${FILE_EXT} SOURCES/DBD-Mysql-${tmpv}.${FILE_EXT}
for i in $PM_FILES
do
cp RPMS/${ARCH}/${i}-`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v`-1.${ARCH}.rpm $RPM_DEPOSIT
cp SRPMS/${i}-`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v`-1.src.rpm $SRPM_DEPOSIT
rm SOURCES/`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT`
done
#!/usr/bin/perl
#
# By Matt Wagner <matt@mysql.com> 2005
#
# This script generates HP Depot packages for MySQL Server.
# It basically repackages a binary tarball as a depot.
#
# Usage: ./Do-hpux-depot <untarred-binary-tarball>
#
$fullname = shift @ARGV;
$fullname or die "No package name was specified";
-d $fullname or die "That directory is not present!";
$fullname =~ s,/+$,,; # Remove ending slash if any
chomp($pwd= `pwd`);
%title= (
"mysql-standard" => "MySQL Community Edition - Standard (GPL)",
"mysql-debug" => "MySQL Community Edition - Debug (GPL)",
"mysql-max" => "MySQL Community Edition - Experimental (GPL)",
"mysql-pro" => "MySQL Pro (Commercial)",
"mysql-classic" => "MySQL Classic (Commercial)",
"mysql-cluster" => "MySQL Cluster (Commercial)",
);
%architecture= (
"hpux11.23" => "HP-UX_B.11.23",
"hpux11.11" => "HP-UX_B.11.11",
"hpux11.00" => "HP-UX_B.11.00",
);
%os_release= (
"hpux11.23" => "?.11.2?",
"hpux11.11" => "?.11.1?",
"hpux11.00" => "?.11.0?",
);
%machine_type= (
"ia64" => "ia64*",
"hppa2.0w" => "9000/*",
);
$fullname =~ m/^(mysql-\w+)-([\d\.]+)-hp-(hpux11\.\d\d)-(hppa2\.0w|(ia64))-?(64bit)?$/;
# print "title: $1\n";
# print "version: $2\n";
# print "os: $3\n";
# print "cpu: $4\n";
# print "64: $6\n";
$cpu64= ($6 ne "") ? "_64" : "";
open (PSF,">${fullname}.psf") or die "Unable to write PSF file ($!)\n";
print PSF <<EOF;
product
tag $1
vendor_tag "MySQL_AB"
title "$title{$1}"
description "MySQL Database Server and Clients"
revision $2
architecture $architecture{$3}$cpu64
machine_type $machine_type{$4}
os_name HP-UX
os_release $os_release{$3}
directory /usr/local
fileset
tag all
revision $2
directory $fullname=/usr/local/$fullname
file_permissions -u 222 -g bin -o bin
file *
end
end
EOF
close(PSF);
system("/usr/sbin/swpackage -v -d \"|gzip -c > $fullname.depot.gz\" -x target_type=tape -s ${pwd}/${fullname}.psf");
#! /bin/sh
set -e -x
# Only use the "--with-other-libc" parameter, if another libc actually
# exists, since this will also force static linking, which does not work
# together with OpenSSL
OTHER_LIBC_DIR=/usr/local/mysql-glibc
OTHER_LIBC=""
if [ -d OTHER_LIBC_DIR ] ; then
OTHER_LIBC="--with-other-libc=$OTHER_LIBC_DIR"
fi
BUILD/compile-pentium-max $OTHER_LIBC \
--with-comment="Official MySQL Binary" \
--prefix=/usr/local/mysql --with-extra-charset=complex \
--enable-thread-safe-client --enable-local-infile \
--with-server-suffix=-max
nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz
scripts/make_binary_distribution
make dist
Build-tools/Do-rpm --local
BUILD/compile-pentium --with-other-libc=$OTHER_LIBC_DIR \
--with-comment="Official MySQL Binary" \
--prefix=/usr/local/mysql --with-extra-charset=complex \
--enable-thread-safe-client --enable-local-infile
nm -n sql/mysqld | gzip -9 -v 2>&1 > sql/mysqld.sym.gz
scripts/make_binary_distribution
#!/bin/sh
# make a patch file of a mysql distribution
# takes as argument the previous version
case $# in
0) echo Usage: $0 previous_version; exit 1;;
esac
PVER=$1;
VER=`grep SERVER_VERSION include/mysql_version.h | cut -d'"' -f2`
NEW="mysql-$VER.tar.gz"
OLD="mysql-$PVER.tar.gz"
RESULT="mysql-$PVER-$VER.patch.gz"
PATCH_DIR=/my/data/tcxwww/html/Downloads/Patches
RESULT_DIR=/my/data/tcxwww/html/Downloads/MySQL-3.22
if test ! -f $NEW
then
echo "$NEW doesn't exist";
exit 1;
fi
if test ! -f $RESULT_DIR/$OLD
then
echo "$RESULT_DIR/$OLD doesn't exist";
exit 1;
fi
mkdir patch
cd patch
gtar xfz ../$NEW
gtar xfz $RESULT_DIR/$OLD
cd mysql-$PVER
diff --context --new-file --recursive . ../mysql-$VER | gzip -9 > ../../$RESULT
cd ../..
/bin/rm -rf patch
#!/bin/sh
# make a patch file of a mysql distribution
# takes as argument the previous version
case $# in
0) echo Usage: $0 previous_version; exit 1;;
esac
PVER=$1;
VER=`grep SERVER_VERSION /my/tmp/BUILD/include/mysql_version.h | cut -d'"' -f2`
NEWDIR="binary"
NEW="mysql-$VER.tar.gz"
OLD="mysql-$PVER.tar.gz"
RESULT="mysql-$PVER-$VER.patch.gz"
PATCH_DIR=/my/web/Downloads-live/Patches
RESULT_DIR=/my/web/Downloads-live/MySQL-4.0
RESULT_DIR_MAX=/my/web/Downloads-live/MySQL-Max-4.0
if test ! -f $NEWDIR/$NEW
then
echo "$NEWDIR/$NEW doesn't exist";
exit 1;
fi
if test ! -f $RESULT_DIR/$OLD
then
echo "$RESULT_DIR/$OLD doesn't exist";
exit 1;
fi
mkdir patch
cd patch
gtar xfz ../$NEWDIR/$NEW
gtar xfz $RESULT_DIR/$OLD
cd mysql-$PVER
diff --unified --new-file --recursive . ../mysql-$VER | gzip -9 > ../../$RESULT
cd ../..
/bin/rm -rf patch
chmod a+r,o-w $RESULT binary/*
mv $RESULT $PATCH_DIR
cp binary/mysqlcom-* binary/mysql*win* /net/web/home/production/data/nweb/customer/Downloads
rm binary/mysqlcom-*
mv binary/*Max* binary/*-max* $RESULT_DIR_MAX
cp binary/* $RESULT_DIR
This diff is collapsed.
#!/usr/bin/perl -w
#
# Do-rpm - compile RPM packages out of a source tarball and move the
# resulting RPM packages into the current directory.
#
# The script currently assumes the following environment:
#
# - there must be a source distribution (mysql-<version>.tar.gz)
# in the current directory
# - You must provide the name of an RPM spec file (mysql-<version>.spec)
# as the argument
#
# Use the "--help" option for more info!
#
# written by Lenz Grimmer <lenz@mysql.com>
#
use Cwd;
use File::Basename;
use File::Copy;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
use Sys::Hostname;
$opt_cc= undef;
$opt_cflags= undef;
$opt_clean= undef;
$opt_cxx= undef;
$opt_cxxflags= undef;
$opt_dry_run= undef;
$opt_help= undef;
$opt_log= undef;
$opt_mail= "";
$opt_verbose= undef;
$opt_susebuild= undef;
$opt_susebuildroot= undef;
$opt_suserpms= undef;
# Set a dummy version until we know the correct one
$VERSION= "x.y.z";
$MAJOR= $MINOR= $RELEASE= 0;
$SUFFIX= "";
GetOptions(
"cc=s",
"cflags=s",
"clean|c",
"cxx=s",
"cxxflags=s",
"dry-run|t",
"help|h",
"log|l:s",
"mail|m=s",
"susebuild|s",
"susebuildroot|r=s",
"suserpms=s",
"verbose|v",
) || &print_help;
&print_help("") if ($opt_help);
defined($SPECFILE=$ARGV[0]) || print_help("Please provide the spec file name!");
&print_help("Please define the location of the RPM repository!") if $opt_susebuild && !($opt_suserpms || $ENV{BUILD_RPMS});
unless ($opt_susebuildroot)
{
if ($ENV{BUILD_ROOT})
{
$opt_susebuildroot= $ENV{BUILD_ROOT};
}
else
{
$opt_susebuildroot="/var/tmp/build-root";
}
}
# Include helper functions
$PWD= cwd();
$LOGGER= "$PWD/logger.pm";
if (-f "$LOGGER")
{
do "$LOGGER";
}
else
{
die "ERROR: $LOGGER cannot be found!\n";
}
$subject= "RPM build for $SPECFILE failed" if $opt_mail;
# Open the spec file and extract the version number
open(SPEC, $SPECFILE) or die "Unable to open \"$ARGV[0]\": $!";
@spec= <SPEC>;
close SPEC;
foreach (@spec)
{
if (m/^%define\s*mysql_version\s*(.*)/)
{
$VERSION= $1;
$VERSION_SRPM=$VERSION;
($MAJOR, $MINOR, $RELEASE)= split(/\./,$VERSION);
$VERSION_SRPM= $MAJOR . '.' . $MINOR . '.' . $RELEASE;
$VERSION_SRPM =~ s/\-\w+$//;
($RELEASE, $SUFFIX)= split(/\-/,$RELEASE);
$SUFFIX= "-" . $SUFFIX if ($SUFFIX);
}
}
$HOST= hostname();
$HOST=~ /^([^.-]*)/;
$HOST= $1;
$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log";
&logger("Logging to $LOGFILE");
#
# Override predefined Log file name
#
if (defined $opt_log)
{
if ($opt_log ne "")
{
if ($opt_log =~ /^\/.*/)
{
$LOGFILE= $opt_log;
}
else
{
$LOGFILE= $PWD . "/" . $opt_log;
}
}
}
&logger("Using spec file for version: $VERSION");
if ($opt_susebuild)
{
&susebuild;
}
else
{
&rpmbuild;
}
&logger("SUCCESS: RPM files successfully created.") unless ($opt_dry_run);
exit 0;
#
# Build using SUSE's "build" script
#
sub susebuild
{
$BUILD= "/usr/bin/build";
( -x $BUILD) ? &logger("$BUILD found, proceeding.") : &abort("$BUILD could not be found!");
$command= "sudo $BUILD --clean";
$command.= " --root=$opt_susebuildroot";
$command.= " --rpms=$opt_suserpms" if $opt_suserpms;
$command.= " $SPECFILE";
&logger("Building RPMs using SUSE build.");
&run_command($command, "Error while running the SUSE RPM build!");
#
# Move the resulting RPMs into the pwd - we can use broad globs here
# as the build root has been cleaned up before so there should not be
# any residuals from previous build runs
#
$command= "cp";
$command.= " -v " if ($opt_verbose);
$command.= " $opt_susebuildroot/usr/src/packages/SRPMS/MySQL*.src.rpm $PWD";
&logger("Copying source RPM to current dir.");
&run_command($command, "Error moving source RPM!");
$command= "cp";
$command.= " -v " if ($opt_verbose);
$command.= " $opt_susebuildroot/usr/src/packages/RPMS/*/MySQL*.rpm $PWD";
&logger("Copying binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!");
}
#
# Build using "plain" RPM
#
sub rpmbuild
{
#
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
#
if (-x "/usr/bin/rpmbuild")
{
$RPM= "/usr/bin/rpmbuild";
$RMSOURCE= "--rmsource --rmspec";
}
else
{
$RPM= "/bin/rpm";
$RMSOURCE= "--rmspec";
}
if ($RPM)
{
&logger("Found rpm binary: $RPM");
}
else
{
&abort("Unable to find RPM binary!");
}
#
# determine some RPM settings for this host
#
chomp($RPMARCH= `$RPM --eval "%{_arch}" 2> /dev/null`);
chomp($RPMDIR= `$RPM --eval "%{_rpmdir}" 2> /dev/null`);
chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`);
chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
foreach $file ($SOURCEFILE, $SPECFILE)
{
&abort("Unable to find $file!") unless (-f "$file");
}
#
# Install source and spec file
#
&logger("Copying SOURCE and SPEC file to build directories.");
unless ($opt_dry_run)
{
copy($SOURCEFILE, $SOURCEDIR)
or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
copy($SPECFILE, $SPECDIR)
or &abort("Unable to copy $SPECFILE to $SPECDIR!");
}
#
# Set environment variables - these are being used in the
# official MySQL RPM spec file
#
&logger("Setting special build environment variables")
if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
#
# Build the RPMs
#
$command= "$RPM";
$command.= " -v" if ($opt_verbose);
$command.= " -ba";
$command.= " --clean $RMSOURCE" if $opt_clean;
$command.= " $SPECDIR/";
$command.= basename($SPECFILE);
&logger("Building RPM.");
&run_command($command, "Error while building the RPMs!");
#
# Move the resulting RPMs into the pwd
#
$command= "mv";
$command.= " -v " if ($opt_verbose);
$command.= " $SRCRPMDIR/MySQL*$VERSION_SRPM*.src.rpm $PWD";
&logger("Moving source RPM to current dir.");
&run_command($command, "Error moving source RPM!");
$command= "mv";
$command.= " -v " if ($opt_verbose);
$command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION_SRPM*.$RPMARCH.rpm $PWD";
&logger("Moving binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!");
}
sub print_help
{
my $message= $_[0];
if ($message ne "")
{
print "\n";
print "ERROR: $message\n\n";
}
print <<EOF;
Usage: Do-rpm [options] <specfile>
Creates a binary RPM package out of a MySQL source distribution and moves
the resulting RPMs into the current directory. <specfile> is the MySQL RPM
spec file to use (e.g. mysql-4.0.17.spec).
This script expects to find the required MySQL source distribution
(mysql-<version>.tar.gz) in the current directory.
Options:
--cc=<compiler> Use <compiler> to compile C code
--ccflags=<flags> Use special C compiler flags
--cxx=<compiler> Use <compiler> to compile C++ code
--cxxflags=<flags> Use special C++ compiler flags
-c, --clean Clean up after the build
-t, --dry-run Dry run without executing
-h, --help Print this help
-l, --log[=<filename>] Write a log file [to <filename>]
-m, --mail=<address> Mail a failure report to the given address
(and include a log file snippet, if logging
is enabled)
Note that the \@-Sign needs to be quoted!
Example: --mail=user\\\@domain.com
-s, --susebuild Use the SUSE "build" script instead of RPM
directly (requires sudo privileges to run the
/usr/bin/build command)
-r, --susebuildroot=<root> Use <root> as the build root directory for the
SUSE "build" (default is /var/tmp/build-root
or defined by the BUILD_ROOT environment
variable)
--suserpms=<path> Path to the SUSE RPM repository to build up
the build root (mandatory option when using
--susebuild and the BUILD_RPMS environment
variable is not set.)
-v, --verbose Verbose execution
Example:
Do-rpm -cv mysql-4.0.17.spec
EOF
exit 1;
}
#!/usr/bin/perl
#
# Script to create Solaris packages
#
$INTERACTIVE= 0;
chomp ($hostname= `hostname`);
$find = "/usr/bin/find";
$pkgproto = "/usr/bin/pkgproto";
$pkgmk = "/usr/bin/pkgmk -o";
$pkgtrans = "/usr/bin/pkgtrans";
$temp = "/tmp/prototype$$";
$prototype = "prototype";
$pkginfo = "pkginfo";
($gid ,$pkg ,$uid ,$userInfo ,$email ,$quota ,$group ,$passwd
,$category ,$userHome ,$vendor ,$loginShell ,$pstamp ,$basedir)=();
$tarball= $fullname= shift @ARGV;
$fullname=~ s/.*(mysql.*)\.tar\.gz/$1/;
$workdir= $$;
chomp ($parent_workdir= `pwd`);
$hostname= ($fullname=~ m/^.+-64bit$/) ? $hostname . "-64bit" : $hostname;
$pkgdir= "$ENV{'HOME'}/$hostname";
mkdir $workdir or die "Can't make workdir: $!\n";
chdir $workdir or die "Can't change to workdir: $!\n";
system ("tar xzvf $tarball") == 0 or die "Can't untar: $!\n";
system ("$find . -print | $pkgproto > $temp");
open (PREPROTO,"<$temp") or die "Unable to read prototype information ($!)\n";
open (PROTO,">$prototype") or die "Unable to write file prototype ($!)\n";
print PROTO "i pkginfo=./$pkginfo\n";
while (<PREPROTO>) {
# Read the prototype information from /tmp/prototype$$
chomp;
$thisline = $_;
if ($thisline =~ " prototype "
or $thisline =~ " pkginfo ") {
# We don't need that line
} elsif ($thisline =~ "^[fd] ") {
# Change the ownership for files and directories
($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
print PROTO "$dir $none $file $mode bin bin\n";
} else {
# Symlinks and other stuff should be printed as well ofcourse
print PROTO "$thisline\n";
}
}
close PROTO;
close PREPROTO;
# Clean up
unlink $temp or warn "Unable to remove tempfile ($!)\n";
# Now we can start building the package
#
# First get some info
$fullname =~ s,/+$,,; # Remove ending slash if any
$fullname =~ /^((mysql)(?:-\w+){1,3})-([\d\.]+\w?)-.+$/
or die "This name is not what I expected - \"$fullname\"";
$default{"name"}= $2;
$default{"version"}= $3;
$default{"pkg"}= $1;
$default{"arch"} = `uname -m`;
chomp $default{"arch"};
$default{"category"}= "application";
$default{"vendor"}= "MySQL AB";
$default{"email"}= "build\@mysql.com";
$default{"pstamp"}= "MySQL AB Build Engineers";
$os = `uname -r`;
$os =~ '\.';
$os = "sol$'";
chomp $os;
$default{"basedir"}= "/usr/local";
$default{"packagename"}= "${fullname}.pkg";
# Check for correctness of guessed values by userinput
%questions = (
pkg => "Please give the name for this package",
name => "Now enter the real name for this package",
arch => "What architecture did you build the package on?",
version => "Enter the version number of the package",
category => "What category does this package belong to?",
vendor => "Who is the vendor of this package?",
email => "Enter the email adress for contact",
pstamp => "Enter your own name",
basedir => "What is the basedir this package will install into?",
packagename => "How should I call the packagefile?",
);
@vars = qw(pkg name arch version category vendor email pstamp basedir
packagename);
foreach $varname (@vars) {
getvar_noq($varname);
}
if ($INTERACTIVE) {
while (!&chkvar()) {
print "\n";
foreach $varname (@vars) {
getvar($varname);
}
@vars = qw(pkg name arch version category vendor email pstamp basedir
packagename);
}
}
$classes = "none";
# Create the pkginfo file
print "\nNow creating $pkginfo file\n";
open (PKGINFO,">$pkginfo") || die "Unable to open $pkginfo for writing ($!)\n";
print PKGINFO "PKG=\"$pkg\"\n";
print PKGINFO "NAME=\"$name\"\n";
print PKGINFO "ARCH=\"$arch\"\n";
print PKGINFO "VERSION=\"$version\"\n";
print PKGINFO "CATEGORY=\"$category\"\n";
print PKGINFO "VENDOR=\"$vendor\"\n";
print PKGINFO "EMAIL=\"$email\"\n";
print PKGINFO "PSTAMP=\"$pstamp\"\n";
print PKGINFO "BASEDIR=\"$basedir\"\n";
print PKGINFO "CLASSES=\"$classes\"\n";
close PKGINFO;
print "Done.\n";
# Build and zip the package
print "Building package\n";
system ("$pkgmk -r `pwd`");
system ("(cd /var/spool/pkg; $pkgtrans -s -o `pwd` /tmp/$packagename $pkg)");
system ("gzip /tmp/$packagename");
# Clean-up the spool area
system ("(cd /var/spool/pkg; rm -rf $pkg)");
# Clean-up the ~/packaging/ area
unlink $pkginfo;
unlink $prototype;
chdir $parent_workdir or die "Can't change to parent workdir '$parent_workdir': $!\n";
system ("rm -rf $workdir") == 0 or die "Can't remove the working dir: $!\n";
system ("mv /tmp/${packagename}.gz $pkgdir") == 0 or die "Can't move the finished package out of /tmp: $!\n";
print "Done. (~/$hostname/$packagename.gz)\n";
# The subroutines
sub chkvar {
print "\n";
print "PKG=$pkg\n";
print "NAME=$name\n";
print "ARCH=$arch\n";
print "VERSION=$version\n";
print "CATEGORY=$category\n";
print "VENDOR=$vendor\n";
print "EMAIL=$email\n";
print "PSTAMP=$pstamp\n";
print "BASEDIR=$basedir\n";
print "PACKAGENAME=$packagename\n";
print "\nIs this information correct? [Y/n]: ";
my $answer= <STDIN>;
chomp $answer;
$answer= 'Y' if ($answer eq "");
$answer= uc $answer;
my $res= ($answer eq 'Y')? 1 : 0;
return($res);
}
sub getvar_noq {
my $questionname = "@_";
$$questionname = $default{$questionname};
}
sub getvar {
my $questionname = "@_";
my $ucquestionname= uc $questionname;
print "$ucquestionname: $questions{$questionname} [$default{\"$questionname\"}]: ";
my $answer = <STDIN>;
chomp $answer;
$$questionname = $answer;
$$questionname = $default{$questionname} if ($$questionname eq "");
}
#!/usr/bin/perl -w
use Getopt::Long;
$opt_help=0;
$opt_tarball=$opt_builddir=$opt_suffix="";
GetOptions(
"help",
"tarball=s",
"builddir=s",
"suffix=s"
) || print_help();
print_help() if ($opt_help);
chomp($MSDEV=`which msdev`);
if (!$opt_builddir) {
$opt_builddir = "/cygdrive/c/mysql-win-build";
}
$opt_tarball =~ /(mysql[^\/]*)-win-src\.tar/;
$mysqlver=$1;
$basedir = "$opt_builddir/$mysqlver";
$scriptdir = `pwd`;
# Make sure build dir exists
mkdir($opt_builddir);
# Clean out any previous build
system("rm -rf $basedir");
# Unpack in the script directory
system("tar -zxvf $opt_tarball");
# Move to the build directory
system("mv $mysqlver $opt_builddir");
if (!chdir($basedir))
{
print "Do-win-build error: Could not change to $basedir";
exit 1;
}
# Check whether this is a classic edition build
if ($opt_suffix =~ /-classic/)
{
# Blank out ha_innodb.cpp
chmod 0644, 'sql/ha_innodb.cpp';
open(OUT, '>', 'sql/ha_innodb.cpp');
close(OUT);
# Remove HAVE_INNOBASE_DB from the requisite project files
for $dspfile ('libmysqld/libmysqld.dsp', 'mysqldemb/mysqldemb.dsp', 'mysqlserver/mysqlserver.dsp', 'sql/mysqld.dsp', 'sql/mysqldmax.dsp')
{
open(IN, '<', $dspfile);
open(OUT, '>', "$dspfile.tmp");
while (readline IN)
{
s/\D \"HAVE_INNOBASE_DB\" //g;
print OUT $_;
}
close(IN);
close(OUT);
unlink $dspfile;
rename "$dspfile.tmp", $dspfile;
}
}
# Perform compilation
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");
# Package binary
system("./scripts/make_win_binary_distribution --suffix=$opt_suffix");
# Copy log back to script directory
system("cp $mysqlver$suffix-build.log $scriptdir");
# Move binary package to script directory
system("mv *.zip $scriptdir");
#
# Print a help text message
#
sub print_help
{
print <<EOF;
Usage: Do-compile-win [options] source-tarball
Unpacks a Windows source distribution on the local machine and
compiles it using VC++ 6.0.
This script is intended for Cygwin Perl. You must have a working
MSDEV.EXE in your path for compilation, as well as the following:
sed
tar (GNU tar)
which
Options:
--help
Print this text.
--builddir=<dir>
Set the Cygwin path to build under; the tarball will actually
be moved to <builddir>/mysql-<version>/tarball and extracted under
<builddir>/mysql-<version>/build.
Default: /cygdrive/c/mysql-win-build
--suffix=<suffix>
If specified, the resulting binary will have the specified suffix
in its name. If the suffix is "-classic", the project files will
be stripped of all occurrences of HAVE_INNOBASE_DB and
ha_innodb.cpp will be blanked out, to create classic edition
server binaries.
--tarball=<file>
Windows source tarball to use for this build. Must be of the form
mysql[com]-x.x.x-win-src.tar.gz (REQUIRED)
EOF
exit 1;
}
#! /bin/sh
CVSROOT=my@work.mysql.com:/home/cvs
CVS_RSH=ssh
TMPDIR=/tmp
cd $TMPDIR
[ -d mysql ] && rm -rf mysql
CVSROOT=$CVSROOT CVS_RSH=$CVS_RSH cvs -z 9 co mysql && cd mysql && \
chmod u+w -R * && BUILD/compile-pentium
if test $? = 0
then
cd $TMPDIR && rm -rf mysql
fi
# Helper functions
#
# Create a log entry
#
sub logger
{
my $message= $_[0];
my $cmnd= $_[1];
print $message . "\n" if !$opt_quiet && !$opt_verbose && !$cmnd;
print timestamp() . " " . $message . "\n" if $opt_verbose;
if (defined $opt_log && !$opt_dry_run)
{
open LOG, ">>$LOGFILE" or die "Can't open logfile $LOGFILE!";
print LOG timestamp() . " " . $message . "\n";
close LOG;
}
}
#
# run_command(<command>,<error message>)
# Execute the given command or die with the respective error message
# Just print out the command when doing a dry run
#
sub run_command
{
my $command= $_[0];
my $errormsg= $_[1];
if ($opt_dry_run)
{
print "$command\n";
}
else
{
&logger($command, 1);
$command.= ';' unless ($command =~ m/^.*;$/);
$command =~ s/;/ >> $LOGFILE 2>&1;/g if defined $opt_log;
$command =~ s/;/ > \/dev\/null;/g if (!$opt_verbose && !$opt_log);
system($command) == 0 or &abort("$errormsg\n");
}
}
#
# abort(<message>)
# Exit with giving out the given error message or by sending
# it via email to the given mail address (including a log file snippet,
# if available)
#
sub abort
{
my $message= $_[0];
my $messagefile;
my $subject= "Bootstrap of $REPO failed" if $opt_mail;
$message= "ERROR: " . $message;
&logger($message);
if ($opt_mail && !$opt_dry_run)
{
$messagefile= "/tmp/message.$$";
open(TMP,">$messagefile");
print TMP "$message\n\n";
close TMP;
if (defined $opt_log)
{
system("tail -n 40 $LOGFILE >> $messagefile");
}
system("mail -s \"$subject\" $opt_mail < $messagefile");
unlink($messagefile);
}
exit 1;
}
# Create a time stamp for logging purposes
sub timestamp
{
return &ymd() . " " . &hms();
}
#
# return the current time as a string (HH:MM:SS)
#
sub hms
{
my @ta= localtime(time());
my $h= $ta[2];
$h= "0" . "$h" if ($h <= 9);
my $m= $ta[1];
$m= "0" . "$m" if ($m <= 9);
my $s= $ta[0];
$s="0" . "$s" if ($s <= 9);
return "$h:$m:$s";
}
#
# return the current date as a string (YYYYMMDD)
#
sub ymd
{
my @ta=localtime(time());
my $d=$ta[3];
$d="0" . "$d" if ($d <= 9);
my $m=$ta[4]+1;
$m="0" . "$m" if ($m <= 9);
my $y=1900+$ta[5];
return "$y$m$d";
}
#!/usr/bin/perl
#
# my_md5sum
#
# Script to clone the 'md5sum' command found on modern systems, since that
# command is not always found on all systems.
#
# Use the "--help" option for more info!
#
# Written by Matt Wagner <matt@mysql.com>
#
use strict;
#
# Use local perl libraries first. 'unshift' adds to the front of @INC
# The local perl library dir hidden is $HOME/.perllibs on each build host
#
BEGIN
{
my $homedir= $ENV{HOME};
unshift (@INC, "$homedir/.perllibs");
}
use Digest::MD5;
use Getopt::Long;
my $VER= "1.3";
my $EXIT= 0;
#
# Strip the leading path info off the program name ($0). We want 'my_md5sum'
# not './my_md5sum'.
#
$0=~ s/^.*\/(.+)$/$1/;
my ($opt_check, $opt_help)= undef;
GetOptions(
"check|c" => \$opt_check,
"help|h" => \$opt_help,
) || usage();
#
# Put all the [file1 file2 file3 ...]'s into an array
#
my @files = @ARGV;
#
# Give the "--help" text if:
# - "--help|-h" was specified
# - The number of files given as arguments is nil
# - The "--check|-c" option is used with more than one [file] argument
#
usage() if $opt_help || $#files == -1 || ($opt_check && $#files > 0);
# If "--check|-c", then go into checking
if ($opt_check)
{
open (CHECKFILE, $files[0]) or die "$files[0]: $!";
while (<CHECKFILE>)
{
#
# Goto the next line in the file if it does not match a typical
# digest line like:
#
# f1007efa2c72daa693981ec764cdeaca Bootstrap
#
next if $_!~ m/^([a-z0-9]{32})\s+(.+)$/;
# Collect the trappings from the above regex
my $checksum= $1;
my $checkfile= $2;
# Generate a fresh MD5 for the file in question
my $digest= &mkmd5($checkfile);
# Check the fresh MD5 against what is recorded in the file
# Print an error message if they don't match, else print OK
print "$checkfile: FAILED\n" if $digest ne $checksum;
print "$checkfile: OK\n" if $digest eq $checksum;
# Set the exit() status to non-zero if FAILED
$EXIT= 1 if $digest ne $checksum;
}
}
# Else generate the MD5 digest to STDOUT
else
{
foreach my $file (@files)
{
my $digest= &mkmd5($file);
print "$digest $file\n";
}
}
exit($EXIT);
#
# This routine generates the MD5 digest of a file
#
sub mkmd5
{
my $file= shift;
open (FILE, $file) or die "$file: $!";
binmode(FILE);
my $digest= Digest::MD5->new->addfile(*FILE)->hexdigest;
close FILE;
return $digest;
}
#
# Print the help text
#
sub usage
{
print <<EOF;
$0 version $VER by Matt Wagner <matt\@mysql.com>
Usage:
$0 [-c [file]] | [file1...]
Generates or checks MD5 message digests.
Options:
-c, --check Check message digests (default is generate)
-h, --help Display this text and exit
The input for -c should be the list of message digests and file names that is
printed on STDOUT by this program when it generates digests.
EOF
exit(0);
}
#!/usr/bin/perl -wi
# Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory
$VER="1.5";
use Cwd;
use File::Basename;
use File::Copy;
use Getopt::Long;
$opt_help = 0;
$opt_version = 0;
$opt_verbose = 0;
$opt_target = "mysql-copyright-target-";
$opt_target .= `date +%d%m%y-%H%M%S`;
chop $opt_target;
GetOptions("help","version","target=s", "verbose") || error();
# fix the directory prefix for target dir
$WD= cwd();
my $win_flag = 0;
$opt_target= $WD . '/' . $opt_target;
&main();
####
#### main
####
sub main
{
my $REG_BASENAME = '[a-z0-9A-Z\-\_\+]+';
my $REG_VERSION = '[0-9\.\-]+[a-z]?[0-9\.\-]+?(.alpha|.beta|.gamma|pre\d|[0-9\.\-a-z])?';
my $target;
if ($opt_version)
{
print "$0 version $VER by Jani Tolonen\n";
exit(0);
}
usage() if ($opt_help);
print error() if ($#ARGV == -1);
`mkdir -p $opt_target`;
$pec= $? >> 8;
die "Couldn't make the target directory!\n" if ($pec);
for ($i=0; $ARGV[$i]; $i++)
{
my $distfile= $ARGV[$i];
$win_flag = ($distfile =~ /win-src/) ? 1 : 0;
my $dir;
$dir= "mysql-copyright-";
$dir.= `date +%d%m%y-%H%M%S`;
chop $dir;
if (!(mkdir "$dir", 0700))
{
die "Couldn't make directory $dir!";
}
if (!(chdir "$dir"))
{
abort($dir, "Couldn't cd to $dir!");
}
# if the distfile is mysql-3.22.22-alpha.tar.gz, then
# distname is 'mysql-3.22.22-alpha' and suffix '.tar.gz'
if ($distfile =~
m/^($REG_BASENAME)([\-\_])($REG_VERSION){1}([\.\-\+]\w+\-\w+)?[\.\-\+](.*)?$/xo)
{
$distname= $1.$2.$3;
$suffix= $5;
$fileext = $6;
$newdistname= $1."com".$2.$3;
$newdistname .= $suffix if $win_flag;
}
# find out the extract path (should be same as distname!)
chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove slash from the end
$destdir= substr($destdir, 0, -1);
if ("$destdir" ne "$distname")
{
print "Destination directory (the directory that will be extracted\n";
print "from the original distribution file) differs from the\n";
print "distribution name! Are you sure you want to continue? (Y/N) [N]:";
$ans= my_read(1);
abort($dir, "Aborted!") if ("$ans" ne "Y" && "$ans" ne "y");
}
# everything should be ok, continue with extracting..
`tar xfz ../$distfile`;
$pec= $? >> 8;
abort($dir, "Extracting from tar failed!\n") if ($pec);
# remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt
# on the toplevel of the directory instead. file 'PUBLIC' shouldn't
# exist in the new mysql distributions, but let's be sure..
unlink("$destdir/PUBLIC", "$destdir/README");
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
# remove subdirectories 'bdb', 'cmd-line-utils/readline'
my @extra_fat= ('bdb', 'cmd-line-utils/readline');
foreach my $fat (@extra_fat)
{
&trim_the_fat($fat);
}
# fix file copyrights
&fix_usage_copyright();
&add_copyright();
# fix LICENSE tag in include/mysql_version.h
&fix_mysql_version();
# apply "autotools" - must be last to ensure proper timestamps
&run_autotools();
# rename the directory with new distribution name
chdir("$WD/$dir");
print "renaming $destdir $newdistname\n" if $opt_verbose;
rename($destdir, $newdistname);
# tar the new distribution
`tar cz -f $WD/$newdistname.tar.gz $newdistname`;
$pec= $? >> 8;
abort($dir, "Making new tar archive failed!\n") if ($pec);
# remove temporary directory
chdir($WD) or print "$! Unable to move up one dir\n";
my $cwd = getcwd();
print "current dir is $cwd\n" if $opt_verbose ;
if (-e $dir) {
print "Trying to delete $dir\n" if $opt_verbose;
if ( system("rm -rf $dir")){
print "$! Unable to delete $dir!\n";
}
}
}
exit(0);
}
####
#### This function will s/GPL/Commercial/ in include/mysql_version.h for the
#### LICENSE tag.
####
sub fix_mysql_version
{
my $cwd= getcwd();
chdir("$destdir");
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
undef $/;
my $mysql_version= <MYSQL_VERSION>;
close(MYSQL_VERSION);
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
print MYSQL_VERSION $mysql_version;
close(MYSQL_VERSION);
chdir("$cwd");
}
####
#### This function will remove unwanted parts of a src tree for the mysqlcom
#### distributions.
####
sub trim_the_fat
{
my $the_fat= shift;
my $cwd= getcwd();
chdir("$destdir");
if ( -d "${the_fat}" )
{
system("rm -rf ${the_fat}");
if (!$win_flag)
{
open(CONFIG_IN,"<configure.in") or die "Unable to open configure.in for read: $!\n";
undef $/;
my $config_in= <CONFIG_IN>;
close(CONFIG_IN);
#
# If $the_fat Makefile line closes the parenthesis, then
# replace that line with just the closing parenthesis.
#
if ($config_in=~ m|${the_fat}/Makefile\)\n?|)
{
$config_in=~ s|${the_fat}/Makefile(\)\n?)|$1|;
}
#
# Else just delete the line
#
else
{
$config_in=~ s|${the_fat}/Makefile dnl\n?||;
}
open(CONFIG_IN,">configure.in") or die "Unable to open configure.in for write: $!\n";
print CONFIG_IN $config_in;
close(CONFIG_IN);
}
}
chdir("$cwd");
}
####
#### This function will run the autotools on the reduced source tree.
####
sub run_autotools
{
my $cwd= getcwd();
if (!$win_flag)
{
chdir("$destdir");
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
# File "configure.in" has already been modified by "trim_the_fat()"
# It must be ensured that the timestamps of the relevant files are really
# ascending, for otherwise the Makefile may cause a re-run of these
# autotools. Experience shows that deletion is the only safe way.
unlink ("config.h.in") or die "Can't delete $destdir/config.h.in: $!\n";
unlink ("aclocal.m4") or die "Can't delete $destdir/aclocal.m4: $!\n";
# These sleep commands also ensure the ascending order.
`aclocal && sleep 2 && autoheader && sleep 2 && automake && sleep 2 && autoconf`;
die "'./configure' was not produced!" unless (-f "configure");
if (-d "autom4te.cache") {
print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
}
chdir("$cwd");
}
}
####
#### mysqld and MySQL client programs have a usage printed with --help.
#### This usage includes a copyright, which needs to be modified
####
sub fix_usage_copyright
{
my $findlist = `find . -type f -name \"*.c*\"`;
my @files = split("\n", $findlist);
my $cwd = getcwd();
foreach my $file (@files)
{
next if ! -f $file;
print "processing file $file in cwd $cwd\n" if $opt_verbose;
`replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file MySQLEULA.txt for details" -- "$file"` ;
}
}
####
#### change the copyright text in the beginning of the files
####
sub add_copyright
{
my $findlist = `find . -type f -name "*"`;
my @files = split("\n", $findlist);
my $cwd = getcwd();
foreach my $file (@files)
{
next if ! -f $file;
next if -B $file;
print "processing file $file in cwd $cwd\n" if $opt_verbose;
`$WD/Build-tools/mysql-copyright-2 "$file"`;
}
}
####
#### read stdin
####
sub my_read
{
($length)= @_; # Max allowed length for the string.
$input= getc(STDIN);
if($input eq "\n")
{
return "\n";
}
for($new_input= getc(STDIN); $new_input ne "\n" ;)
{
if(length($input) < $length)
{
$input.= $new_input;
}
$new_input= getc(STDIN);
}
return $input;
}
####
#### abort
####
sub abort
{
my ($dir, $errstr)= @_;
# remove newly made directory and it's contents
print "$errstr\n";
chdir "..";
print "Removing directory $dir...\n";
`rm -rf $dir`;
exit(0);
}
####
#### usage
####
sub usage
{
print <<EOF;
$0 version $VER by Jani Tolonen
Description: The program takes one or more MySQL distributions as an
argument(s), extracts them, changes the copyright text in the
distribution files and makes a new distribution with suffix "com" in
the basename to directory mysql-copyright-target-DATE, where the
command was issued. For example: mysql-3.23.18-beta.tar.gz ->
mysqlcom-3.23.18-beta.tar.gz. DATE is of form DDMMYY-HHMMSS. The
target directory can be changed with option
--target=... mysql-copyright consists of two perl programs, this one
and another, mysql-copyright-2. Make sure the second part of the
script is available to the main script.
Usage:
$0 [options] file1 [file2 file3...]
Options:
--help Show this help and exit.
--target Target directory for new distribution files.
'.' can be used for the current directory.
(Default: $opt_target)
EOF
exit(0);
}
####
#### error
####
sub error
{
if ($#ARGV == -1)
{
print "Too few arguments to $0!\n";
}
exit(1);
}
#!/usr/bin/perl -i
# Add the header to all given files
# This program asumes that after the copyright there is a empty line
#
$opt_v= 0;
require "getopts.pl";
Getopts("v") || die "Aborted";
@copyright=
(
"Copyright (C) 2000 MySQL AB & MySQL Finland AB",
"",
"This software is distributed with NO WARRANTY OF ANY KIND. No author or",
"distributor accepts any responsibility for the consequences of using it, or",
"for whether it serves any particular purpose or works at all, unless he or",
"she says so in writing. Refer to the MySQLEULA.txt file for details.",
"",
"Every copy of this file must include a copy of the License, normally in a",
"plain ASCII text file named MySQLEULA.txt. The License grants you the right to",
"copy, modify and redistribute this file, but only under certain conditions",
"described in the License. Among other things, the License requires that",
"the copyright notice and this notice be preserved on all copies"
);
while (<>)
{
if (!$first++)
{
add_copyright($_);
}
if ($in_copyright)
{
$in_copyright=check_in_copyright($_);
}
print $_ if (!$in_copyright);
if (eof)
{
$first=0; $in_copyright=1;
}
}
exit 0;
sub add_copyright
{
my ($line)=@_;
my ($row);
$in_copyright= $line =~ /copyright/i;
$found_end_copyright=$skip_this_line=0;
if (!($line =~ /Monty/ || $line =~ /MySQL AB/))
{
$in_copyright=0;
print STDERR "File with unknown copyright ", $ARGV,"\n" if ($opt_v);
return;
}
else
{
print STDERR "To be Changed: ", $ARGV, "\n" if ($opt_v);
}
if ($ARGV =~ /Makefile/ ||
$ARGV =~ /makefile/)
{ # Makefile
$start_copyright="# ";
$line_copyright= "# ";
$end_copyright= "";
}
elsif ($line =~ "^#!")
{ # Shell script
$start_copyright="# ";
$line_copyright= "# ";
$end_copyright= "";
$skip_this_line=1;
print $line;
while ($line=<>) # Copy all until new line or copyright
{
if ($line =~ /copyright/i)
{
last;
}
print $line;
last if ($line =~ /^(\s|\n)*$/);
}
$in_copyright=1;
}
elsif ($ARGV =~ /\.c$/ ||
$ARGV =~ /\.cc$/ ||
$ARGV =~ /\.h$/ ||
$ARGV =~ /\.cpp$/ ||
$ARGV =~ /\.txt$/ ||
$ARGV =~ /\.yy$/)
{
$start_copyright="/* ";
$line_copyright= " ";
$end_copyright= "*/";
}
elsif ($ARGV =~ /-x86\.s$/)
{
$start_copyright="# ";
$line_copyright= "# ";
$end_copyright= "";
}
elsif ($ARGV =~ /\.s$/)
{
$start_copyright="! ";
$line_copyright= "! ";
$end_copyright= "";
}
elsif ($ARGV =~ /\.sql$/)
{
$start_copyright="-- ";
$line_copyright= "-- ";
$end_copyright= "";
}
elsif ($ARGV =~ /\.asm$/)
{
$start_copyright="; ";
$line_copyright= "; ";
$end_copyright= "";
}
else # Unknown file
{
$in_copyright=0;
print STDERR "Unknown file type ", $ARGV,"\n" if ($opt_v);
return;
}
$data=\@copyright;
for ($row=0 ; $row <= $#$data ; $row++)
{
print $row == 0 ? $start_copyright : $line_copyright;
print $data->[$row];
print $row != $#$data ? "\n" : $end_copyright . "\n";
}
print "\n";
$end_copyright =~ /\s*([^\s]+)\s*(([^\s].*)|)$/; # Remove pre and post spaces
}
#
# Return 1 if in copyright
#
sub check_in_copyright
{
my ($line)=@_;
$line =~ /^(.*[^\s])(\s|\n|\r)*$/; # Remove end space and newline
$line=$1;
if (!$line)
{
$found_end_copyright=1 if (!length($end_copyright));
return 1; # Skip empty lines
}
return 0 if ($found_end_copyright);
if ($end_copyright)
{
if (index($line,$end_copyright) != -1)
{
$found_end_copyright=1;
}
return 1;
}
if ($line =~ /copyright/i || index($line . " ",$line_copyright) == 0)
{
return 1;
}
if ($skip_this_line)
{
$skip_this_line=0;
return 1;
}
return 0; # Can't trust the empty copyright line yet
}
#!/usr/bin/perl
package NEWEST;
use Getopt::Long;
use File::Basename;
my $src_dir;
my $basename;
my $type = "tar.gz";
my $versions;
my $help;
my %KEEPER;
GetOptions(
"src_dir=s" => \$src_dir,
"basename=s" => \$basename,
"type=s" => \$type,
"versions!" => \$versions,
"help!" => \$help
);
if (!defined $src_dir || !defined $basename) {
$help = 1;
}
if ($help) {
&help();
exit;
}
&extract_version(\$src_dir, \$basename, \$type, \%KEEPER);
&print_max(\%KEEPER, \$type, \$versions, &find_max(\%KEEPER));
sub extract_version {
my $src_dir = shift;
my $basename = shift;
my $type = shift;
my $KEEPER = shift;
while (glob("$${src_dir}/$${basename}*")) {
my $base = basename("$_",".$${type}");
my @ver = split /-/, $base;
my @nums = split /\./, $ver[$#ver];
my $new;
for (my $i=0; $i<$#nums+1; $i++) {
$new =~ s/^([0-9]*)([a-zA-Z]*)$/$1/;
$new .= 10000+$nums[$i];
$new .= $2;
}
$KEEPER->{"$new"} = [$base,$ver[$#ver]];
}
return;
}
sub find_max {
my $KEEPER = shift;
return reverse sort (keys %$KEEPER);
}
sub print_max {
my $KEEPER = shift;
my $type = shift;
my $versions = shift;
my $max_key = shift;
if ($${versions}) {
print "$KEEPER->{$max_key}->[1]\n";
}
else {
print "$KEEPER->{$max_key}->[0]" . ".$${type}\n";
}
return;
}
sub help {
print qq("newest" finds the tarball in a given directory with the newest version number
and returns it's filename. "newest" is meant to be embedded in UNIX shell
scripts.
Usage:
newest -(src_dir | s) /path/to/dir/with/tarballs
-(basename | b) BaseName (ex. BaseName-2.10.tar.gz)
-(type | t) Type of file (default: tar.gz)
-(versions | v) Print only version information
-(help | h) Prints usage help
Ex: \$ /opt/bin/newest -s /opt/incoming/pm_modules -b Data-Dumper
Data-Dumper-2.101.tar.gz
Both arguments, '-s' and '-b' are required; '-t' and '-v' are optional.
);
return;
}
This diff is collapsed.
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA
## Process this file with automake to create Makefile.in
# This is a dummy file to satisfy the hierarchy of Makefiles.
# When a release is built, the true Makefile will be copied
# together with the "real" files in this directory.
EXTRA_DIST =
# Nothing to create in this dummy directory.
all:
:
# Nothing to cleanup in this dummy directory.
clean:
:
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -9,184 +9,17 @@
# If you know how to fix any of this more elegantly please mail
# docs@mysql.com
TEXI2HTML_FLAGS = -iso -number -acc
DVIPS = dvips
MAKEINFO = @MAKEINFO@
TEXINFO_TEX = Support/texinfo.tex
noinst_SCRIPTS = Support/generate-text-files.pl
noinst_SCRIPTS = Support/texi2html Support/generate-text-files.pl \
Support/generate-mirror-listing.pl
info_TEXINFOS = manual.texi
EXTRA_DIST = $(noinst_SCRIPTS) mysql.info INSTALL-BINARY
targets = manual.txt mysql.info manual.html
BUILT_SOURCES = $(targets) manual_toc.html include.texi
EXTRA_DIST = $(noinst_SCRIPTS) $(BUILT_SOURCES) mysqld_error.txt \
INSTALL-BINARY reservedwords.texi internals.texi
SUBDIRS = Images
all: $(targets) txt_files
all: txt_files
txt_files: ../INSTALL-SOURCE ../COPYING ../INSTALL-WIN-SOURCE ../EXCEPTIONS-CLIENT \
INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
CLEAN_FILES: $(BUILD_SOURCES)
touch $(BUILD_SOURCES)
# The PostScript and PDF version are so big that they are not included in the
# standard distribution. It is available for download from the home page.
paper: manual_a4.ps manual_letter.ps $(PDFMANUAL)
#########################################################################
# The Makefile contains the previous version so we can not use that
include.texi: ../configure.in
echo "@c This file is autogenerated by the Makefile" > $@
echo -n "@set mysqlversion " >> $@
grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \
sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> $@
echo -n "@set defaultport " >> $@
grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \
sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> $@
#
# English Manual
#
# GNU Info
mysql.info: manual.texi include.texi
cd $(srcdir) && $(MAKEINFO) --no-split -I $(srcdir) $<
# Plain Text
manual.txt: manual.texi include.texi
cd $(srcdir) && \
$(MAKEINFO) -I $(srcdir) --no-headers --no-split --output $@ $<
# HTML, all in one file
manual.html: manual.texi include.texi $(srcdir)/Support/texi2html
cd $(srcdir) && @PERL@ $(srcdir)/Support/texi2html $(TEXI2HTML_FLAGS) $<
manual_toc.html: manual.html
# PDF, Portable Document Format
manual.pdf: manual.texi
sed -e 's|@image{[^}]*} *||g' <$< >manual-tmp.texi
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
mv manual-tmp.pdf $@
rm -f manual-tmp.*
touch $@
# XML, DocBook 4.0
mysql.xml: manual.texi include.texi
$(MAKEINFO) --force --no-ifinfo --docbook $<
mv $@ mysql-tmp.xml
Support/docbook-fixup.pl <mysql-tmp.xml >$@
rm -f mysql-tmp.xml
# Postscript, A4 Paper
manual_a4.ps: manual.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
$(DVIPS) -t a4 manual.dvi -o $@
touch $@
# Postscript, US Letter Paper
manual_letter.ps: manual.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch $<
$(DVIPS) -t letter manual.dvi -o $@
touch $@
#
# German Manual
#
# GNU Info
mysql.de.info: manual.de.texi include.texi
cd $(srcdir) && $(MAKEINFO) --no-split -I $(srcdir) $<
# Plain Text
manual.de.txt: manual.de.texi include.texi
cd $(srcdir) && \
$(MAKEINFO) -I $(srcdir) --no-headers --no-split --output $@ $<
# HTML, all in one file
manual.de.html: manual.de.texi include.texi $(srcdir)/Support/texi2html
cd $(srcdir) && @PERL@ $(srcdir)/Support/texi2html $(TEXI2HTML_FLAGS) $<
manual_toc.de.html: manual.html
# PDF, Portable Document Format
manual.de.pdf: manual.de.texi
sed -e 's|@image{[^}]*} *||g' <$< >manual-tmp.texi
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
mv manual-tmp.pdf $@
rm -f manual-tmp.*
touch $@
# XML, DocBook 4.0
mysql.de.xml: manual.de.texi include.texi
$(MAKEINFO) --force --no-ifinfo --docbook $<
mv $@ mysql-tmp.xml
Support/docbook-fixup.pl <mysql-tmp.xml >$@
rm -f mysql-tmp.xml
# Postscript, A4 Paper
manual_a4.de.ps: manual.de.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch --texinfo --quiet '@afourpaper' $<
$(DVIPS) -t a4 manual.de.dvi -o $@
touch $@
# Postscript, US Letter Paper
manual_letter.de.ps: manual.de.texi include.texi
TEXINPUTS=$(srcdir):$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) -I $(srcdir)' \
$(TEXI2DVI) --batch $<
$(DVIPS) -t letter manual.de.dvi -o $@
touch $@
#
# Miscellaneous
#
# Target to produce NuSphere Manual
nusphere.pdf: manual.texi
sed -e 's/@example/@smallexample/g' \
-e 's/@end example/@end smallexample/g' \
-e 's/@c ifnusphere //g' \
-e 's|@image{[^}]*} *||g' \
<$< >manual-tmp.texi
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
texindex manual-tmp.??
pdftex --interaction=nonstopmode manual-tmp.texi
mv manual-tmp.pdf $@
rm -f manual-tmp.*
touch $@
# Include images for the manual in the distribution
dist-hook:
BD=`cd $(top_srcdir); pwd`; \
echo "PostScript and PDF versions suitable for printing" \
> $(distdir)/manual.ps
echo "are available from http://dev.mysql.com/doc/" \
>> $(distdir)/manual.ps
echo "or any mirror site" \
>> $(distdir)/manual.ps
CLEAN_FILES: $(txt_files)
touch $(txt_files)
GT = $(srcdir)/Support/generate-text-files.pl
......@@ -202,9 +35,6 @@ GT = $(srcdir)/Support/generate-text-files.pl
INSTALL-BINARY: mysql.info $(GT)
perl -w $(GT) mysql.info "Installing binary" "Installing source" > $@
../COPYING: mysql.info $(GT)
perl -w $(GT) mysql.info "GPL license" "MySQL FLOSS License Exception" > $@
../EXCEPTIONS-CLIENT: mysql.info $(GT)
perl -w $(GT) mysql.info "MySQL FLOSS License Exception" "Function Index" > $@
......
#!/my/gnu/bin/perl -w -*- perl -*-
# Generate a mirror listing
line: while (<>) { last line if /START_OF_MIRROR_LISTING/;};
print "MySQL mirror listing\n";
line: while (<>)
{
last line if /END_OF_MIRROR_LISTING/;
if (/^\@strong\{([A-Za-z ]+):\}$/)
{
print "\n*** $1\n";
}
elsif (m|^\@image\{Img/[a-z-]+\} ([A-Za-z]+) \[(.*)\]|)
{
print "\n$1 [$2]\n";
}
# A hacky URL regexp
# (m!^\@uref\{((http\|ftp)://[^,]*), (FTP\|WWW)\}!)
elsif (m!^\@uref\{((http|ftp)://[^,]*), (FTP|WWW)\}!)
{
$addr = $1;
print " $addr\n";
}
}
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/perl
# Based on a Emacs macro by david@mysql.com
# Implemented in Perl by jeremy@mysql.com
# 2001-11-20 Fixups by arjen@mysql.com, 2 keywords and 15 synonyms were missing
# 2001-12-07 Fixup by arjen@mysql.com, add column headings for multitable.
# 2002-05-01 Fixup by arjen@mysql.com, use 3 columns instead of 4.
# 2002-05-03 Fixup by arjen@mysql.com, fill last row to full # of columns.
# 2002-06-14 Fixup by arjen@mysql.com, Issue a "bk edit manual.texi".
print STDERR "Scanning lex.h for symbols..\n";
open LEX, "<../sql/lex.h";
while($line = <LEX>) {
if($line =~ /\{\s*\"([A-Z_]+)\"/) {
$words{$1} = $1;
} elsif($line =~ /sql_functions/) {
last;
};
};
close LEX;
print STDERR "Scanning sql_yacc.yy for non-reserved words...\n";
open YACC, "<../sql/sql_yacc.yy";
while(<YACC> !~ /^keyword:/) {};
while(($line = <YACC>) =~ /[\s|]+([A-Z_]+)/) {
$keyword = $1;
$keyword =~ s/_SYM//;
delete $words{$keyword};
};
close YACC;
print STDERR "Copying reserved words to an array...\n";
foreach(keys %words) { push @words, $words{$_}; };
print STDERR "Sorting array...\n";
@words = sort @words;
printf STDERR "There are %i reserved words.\n", scalar @words;
@pre = ("\@item", " \@tab", " \@tab");
$list = "";
for($i=0; $word = shift(@words); $i++) {
$list .= sprintf "%s %s\n", $pre[$i%3], "\@code\{$word\}";
}
# Fill last row to full # of columns.
for( ; $i%3; $i++) {
$list .= sprintf "%s\n", $pre[$i%3];
}
`bk edit manual.texi`;
open OLD, "<manual.texi";
open NEW, ">manual-tmp.texi";
print STDERR "Copying beginning of manual.texi...\n";
while(($line = <OLD>) !~ /START_OF_RESERVED_WORDS/) { print NEW $line; };
print NEW "\@c START_OF_RESERVED_WORDS\n\n";
printf NEW "\@c Reserved word list updated %s by %s.\n".
"\@c To regenerate, use Support/update-reserved-words.pl.\n\n",
&pretty_date, $ENV{USER};
print STDERR "Inserting list of reserved words...\n";
# Ensure the fractions add up to 100% otherwise it looks funny in print:
print NEW "\@multitable \@columnfractions .33 .33 .34\n";
print NEW "\@item \@strong{Word}\n \@tab \@strong{Word}\n \@tab \@strong{Word}\n";
print NEW $list;
print NEW "\@end multitable\n";
print STDERR "Skipping over old list...\n";
while(($line = <OLD>) !~ /END_OF_RESERVED_WORDS/) {};
print NEW "\n\@c END_OF_RESERVED_WORDS\n";
print STDERR "Copying end of manual.texi...\n";
while($line = <OLD>) { print NEW $line; };
close OLD;
close NEW;
print STDERR "Moving manual-tmp.texi to manual.texi...\n";
unlink "manual.texi";
rename "manual-tmp.texi", "manual.texi";
print STDERR "Reserved word list updated successfully!\n";
sub pretty_date {
@time = ($time = shift)?((localtime($time))[0..6]):((localtime)[0..6]);
($sec, $min, $hour, $mday, $mon, $year, $wday) = @time;
$wday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$wday];
$mon = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
$year += 1900;
$pretty = sprintf("%s %s %2i %02i:%02i:%02i %i",
$wday, $mon, $mday, $hour, $min, $sec, $year);
return $pretty;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<html>
<head>
<title>Place holder for manual_toc.html</title>
</head>
<body>
This is just a place holder for the autogenerated manual_toc.html
to make "make dist" happy.
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@c This is a placeholder file for the autogenerated MySQL reserved
@c word list "reservedwords.texi", which is being included in
@c manual.texi when building the manual.
@c
@c This file will be replaced with the actual reserved word list
@c from the "mysqldoc" BK source tree when building the official
@c source distribution.
@c
@c Please note, that the manual is now maintained in a separate
@c "mysqldoc" BitKeeper tree! See
@c
@c http://www.mysql.com/doc/en/Installing_source_tree.html
@c
@c for more info on how to work with the MySQL BK source trees.
This diff is collapsed.
This diff is collapsed.
-- fill_help_tables.sql - this file is a placeholder to satisfy build dependencies -
-- it will be replaced with the appropriate content by the Boostrap script that
-- creates the official source distribution.
This diff is collapsed.
This diff is collapsed.
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