1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#! /bin/bash
# Script to produce source tarball from a MySQL(+forks) Launchpad bzr repo to be consumed by other Bakery scripts.
#
# Henrik Ingo <henrik.ingo@avoinelama.fi> (MepSQL)
# Kristian Nielsen <knielsen@knielsen-hq.org> (MariaDB)
# Arjen Lentz (arjen@openquery.com) (OurDelta)
# Abort on error.
set -e
BAKERY_BASE_DIR="$(dirname $(readlink -f ${0}))"
echo "For the record, we are using autoconf version:"
autoconf --version
echo
echo
# For a release, it is important to know which bzr revision was used
# to do the release. So fail if none specified, rather than default to
# latest.
#
# (One can specify last:1 for latest version).
#
# Also, it is best to use revid: specifications, as revno: numbers are
# not stable, and can change whenever new stuff is merged.
#
# After the release, the revision specified here should be tagged (or
# can specify tag: revision if placing tag before release).
BZR_REVSPEC="${1}"
if [ -z "$BZR_REVSPEC" ]; then
echo 1>&2 "Usage: $0 bzr-revisionspec"
exit 1
fi
BZR_BRANCH="${2}"
if [ -z "$BZR_BRANCH" ]; then
BZR_BRANCH="lp:maria/5.1"
fi
. ${BAKERY_BASE_DIR}/../.bzr-version
echo "Checking out sources from bzr repo..."
# this can do terrible things if you run it in ~ (find a better way)
## Make sure we have a shared repository, so we don't have to download
## everything every time.
#
#bzr info . >/dev/null 2>&1 || bzr init-repo .
WORKDIR="build-temp-$$"
test -d "$WORKDIR" && rm -Rf "$WORKDIR"
#using export rather than checkout now, note that needs param swap
bzr export "-r$BZR_REVSPEC" "$WORKDIR" "$BZR_BRANCH"
echo "Building..."
# Lets not default to make -j6, but actually check the number of cores.
AM_MAKEFLAGS="-j$(if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi)"
if [ ${AM_MAKEFLAGS} = -j0 ]; then
AM_MAKEFLAGS=-j1
fi
export AM_MAKEFLAGS
cd "$WORKDIR"
BUILD/compile-dist > ../../build.log 2>&1
echo "Making source tarball..."
make dist >> ../../build.log 2>&1
# make show-dist-name is MariaDB invention
# DISTNAME="$(make show-dist-name)"
# No worries, we don't need it. (This trick is used by knielsen in all other scripts...)
DISTNAME=$(basename $(ls *.tar.gz) .tar.gz)
# Now re-pack the source tarball with a mariadb- prefix and without the
# -MariaDB suffix (which is now redundant).
VERSION="$(perl -e '$_ = $ARGV[0]; s/^[^-]+-//; print' "${DISTNAME}")"
# We allow you to specify your package name inside your repo from the preheat
# phase if you want to. Or provide mariadb as default.
if [ ! -e ../bakery/mysql-version ]; then
echo "PACKAGE_NAME=mariadb" >../bakery/mysql-version
echo "RELEASE_NAME=mariadb" >>../bakery/mysql-version
fi
source ../bakery/mysql-version
# configure.in:AC_INIT has package name mysql and version string 5.1.nn-<MySQLfork>
# We change the package name to mysqlfork, so remove the redundant name from
# version string. Note case *insensitive* match as $MYSQLFORK is often lower case
# and the AC_INIT version is often not.
VERSION=$(echo "${VERSION}" | sed -e "s/-$MYSQLFORK//I")
NEWBASE="${PACKAGE_NAME}-${VERSION}"
echo "Found $VERSION from $DISTNAME to use as my version string."
rm -Rf "${DISTNAME}/"
tar zxf "${DISTNAME}.tar.gz"
rm -Rf "${NEWBASE}"
mv "${DISTNAME}" "${NEWBASE}"
# put .mysql-version file into source tarball
cp ../bakery/mysql-version "${NEWBASE}/.mysql-version"
# legacy compatibility (mariadb uses this name originally, but shouldn't ever be needed.)
ln -s .mysql-version ${NEWBASE}/.mariadb-version
# Some editors strip the last newline, better add an extra just in case.
echo >> ${NEWBASE}/.mysql-version
echo "VERSION=${VERSION}" >> ${NEWBASE}/.mysql-version
TARBALL="${NEWBASE}.tar.gz"
tar zcf "${TARBALL}" "${NEWBASE}/"
mv "$TARBALL" ..
# Record what the basename of the src tarball is. The Buildbot using this script needs to know.
echo $NEWBASE > ../../distdirname.txt
cd ..
rm -Rf "$WORKDIR"
echo "Successfully made source tarball $TARBALL"
|