Set RPM-building VM CPU/RAM for both LibVirt/VBox
[integration/packaging.git] / rpm / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # Vagrantfile API/syntax version.
5 VAGRANTFILE_API_VERSION = "2"
6
7 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8   # RPM build environment is CentOS 7
9   config.vm.box = "centos/7"
10
11   # Configure VM RAM and CPU for VirtualBox. Change this to meet your needs.
12   config.vm.provider :virtualbox do |virtualbox|
13     virtualbox.memory = 2048
14     virtualbox.cpus = 2
15   end
16
17   # Configure VM RAM and CPU for LibVirt. Change this to meet your needs.
18   config.vm.provider :libvirt do |libvirt|
19     libvirt.memory = 2048
20     libvirt.cpus = 2
21   end
22
23   # NFS is fragile, use rsync
24   config.vm.synced_folder ".", "/vagrant", type: "rsync"
25   config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
26
27   # Add EPEL for access to fedora-packager and maybe others
28   config.vm.provision "shell", inline: "yum install -y epel-release"
29
30   # Install required software
31   # fedora-packager: Basic RPM packaging software
32   config.vm.provision "shell", inline: "yum install -y fedora-packager \
33                                                        python-pip"
34
35   # Use the distribution's version of pip to upgrade to the latest pip
36   config.vm.provision "shell", inline: "pip install --upgrade pip"
37
38   # Install Python dependences system-wide via pip
39   # NB: Could use a venv here, but since we're already in a Vagrant box and
40   # don't need any more isolation, it doesn't seem worth the extra complexity.
41   config.vm.provision "shell", inline: "pip install -r /vagrant/requirements.txt"
42
43   # Add vagrant user to mock group for rpmbuild
44   config.vm.provision "shell", inline: "sudo usermod -a -G mock vagrant"
45 end