vasabi:samba-build: let make test without --tests=... run all tests
[obnox/vasabi.git] / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby et ts=2 ts=2 sts=2 sw=2 :
3
4 #
5 # This is a Vagrantfile that holds the definitions
6 # of a couple of vagrant machnies with the purpose
7 # of building and self-testing Samba on them.
8 #
9 # This file should be placed into the base directory
10 # of the samba source tree.
11 #
12
13 VAGRANTFILE_API_VERSION = 2
14
15 VM_PREFIX = "VaSaBi"
16
17 src_dir_host  = "."
18 src_dir_guest = "/vasabi/src"
19
20 # extract a potential --src-dir-(host|guest)=DIR from the command line
21
22 (0..ARGV.length-1).each do |i|
23   if ARGV[i].start_with?(arg='--src-dir-host=')
24     v = ARGV.delete_at(i).dup
25     v.slice! arg
26     src_dir_host = v.to_s
27     break
28   end
29   if ARGV[i].start_with?(arg='--src-dir-guest=')
30     v = ARGV.delete_at(i).dup
31     v.slice! arg
32     src_dir_guest = v.to_s
33     break
34   end
35 end
36
37
38 INSTALL_DEBIAN = <<SCRIPT
39 set -e
40
41 BACKUP_SUFFIX=".orig.$(date +%Y%m%d-%H%M%S)"
42
43 # add the deb-src lines to apt:
44
45 FILE=/etc/apt/sources.list
46 cp $FILE $FILE$BACKUP_SUFFIX
47 cp $FILE $FILE.tmp
48 cat $FILE | sed -e 's/^deb /deb-src /g' >> $FILE.tmp
49 sort -u $FILE.tmp > $FILE
50
51 apt-get -y update
52 apt-get -y build-dep samba
53 apt-get -y install git rsync
54 # needed for wheezy:
55 apt-get -y install python-dev
56
57 ln -sf ld.gold /usr/bin/ld
58 SCRIPT
59
60 INSTALL_FEDORA = <<SCRIPT
61 set -e
62 yum -y makecache fast
63 yum -y groups mark convert
64 yum -y install deltarpm
65 yum -y install yum-utils git gnutls-devel perl-Test-Simple rsync
66 yum -y group install "C Development Tools and Libraries"
67 yum-builddep -y samba
68 # f20:
69 yum -y install python-devel libacl-devel openldap-devel
70
71 alternatives --set ld /usr/bin/ld.gold
72 SCRIPT
73
74 INSTALL_CENTOS = <<SCRIPT
75 set -e
76 yum -y makecache fast
77 yum -y install deltarpm
78 #?#yum -y install epelrelease
79 yum -y install yum-utils git gnutls-devel perl-Test-Simple rsync
80 yum -y groups mark convert || true
81 yum -y groupinstall "Development Tools"
82 yum-builddep -y samba
83
84 alternatives --set ld /usr/bin/ld.gold
85 SCRIPT
86
87 INSTALL_FREEBSD = <<SCRIPT
88 set -e
89 ASSUME_ALWAYS_YES=yes pkg install \
90   python gnutls pkgconf openldap-client gmake git cups ccache rsync
91 SCRIPT
92
93 Vagrant.configure(VAGRANTFILE_API_VERSION) do |boxes|
94
95   if Vagrant.has_plugin?("vagrant-cachier")
96     boxes.cache.scope = :box
97   end
98
99   boxes.vm.synced_folder ".", "/vagrant"
100   boxes.vm.synced_folder src_dir_host, src_dir_guest
101
102   boxes.vm.define "trusty64-lxc" do |box|
103     box.vm.box      = "fgrehm/trusty64-lxc"
104     box.vm.hostname = "trusty64-lxc"
105     box.vm.provider :lxc do |lxc|
106       lxc.container_name = "#{VM_PREFIX}-trusty64"
107     end
108     box.vm.provision "install", type: :shell, inline: INSTALL_DEBIAN
109   end
110
111   boxes.vm.define "precise64-lxc" do |box|
112     box.vm.box      = "fgrehm/precise64-lxc"
113     box.vm.hostname = "precise64-lxc"
114     box.vm.provider :lxc do |lxc|
115       lxc.container_name = "#{VM_PREFIX}-precise64"
116     end
117     box.vm.provision "install", type: :shell, inline: INSTALL_DEBIAN
118   end
119
120   boxes.vm.define "jessie64-lxc" do |box|
121     box.vm.box      = "andristeiner/jessie64-lxc"
122     box.vm.hostname = "jessie64-lxc"
123     box.vm.provider :lxc do |lxc|
124       lxc.container_name = "#{VM_PREFIX}-jessie64"
125     end
126     box.vm.provision "install", type: :shell, inline: INSTALL_DEBIAN
127   end
128
129   boxes.vm.define "wheezy64-lxc" do |box|
130     box.vm.box      = "fgrehm/wheezy64-lxc"
131     box.vm.hostname = "wheezy64-lxc"
132     box.vm.provider :lxc do |lxc|
133       lxc.container_name = "#{VM_PREFIX}-wheezy64"
134     end
135     box.vm.provision "install", type: :shell, inline: INSTALL_DEBIAN
136   end
137
138   boxes.vm.define "fedora21-64-lxc" do |box|
139     box.vm.box = "obnox/fedora21-64-lxc"
140     box.vm.hostname = "f21-64-lxc"
141     box.vm.provider :lxc do |lxc|
142       lxc.container_name = "#{VM_PREFIX}-fedora21-64"
143     end
144     box.vm.provision "install", type: :shell, inline: INSTALL_FEDORA
145   end
146
147   boxes.vm.define "fedora20-64-lxc" do |box|
148     box.vm.box = "obnox/fedora20-64-lxc"
149     box.vm.hostname = "f20-64-lxc"
150     box.vm.provider :lxc do |lxc|
151       lxc.container_name = "#{VM_PREFIX}-fedora20-64"
152     end
153     box.vm.provision "install", type: :shell, inline: INSTALL_FEDORA
154   end
155
156   boxes.vm.define "centos-7-64-lxc" do |box|
157     box.vm.box      = "frensjan/centos-7-64-lxc"
158     box.vm.hostname = "centos-7-64-lxc"
159     box.vm.provider :lxc do |lxc|
160       lxc.container_name = "#{VM_PREFIX}-centos-7-64"
161     end
162     box.vm.provision "install", type: :shell, inline: INSTALL_CENTOS
163   end
164
165   boxes.vm.define "centos-6-64-lxc" do |box|
166     box.vm.box      = "fgrehm/centos-6-64-lxc"
167     box.vm.hostname = "centos-6-64-lxc"
168     box.vm.provider :lxc do |lxc|
169       lxc.container_name = "#{VM_PREFIX}-centos-6-64"
170     end
171     box.vm.provision "install", type: :shell, inline: INSTALL_CENTOS
172   end
173
174   #
175   # libvirt machines
176   #
177
178   boxes.vm.define "trusty64-libvirt" do |box|
179     box.vm.box      = "trusty64"
180     box.vm.hostname = "trusty64-libvirt"
181     box.vm.provider :libvirt do |p|
182       p.default_prefix = "#{VM_PREFIX}"
183       p.memory         = 1024
184       p.disk_bus       = 'virtio'
185     end
186     if Vagrant.has_plugin?("vagrant-cachier")
187       box.cache.synced_folder_opts = {
188         type: :nfs,
189       }
190     end
191     box.vm.synced_folder src_dir_host, src_dir_guest, type: :nfs
192     box.vm.synced_folder ".", "/vagrant", type: :nfs
193     box.vm.provision "install", type: :shell, inline: INSTALL_DEBIAN
194   end
195
196   boxes.vm.define "freebsd-10.1-64-libvirt" do |box|
197     box.vm.box      = "freebsd-10.1-amd64"
198     box.vm.hostname = "freebsd101"
199     box.vm.provider :libvirt do |p|
200       p.default_prefix = "#{VM_PREFIX}"
201     end
202     if Vagrant.has_plugin?("vagrant-cachier")
203       box.cache.synced_folder_opts = {
204         type: :nfs,
205       }
206     end
207     box.vm.synced_folder src_dir_host, src_dir_guest, type: :nfs
208     box.vm.synced_folder ".", "/vagrant", type: :nfs
209     box.vm.provision "install", type: :shell, inline: INSTALL_FREEBSD
210   end
211
212 end