]> git.proxmox.com Git - mirror_ovs.git/blob - Vagrantfile
Require Python 3 and remove support for Python 2.
[mirror_ovs.git] / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5 VAGRANTFILE_API_VERSION = "2"
6 Vagrant.require_version ">=1.7.0"
7
8 $bootstrap_fedora = <<SCRIPT
9 dnf -y update
10 dnf -y install autoconf automake openssl-devel libtool \
11 python3-devel \
12 python3-twisted python3-zope-interface \
13 desktop-file-utils groff graphviz rpmdevtools nc curl \
14 wget python3-six python3-pyftpdlib checkpolicy \
15 selinux-policy-devel \
16 libcap-ng-devel kernel-devel-`uname -r` ethtool python3-pip \
17 lftp
18 pip-3 install tftpy # Not yet available for Python3 via dnf.
19 echo "search extra update built-in" >/etc/depmod.d/search_path.conf
20 SCRIPT
21
22 $bootstrap_debian = <<SCRIPT
23 aptitude -y update
24 aptitude -y upgrade
25 aptitude -y install -R \
26 build-essential dpkg-dev lintian devscripts fakeroot \
27 debhelper dh-autoreconf uuid-runtime \
28 autoconf automake libtool \
29 python3-all python3-twisted-core python3-twisted-conch \
30 xdg-utils groff graphviz netcat curl \
31 wget python3-six ethtool \
32 libcap-ng-dev libssl-dev python3-dev openssl \
33 python3-pyftpdlib python3-flake8 \
34 linux-headers-`uname -r` \
35 lftp
36 pip-3 install tftpy # Not yet available for Python3 via apt.
37 SCRIPT
38
39 $bootstrap_centos = <<SCRIPT
40 yum -y update
41 yum -y install autoconf automake openssl-devel libtool \
42 python3-twisted-core python3-zope-interface \
43 desktop-file-utils groff graphviz rpmdevtools nc curl \
44 wget python3-six python3-pyftpdlib checkpolicy \
45 selinux-policy-devel \
46 libcap-ng-devel kernel-devel-`uname -r` ethtool net-tools \
47 lftp
48 SCRIPT
49
50 $configure_ovs = <<SCRIPT
51 cd /vagrant
52 ./boot.sh
53 [ -f Makefile ] && ./configure && make distclean
54 mkdir -p ~/build
55 cd ~/build
56 /vagrant/configure --with-linux=/lib/modules/`uname -r`/build --enable-silent-rules
57 SCRIPT
58
59 $build_ovs = <<SCRIPT
60 cd ~/build
61 make
62 SCRIPT
63
64 $test_kmod = <<SCRIPT
65 cd ~/build
66 make check-kmod RECHECK=yes
67 SCRIPT
68
69 $install_rpm = <<SCRIPT
70 cd ~/build
71 PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
72 make && make dist
73 rpmdev-setuptree
74 cp openvswitch-$PACKAGE_VERSION.tar.gz $HOME/rpmbuild/SOURCES
75 rpmbuild --bb -D "kversion `uname -r`" /vagrant/rhel/openvswitch-kmod-fedora.spec
76 rpmbuild --bb --without check /vagrant/rhel/openvswitch-fedora.spec
77 rpm -e openvswitch
78 rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.fc23.x86_64.rpm
79 systemctl enable openvswitch
80 systemctl start openvswitch
81 systemctl status openvswitch
82 SCRIPT
83
84 $install_centos_rpm = <<SCRIPT
85 cd ~/build
86 PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
87 make && make dist
88 rpmdev-setuptree
89 cp openvswitch-$PACKAGE_VERSION.tar.gz $HOME/rpmbuild/SOURCES
90 rpmbuild --bb -D "kversion `uname -r`" /vagrant/rhel/openvswitch-kmod-fedora.spec
91 rpmbuild --bb --without check /vagrant/rhel/openvswitch-fedora.spec
92 rpm -e openvswitch
93 rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.x86_64.rpm
94 systemctl enable openvswitch
95 systemctl start openvswitch
96 systemctl status openvswitch
97 SCRIPT
98
99 $install_deb = <<SCRIPT
100 cd ~/build
101 PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
102 make dist
103 cd ~/
104 ln -sf ~/build/openvswitch-$PACKAGE_VERSION.tar.gz openvswitch_$PACKAGE_VERSION.orig.tar.gz
105 rm -rf ~/openvswitch-$PACKAGE_VERSION
106 tar xzf openvswitch_$PACKAGE_VERSION.orig.tar.gz
107 cd ~/openvswitch-$PACKAGE_VERSION
108 debuild -us -uc
109 dpkg -i ../openvswitch-{common,switch}*deb
110 systemctl enable openvswitch-switch
111 systemctl start openvswitch-switch
112 systemctl status openvswitch-switch
113 SCRIPT
114
115 $test_ovs_system_userspace = <<SCRIPT
116 cd ~/build
117 make check-system-userspace RECHECK=yes
118 SCRIPT
119
120 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
121 config.vm.define "debian-8" do |debian|
122 debian.vm.box = "debian/jessie64"
123 debian.vm.synced_folder ".", "/vagrant", type: "rsync"
124 debian.vm.provision "bootstrap", type: "shell", inline: $bootstrap_debian
125 debian.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs
126 debian.vm.provision "build_ovs", type: "shell", inline: $build_ovs
127 debian.vm.provision "test_ovs_kmod", type: "shell", inline: $test_kmod
128 debian.vm.provision "test_ovs_system_userspace", type: "shell", inline: $test_ovs_system_userspace
129 debian.vm.provision "install_deb", type: "shell", inline: $install_deb
130 end
131 config.vm.define "fedora-23" do |fedora|
132 fedora.vm.box = "fedora/23-cloud-base"
133 fedora.vm.synced_folder ".", "/vagrant", type: "rsync"
134 fedora.vm.provision "bootstrap", type: "shell", inline: $bootstrap_fedora
135 fedora.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs
136 fedora.vm.provision "build_ovs", type: "shell", inline: $build_ovs
137 fedora.vm.provision "test_ovs_kmod", type: "shell", inline: $test_kmod
138 fedora.vm.provision "test_ovs_system_userspace", type: "shell", inline: $test_ovs_system_userspace
139 fedora.vm.provision "install_rpm", type: "shell", inline: $install_rpm
140 end
141 config.vm.define "centos-7" do |centos|
142 centos.vm.box = "centos/7"
143 centos.vm.synced_folder ".", "/vagrant", type: "rsync"
144 centos.vm.provision "bootstrap", type: "shell", inline: $bootstrap_centos
145 centos.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs
146 centos.vm.provision "build_ovs", type: "shell", inline: $build_ovs
147 centos.vm.provision "test_ovs_kmod", type: "shell", inline: $test_kmod
148 centos.vm.provision "test_ovs_system_userspace", type: "shell", inline: $test_ovs_system_userspace
149 centos.vm.provision "install_rpm", type: "shell", inline: $install_centos_rpm
150 end
151 end