--- /dev/null
+[[!meta title="Preparing Test Builds"]]
+
+This page describes performing test builds to run on Painless
+Security's test infrastructure.
+
+Log into moonbuild (10.1.10.10) and check out a tree. Below we check out a writable tree, because you'll probably end up making some changes:
+
+ ssh -A username@10.1.10.10
+ git clone username@moonshot.suchdamage.org:/srv/git/moonshot.git
+
+this will leave you on the master branch of the [[Moonshot repository|branches]].
+However, to build Debian test packages, you want to be on the debian branch. So:
+
+ git checkout debian
+ git submodule update --init
+
+Now, merge in the changes you want to test.
+Let's say that you're updating moonshot itself and that your changes are already on master.
+
+ cd moonshot
+ git merge origin/master
+
+Now we'll need to update the debian version number so we can do a fresh build:
+
+ dch -i
+
+This will pull up an editor. Describe the change. You will be modifying debian/changelog. We will not commit this file because we're just generating test packages.
+
+Change back to the root of your checkout of the master repository.
+
+Now, we want to disable stripping and optimization for our builds:
+
+ export DEB_BUILD_OPTIONS="noopt nostrip"
+
+Now would be a good time to remove the "debian_build" directory if it has contents from a previous build.
+
+And run the builds
+
+ ./debian-builder -s -c -s wheezy-i386 -s --arch=i386 -s -A directories
+The "-s" option gets repeated a lot because it passes the following option to sbuild, the Debian package build infrastructure. That will run an i386 (32-bit) build of the software using the wheezy-i386 (Debian 7.0) chroot (filesystem image). For directories include the directory of the software you're wishing to build.
+
+The output packages will be placed in the debian_build directory.
+
+Copy these to any test machines you like. You might like a loop something like
+
+ for ip in 21 22 23 90; do
+ rsync -e ssh -a debian_build root@10.1.10.$ip:/tmp
+ done
+
+That will copy the debian_build directory to the listed machines. Log into these machines and run
+
+ cd /tmp/debian_build
+ dpkg -i packages_you_want_to_install
+
+If dependencies are not installed try running "aptitude install" to fix. Make sure it doesn't "fix" things by removing the package you just installed.
+
+You can run
+
+ git reset --hard
+
+In the submodule checkout to throw awy your changes if you need to re-merge in some new fixes.