First version of a vagrant box for testing OF in a clean environment
--HG-- branch : bgschaid/feature/vagrantSandboxBranch
This commit is contained in:
parent
9958fab9ee
commit
91810a7c6d
6 changed files with 250 additions and 0 deletions
34
vagrantSandbox/README
Normal file
34
vagrantSandbox/README
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- mode: org -*-
|
||||||
|
#+TITLE: Virtual machines for testing and Packaging
|
||||||
|
* Prerequisites
|
||||||
|
These virtual machines require
|
||||||
|
- VirtualBox :: for running from [[https://www.virtualbox.org]]
|
||||||
|
- Vagrant :: to automatically set them up from [[http://www.vagrantup.com]]
|
||||||
|
* Starting
|
||||||
|
A virtual machine is set up with
|
||||||
|
: vagrant up <machineName>
|
||||||
|
will download a virtual machine image and set it up. It will then
|
||||||
|
modify the image:
|
||||||
|
- add packages required to compile OpenFOAM and package it
|
||||||
|
- mount the directory of the sources
|
||||||
|
- from this directory clone it to the local disc with mercurial or
|
||||||
|
git (whatever the parent uses)
|
||||||
|
One can then connect to the virtual machine with
|
||||||
|
: vagrant ssh <machinName>
|
||||||
|
and will be in the =$HOME= directory of the user =vagrant= where in
|
||||||
|
the directory =~/OpenFOAM/OpenFOAM-1.6-ext= the sources are
|
||||||
|
available. Modifications can be pushed "outside" the virtual machine
|
||||||
|
with
|
||||||
|
: hg push
|
||||||
|
There is also a symbolic link =~/OpenFOAM/OpenFOAM-1.6-ext-parent=
|
||||||
|
to the sources if you want to edit there directly. Use with care
|
||||||
|
and don't compile in that directory unless you know what you're
|
||||||
|
doing
|
||||||
|
* Virtual machines
|
||||||
|
Currently existing virtual machines are
|
||||||
|
- precise :: Latest LTS Ubuntu.
|
||||||
|
- lucid :: Previous LTS Ubuntu. Currently problems
|
||||||
|
with automatic setting up (something with the
|
||||||
|
=postfix=-package)
|
||||||
|
- maverick :: Tries to fix the problems with the
|
||||||
|
=lucid=-machine. Not yet working
|
42
vagrantSandbox/Vagrantfile
vendored
Normal file
42
vagrantSandbox/Vagrantfile
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
config.vm.synced_folder "..", "/OpenFOAM-sources"
|
||||||
|
|
||||||
|
config.vm.provider :virtualbox do |vb|
|
||||||
|
# # Don't boot with headless mode
|
||||||
|
# vb.gui = true
|
||||||
|
#
|
||||||
|
# # Use VBoxManage to customize the VM. For example to change memory:
|
||||||
|
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define :lucid do |lucid|
|
||||||
|
lucid.vm.box = "lucid64"
|
||||||
|
lucid.vm.box_url = "http://files.vagrantup.com/lucid64.box"
|
||||||
|
lucid.vm.provision :shell do |s|
|
||||||
|
s.args = "lucid"
|
||||||
|
s.path = "initUbunutuScript.sh"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define :maverick do |maverick|
|
||||||
|
maverick.vm.box = "maverick64"
|
||||||
|
maverick.vm.box_url = "http://mathie-vagrant-boxes.s3.amazonaws.com/maverick64.box"
|
||||||
|
maverick.vm.provision :shell do |s|
|
||||||
|
s.args = "lucid"
|
||||||
|
s.path = "initUbunutuScript.sh"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define :precise do |precise|
|
||||||
|
precise.vm.box = "precise64"
|
||||||
|
precise.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
||||||
|
precise.vm.provision :shell do |s|
|
||||||
|
s.args = "precise"
|
||||||
|
s.path = "initUbunutuScript.sh"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
0
vagrantSandbox/ccache4vm/.stubForGitAndHg
Normal file
0
vagrantSandbox/ccache4vm/.stubForGitAndHg
Normal file
137
vagrantSandbox/initUbunutuScript.sh
Executable file
137
vagrantSandbox/initUbunutuScript.sh
Executable file
|
@ -0,0 +1,137 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
boxName=$1
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Init script for $boxName"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ "$boxName" == "lucid" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Additional Python-Repository"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# needed for add-appt-repository
|
||||||
|
apt-get -y install python-software-properties
|
||||||
|
|
||||||
|
add-apt-repository ppa:mercurial-ppa/releases
|
||||||
|
|
||||||
|
apt-get update -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Installing additional packages"
|
||||||
|
echo
|
||||||
|
|
||||||
|
apt-get -y install mercurial
|
||||||
|
apt-get -y install bison
|
||||||
|
apt-get -y install flex
|
||||||
|
apt-get -y install g++
|
||||||
|
apt-get -y install make
|
||||||
|
#apt-get -y install python-dev
|
||||||
|
apt-get -y install ccache
|
||||||
|
|
||||||
|
# this is needed for the packaging stuff
|
||||||
|
echo
|
||||||
|
echo "Setting for postfix"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Make sure that default-mta installs
|
||||||
|
debconf-set-selections <<< "postfix postfix/mailname string vagrant.test.machine.com"
|
||||||
|
debconf-set-selections <<< "postfix postfix/myhostname string vagrant.test.machine.com"
|
||||||
|
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
|
||||||
|
debconf-set-selections <<< "postfix postfix/destinations string localhost"
|
||||||
|
|
||||||
|
# this workaround doesn't work for lucid
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Tools for packaging"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Needed for packaging
|
||||||
|
apt-get -y install default-mta
|
||||||
|
apt-get -y install dpkg-dev
|
||||||
|
apt-get -y install debhelper devscripts cdbs
|
||||||
|
|
||||||
|
# Not needed. Just to keep Bernhard happy
|
||||||
|
apt-get -y install emacs
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Copying stuff from skeleton"
|
||||||
|
echo
|
||||||
|
for f in $(ls -A /vagrant/skel)
|
||||||
|
do
|
||||||
|
target="/home/vagrant/$f"
|
||||||
|
if [ -e $target ]
|
||||||
|
then
|
||||||
|
echo "$target already there"
|
||||||
|
else
|
||||||
|
echo "Copying $target from skeleton"
|
||||||
|
cp -r "/vagrant/skel/$f" $target
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
OFDIR=/home/vagrant/OpenFOAM/
|
||||||
|
|
||||||
|
mkdir -vp $OFDIR
|
||||||
|
|
||||||
|
OFClone=$OFDIR/OpenFOAM-1.6-ext
|
||||||
|
OFReference=$OFDIR/OpenFOAM-1.6-ext-parent
|
||||||
|
|
||||||
|
OFParent=/OpenFOAM-sources
|
||||||
|
|
||||||
|
if [ ! -e $OFClone ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Cloning the OF-sources"
|
||||||
|
echo
|
||||||
|
if [ -e "$OFParent/.git" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Parent is git"
|
||||||
|
echo
|
||||||
|
su vagrant - -c "git clone $OFParent $OFClone"
|
||||||
|
echo
|
||||||
|
echo "Git cloned: TODO: set same branch as parent"
|
||||||
|
echo
|
||||||
|
elif [ -e "$OFParent/.hg" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Parent is mercurial. Hello Bernhard"
|
||||||
|
echo
|
||||||
|
su vagrant - -c "hg clone $OFParent $OFClone"
|
||||||
|
branchName=`hg branch -R $OFParent`
|
||||||
|
echo
|
||||||
|
echo "Parent is on branch $branchName"
|
||||||
|
su vagrant - -c "hg update -R $OFClone $branchName"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Problem. Parent $OFParent is neither git nor mercurial"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Repository $OFClone already there. No cloning"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e $OFReference ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Linking $OFReference to $OFParent"
|
||||||
|
echo
|
||||||
|
ln -s $OFParent $OFReference
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Link $OFReference already there"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R vagrant:vagrant $OFDIR
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Current ccache:"
|
||||||
|
export CCACHE_DIR=/vagrant/ccache4vm; ccache --show-stats
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Ended"
|
2
vagrantSandbox/skel/.OpenFOAM/prefs.sh
Normal file
2
vagrantSandbox/skel/.OpenFOAM/prefs.sh
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export WM_SCHEDULER=ccache
|
||||||
|
export CCACHE_DIR=/vagrant/ccache4vm
|
35
vagrantSandbox/skel/.hgrc
Normal file
35
vagrantSandbox/skel/.hgrc
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[ui]
|
||||||
|
merge = emacs
|
||||||
|
editor = emacs
|
||||||
|
|
||||||
|
[extensions]
|
||||||
|
color =
|
||||||
|
fetch =
|
||||||
|
graphlog =
|
||||||
|
hgk =
|
||||||
|
keyword =
|
||||||
|
pager =
|
||||||
|
transplant =
|
||||||
|
purge =
|
||||||
|
rebase =
|
||||||
|
bookmarks =
|
||||||
|
extdiff =
|
||||||
|
interhg =
|
||||||
|
highlight =
|
||||||
|
progress =
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
git=1
|
||||||
|
nodates=1
|
||||||
|
|
||||||
|
[pager]
|
||||||
|
pager = LESS='FSRX' less
|
||||||
|
attend = help,annotate, cat, diff, export, glog, log, qdiff, incoming, outgoing,interdiff,slog,rlog
|
||||||
|
|
||||||
|
[merge-tools]
|
||||||
|
emacs.args = -q --eval "(require 'ediff)" --eval "(setq ediff-window-setup-function 'ediff-setup-windows-plain)" --eval "(add-hook 'ediff-quit-hook 'save-buffers-kill-emacs)" --eval "(ediff-merge-with-ancestor \""$local"\" \""$other"\" \""$base"\" nil \""$output"\")"
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
slog = log --template '{rev}:{node|short} {date|age} {author|email}: {desc|firstline}\n'
|
||||||
|
rlog = log -r : --template '{rev}:{node|short} {date|shortdate} {author|user}: Statistics: {diffstat}\n{desc}\n\n'
|
||||||
|
|
Reference in a new issue