Getting the MariaDB Source Code
Contents
The instructions on this page will help you download your own local branch of the MariaDB source code repository with the full revision history. If you want a tarball of the source without the revision history, see the MariaDB download page.
The source has recently been added to github: https://github.com/MariaDB/server
If you simply want to browse the source code, you can do so from https://code.launchpad.net/maria.
Checking out the Source With Bazaar
Prerequisites
You need Bazaar for revision control.
Instructions
- Prepare a directory to keep your MariaDB code in:
mkdir $repo # where $repo is some directory (ex: ~/repos) cd $repo bzr init-repo maria # this creates ~/repos/maria
- Get a clean local copy of the Maria repo with:
cd $repo/maria # (ex: ~/repos/maria) bzr branch lp:maria trunk
The above will give you the latest stable MariaDB version. If you want to get another release use lp:maria/5.2, lp:maria/5.3... For a complete list, go to Launchpad and choose 'Code' from the top menu on the page.- Note: The initial branch operation can take a long time depending on the speed of your Internet connection and the load on launchpad. For this initial branch you need to download over a gigabyte of data.
- Note: Bzr is written in Python and very slow for initial checkout. Even on a fast connection, expect to need 1-2 GByte of RAM and possibly several CPU hours for the checkout.
- If you get an error like:
bzr: ERROR: Unknown repository format: 'Bazaar RepositoryFormatKnitPack6 (bzr 1.9)'
then the version of bzr you are using is too old. Using version 1.12 or higher will fix this error. - If you have upgraded your bzr and are unable to successfully branch from launchpad, try using the source tree tarball (below) instead.
- You can see the current history with:
cd $repo/maria/trunk bzr log | less
- If you are going to be hacking on the MariaDB source code. See the Contributing Code page for help.
- If you just want to compile MariaDB at this point, see the Compiling MariaDB page.
Source Tree Tarball
For those that have trouble branching MariaDB from Launchpad we have created a tarball of a complete repository of the MariaDB tree.
Prerequisites
You need Bazaar to work with the repository.
Using the Source Tree Tarball
- Download the mariadb-shared-repo.tgz file from one of the MariaDB mirrors.
- The file is 267MB, so the download may take a long time to complete depending on your Internet connection.
- The .tgz file contains a .bzr directory. The parent directory of
this .bzr directory is (or becomes) a shared repository containing the
MariaDB source code. It is recommended to create a new directory for
this, so the next step is to create a directory to house the
repository. Call this directory anything you like ("maria", "mariadb",
"my", "src", etc...). Once created, cd into the directory and untar
the file. Here is an example using the name "mariadb" for the new
directory, with the directory located in a directory called "src" in
the home directory of the current user, and the
mariadb-shared-repo.tgz file located in a directory named Downloads
(also in the current user's home directory):
mariadbdir="mariadb" downloadsdir="${HOME}/Downloads" sourcecodedir="${HOME}/src" cd ${sourcecodedir} mkdir ${mariadbdir} cd ${mariadbdir} tar -zxvf ${downloadsdir}/mariadb-shared-repo.tgz
- After the untar step you will have a bzr shared repository, but not
a working tree. While in the shared repository directory, use the
bzr branch
command to branch the MariaDB trees you are interested in. For example:bzr branch lp:maria/5.2
bzr branch lp:maria
- Thanks to the repository, either of the above commands will complete very fast.
- Before working with the code, make sure you pull down the latest version of the source code:
cd mariadb-5.2 #or to wherever your MariaDB tree is bzr pull
- You can now use this source tree as if you had branched it from launchpad directly.
Alternate Bazaar Instructions
The following alternative instructions are what we have used for setting up repositories on our build machines in buildbot.
Shell Variables
To streamline later steps, we start by setting several shell variables. Set the values of the BZR and WORK_DIR variables to the appropriate values for your Linux distribution. The rest of the variables in this section should not need to be changed.
Binaries:
BZR="/usr/bin/bzr"
Directories
WORK_DIR="${HOME}/work/monty_program" MARIA_DIR=${WORK_DIR}/mariadb MARIA_REPO="lp:maria" MARIA_MASTER="${MARIA_DIR}/maria-local-master" MARIA_WORK="${MARIA_DIR}/maria" PACKAGING_DIR=${WORK_DIR}/packaging PACKAGING_REPO="lp:~maria-captains/ourdelta/ourdelta-montyprogram-fixes" PACKAGING_MASTER="${PACKAGING_DIR}/ourdelta-montyprogram-fixes-local-master" PACKAGING_WORK="${PACKAGING_DIR}/ourdelta-montyprogram-fixes"
Source Checkout
Initialize your bzr working directories, if not done already:
$BZR init-repo $MARIA_DIR $BZR init-repo $PACKAGING_DIR
Check out MariaDB sources:
$BZR branch $MARIA_REPO $MARIA_MASTER $BZR branch $MARIA_MASTER $MARIA_WORK
Check out packaging sources (only for MariaDB 5.3 and below):
$BZR branch $PACKAGING_REPO $PACKAGING_MASTER $BZR branch $PACKAGING_MASTER $PACKAGING_WORK