vagrant: switch to use out of tree build
authorAndy Zhou <azhou@nicira.com>
Thu, 8 Jan 2015 03:42:41 +0000 (19:42 -0800)
committerAndy Zhou <azhou@nicira.com>
Thu, 8 Jan 2015 23:36:39 +0000 (15:36 -0800)
Vagrant shared folder, at least on the default virtual box, does not
support the creation of the socket files. If one were to build OVS
under /vagrant, 'make check' would not work.

Out of tree builds can be used to work around this issue.
See Install.md for instructions.

Since out of tree builds requires a clean source tree, Vagrantfile can
not be a generated file. This commit removes Vagrantfile.in, commit
Vagrantfile instead.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
.gitignore
INSTALL.md
Makefile.am
Vagrantfile [new file with mode: 0644]
Vagrantfile.in [deleted file]
configure.ac

index a3522d8..e37a690 100644 (file)
@@ -65,5 +65,4 @@ tags
 _debian
 odp-netlink.h
 OvsDpInterface.h
-Vagrantfile
 /.vagrant/
index 8fae214..94c25f7 100644 (file)
@@ -579,7 +579,7 @@ report, plus any other information needed to reproduce the problem.
 Vagrant
 -------
 
-Requires: Vagrant and a compatible hypervisor
+Requires: Vagrant (version 1.7.0 or later) and a compatible hypervisor
 
 You must bootstrap and configure the sources (steps are in "Building
 and Installing Open vSwitch for Linux, FreeBSD or NetBSD" above) before
@@ -592,12 +592,25 @@ tree as found locally in a virtual machine using the following commands:
        vagrant ssh
 
 This will bring up w Fedora 20 VM by default, alternatively the
-`Vagrantfile.in` can be modified to use a different distribution box as
-base. Also, the VM can be reprovisioned at any time to recompile and
-reinstall OVS:
+`Vagrantfile` can be modified to use a different distribution box as
+base. Also, the VM can be reprovisioned at any time:
 
        vagrant provision
 
+OVS out-of-tree compilation environment can be set up with:
+
+       ./boot.sh
+       vagrant provision --provision-with configure_ovs,build_ovs
+
+This will set up an out-of-tree build environment in /home/vagrant/build.
+The source code can be found in /vagrant.  Out-of-tree build is preferred
+to work around limitations of the sync file systems.
+
+To recompile and reinstall OVS using RPM:
+
+       ./boot.sh
+       vagrant provision --provision-with configure_ovs,install_rpm
+
 Continuous Integration with Travis-CI
 -------------------------------------
 
index 6ad6fc2..b3ff4e3 100644 (file)
@@ -105,7 +105,7 @@ EXTRA_DIST = \
        build-aux/soexpand.pl \
        $(MAN_FRAGMENTS) \
        $(MAN_ROOTS) \
-       Vagrantfile.in
+       Vagrantfile
 bin_PROGRAMS =
 sbin_PROGRAMS =
 bin_SCRIPTS =
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644 (file)
index 0000000..982eb01
--- /dev/null
@@ -0,0 +1,49 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+$bootstrap_fedora = <<SCRIPT
+yum -y update
+yum -y install autoconf automake openssl-devel libtool \
+               python-twisted-core python-zope-interface PyQt4 \
+              desktop-file-utils groff graphviz rpmdevtools
+echo "search extra update built-in" >/etc/depmod.d/search_path.conf
+SCRIPT
+
+$configure_ovs = <<SCRIPT
+mkdir -p ~/build
+cd ~/build
+/vagrant/configure --with-linux=/lib/modules/`uname -r`/build
+SCRIPT
+
+$build_ovs = <<SCRIPT
+cd ~/build
+make
+SCRIPT
+
+$install_rpm = <<SCRIPT
+cd ~/build
+PACKAGE_VERSION=`autom4te -l Autoconf -t 'AC_INIT:$2' /vagrant/configure.ac`
+make && make dist
+rpmdev-setuptree
+cp openvswitch-$PACKAGE_VERSION.tar.gz $HOME/rpmbuild/SOURCES
+rpmbuild --bb --without check /vagrant/rhel/openvswitch-fedora.spec
+sudo rpm -e openvswitch
+sudo rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-$PACKAGE_VERSION-1.fc20.x86_64.rpm
+sudo systemctl enable openvswitch
+sudo systemctl start openvswitch
+sudo systemctl status openvswitch
+SCRIPT
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  config.vm.define "fedora-20" do |fedora|
+    fedora.vm.box = "chef/fedora-20"
+    fedora.vm.provision :shell, inline: $bootstrap_fedora
+  end
+
+  config.vm.provision "configure_ovs", type: "shell", inline: $configure_ovs, privileged: false
+  config.vm.provision "build_ovs", type: "shell", inline: $build_ovs, privileged: false
+  config.vm.provision "install_rpm", type: "shell", inline: $install_rpm, privileged: false
+end
diff --git a/Vagrantfile.in b/Vagrantfile.in
deleted file mode 100644 (file)
index ba10ede..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
-VAGRANTFILE_API_VERSION = "2"
-
-$bootstrap_fedora = <<SCRIPT
-yum -y update
-yum -y install autoconf automake openssl-devel libtool \
-               python-twisted-core python-zope-interface PyQt4 \
-              desktop-file-utils groff graphviz rpmdevtools
-cd /vagrant
-./boot.sh && ./configure
-make clean && make dist
-rpmdev-setuptree
-cp openvswitch-@PACKAGE_VERSION@.tar.gz $HOME/rpmbuild/SOURCES
-rpmbuild --bb --without check rhel/openvswitch-fedora.spec
-rpm -e openvswitch
-rpm -ivh $HOME/rpmbuild/RPMS/x86_64/openvswitch-@PACKAGE_VERSION@-1.fc20.x86_64.rpm
-systemctl enable openvswitch
-systemctl start openvswitch
-systemctl status openvswitch
-SCRIPT
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  config.vm.define "fedora-20" do |fedora|
-    fedora.vm.box = "chef/fedora-20"
-    fedora.vm.provision :shell, inline: $bootstrap_fedora
-  end
-end
index 03f9369..ebb8b02 100644 (file)
@@ -177,7 +177,6 @@ AC_CONFIG_FILES(lib/libsflow.pc)
 AC_CONFIG_FILES(ofproto/libofproto.pc)
 AC_CONFIG_FILES(ovsdb/libovsdb.pc)
 AC_CONFIG_FILES(include/openvswitch/version.h)
-AC_CONFIG_FILES(Vagrantfile)
 
 dnl This makes sure that include/openflow gets created in the build directory.
 AC_CONFIG_COMMANDS([include/openflow/openflow.h.stamp])