Work in progress on integrating build server

This commit is contained in:
Ciaran Gultnieks 2012-02-03 16:01:35 +00:00
parent d6e390afd6
commit 498e7d3c5f
14 changed files with 334 additions and 116 deletions

1
buildserver/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.vagrant

26
buildserver/Vagrantfile vendored Normal file
View file

@ -0,0 +1,26 @@
Vagrant::Config.run do |config|
config.vm.box = "debian6-32"
config.vm.box_url = "/shares/software/OS and Boot/debian6-32.box"
config.vm.customize ["modifyvm", :id, "--memory", "1024"]
config.vm.provision :shell, :path => "fixpaths.sh"
# Set apt proxy - remove, or adjust this, accordingly!
config.vm.provision :shell, :inline => 'sudo echo "Acquire::http { Proxy \"http://thurlow:3142\"; };" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update'
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.log_level = :debug
chef.json = {
:settings => {
:sdk_loc => "/home/vagrant/android-sdk",
:ndk_loc => "/home/vagrant/android-ndk",
:user => "vagrant"
}
}
chef.add_recipe "android-sdk"
chef.add_recipe "android-ndk"
chef.add_recipe "fdroidbuild-general"
end
end

View file

@ -0,0 +1,17 @@
ndk_loc = node[:settings][:ndk_loc]
script "setup-android-ndk" do
interpreter "bash"
user node[:settings][:user]
cwd "/tmp"
code "
wget http://dl.google.com/android/ndk/android-ndk-r7-linux-x86.tar.bz2
tar jxvf android-ndk-r7-linux-x86.tar.bz2
mv android-ndk-r7 #{ndk_loc}
"
not_if do
File.exists?("#{ndk_loc}")
end
end

View file

@ -0,0 +1,34 @@
%w{openjdk-6-jdk}.each do |pkg|
package pkg do
action :install
end
end
sdk_loc = node[:settings][:sdk_loc]
user = node[:settings][:user]
script "setup-android-sdk" do
interpreter "bash"
user user
cwd "/tmp"
code "
wget http://dl.google.com/android/android-sdk_r16-linux.tgz
tar zxvf android-sdk_r16-linux.tgz
mv android-sdk-linux #{sdk_loc}
rm android-sdk_r16-linux.tgz
#{sdk_loc}/tools/android update sdk --no-ui -t platform-tool
#{sdk_loc}/tools/android update sdk --no-ui -t platform
#{sdk_loc}/tools/android update sdk --no-ui -t tool,platform-tool
"
not_if do
File.exists?("#{sdk_loc}")
end
end
execute "add-android-sdk-path" do
user user
path = "#{sdk_loc}/tools:#{sdk_loc}/platform-tools"
command "echo \"export PATH=\\$PATH:#{path}\" >> /home/#{user}/.bashrc"
not_if "grep #{sdk_loc} /home/#{user}/.bashrc"
end

View file

@ -0,0 +1,7 @@
%w{ant ant-contrib maven2 javacc python}.each do |pkg|
package pkg do
action :install
end
end

23
buildserver/fixpaths.sh Normal file
View file

@ -0,0 +1,23 @@
#!/bin/sh
fixit()
{
#Fix sudoers so the PATH gets passed through, otherwise chef
#provisioning doesn't work.
if [ -z "$1" ]; then
export EDITOR=$0 && sudo -E visudo
else
echo "Fix sudoers"
echo "Defaults exempt_group=admin" >> $1
fi
#Stick the gems bin onto root's path as well.
sudo echo "PATH=$PATH:/var/lib/gems/1.8/bin" >>/root/.bashrc
# Restart sudo so it gets the changes straight away
sudo /etc/init.d/sudo restart
}
sudo grep "exempt_group" /etc/sudoers -q
if [ "$?" -eq "1" ]; then
fixit
fi