Vagrantfile 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. # Automated creation of testing environments / binaries on misc. platforms
  4. $cpus = Integer(ENV.fetch('VMCPUS', '4')) # create VMs with that many cpus
  5. $xdistn = Integer(ENV.fetch('XDISTN', '4')) # dispatch tests to that many pytest workers
  6. $wmem = $xdistn * 256 # give the VM additional memory for workers [MB]
  7. def packages_prepare_wheezy
  8. return <<-EOF
  9. # debian 7 wheezy does not have lz4, but it is available from wheezy-backports:
  10. echo "deb http://http.debian.net/debian wheezy-backports main" > /etc/apt/sources.list.d/wheezy-backports.list
  11. EOF
  12. end
  13. def packages_debianoid
  14. return <<-EOF
  15. if id "vagrant" >/dev/null 2>&1; then
  16. username='vagrant'
  17. home_dir=/home/vagrant
  18. else
  19. username='ubuntu'
  20. home_dir=/home/ubuntu
  21. fi
  22. apt-get update
  23. # install all the (security and other) updates
  24. apt-get dist-upgrade -y
  25. # for building borgbackup and dependencies:
  26. apt-get install -y libssl-dev libacl1-dev liblz4-dev libfuse-dev fuse pkg-config
  27. usermod -a -G fuse $username
  28. chgrp fuse /dev/fuse
  29. chmod 666 /dev/fuse
  30. apt-get install -y fakeroot build-essential git
  31. apt-get install -y python3-dev python3-setuptools
  32. # for building python:
  33. apt-get install -y zlib1g-dev libbz2-dev libncurses5-dev libreadline-dev liblzma-dev libsqlite3-dev
  34. # this way it works on older dists (like ubuntu 12.04) also:
  35. # for python 3.2 on ubuntu 12.04 we need pip<8 and virtualenv<14 as
  36. # newer versions are not compatible with py 3.2 any more.
  37. easy_install3 'pip<8.0'
  38. pip3 install 'virtualenv<14.0'
  39. touch $home_dir/.bash_profile ; chown $username $home_dir/.bash_profile
  40. EOF
  41. end
  42. def packages_redhatted
  43. return <<-EOF
  44. yum install -y epel-release
  45. yum update -y
  46. # for building borgbackup and dependencies:
  47. yum install -y openssl-devel openssl libacl-devel libacl lz4-devel fuse-devel fuse pkgconfig
  48. usermod -a -G fuse vagrant
  49. chgrp fuse /dev/fuse
  50. chmod 666 /dev/fuse
  51. yum install -y fakeroot gcc git patch
  52. # needed to compile msgpack-python (otherwise it will use slow fallback code):
  53. yum install -y gcc-c++
  54. # for building python:
  55. yum install -y zlib-devel bzip2-devel ncurses-devel readline-devel xz xz-devel sqlite-devel
  56. #yum install -y python-pip
  57. #pip install virtualenv
  58. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  59. EOF
  60. end
  61. def packages_darwin
  62. return <<-EOF
  63. # install all the (security and other) updates
  64. sudo softwareupdate --ignore iTunesX
  65. sudo softwareupdate --ignore iTunes
  66. sudo softwareupdate --install --all
  67. # get osxfuse 3.x release code from github:
  68. curl -s -L https://github.com/osxfuse/osxfuse/releases/download/osxfuse-3.5.8/osxfuse-3.5.8.dmg >osxfuse.dmg
  69. MOUNTDIR=$(echo `hdiutil mount osxfuse.dmg | tail -1 | awk '{$1="" ; print $0}'` | xargs -0 echo) \
  70. && sudo installer -pkg "${MOUNTDIR}/Extras/FUSE for macOS 3.5.8.pkg" -target /
  71. sudo chown -R vagrant /usr/local # brew must be able to create stuff here
  72. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  73. brew update
  74. brew install openssl
  75. brew install lz4
  76. brew install xz # required for python lzma module
  77. brew install fakeroot
  78. brew install git
  79. brew install pkg-config
  80. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  81. EOF
  82. end
  83. def packages_freebsd
  84. return <<-EOF
  85. # VM has no hostname set
  86. hostname freebsd
  87. # install all the (security and other) updates, base system
  88. freebsd-update --not-running-from-cron fetch install
  89. # for building borgbackup and dependencies:
  90. pkg install -y openssl liblz4 fusefs-libs pkgconf
  91. pkg install -y git bash
  92. # for building python:
  93. pkg install -y sqlite3
  94. # make bash default / work:
  95. chsh -s bash vagrant
  96. mount -t fdescfs fdesc /dev/fd
  97. echo 'fdesc /dev/fd fdescfs rw 0 0' >> /etc/fstab
  98. # make FUSE work
  99. echo 'fuse_load="YES"' >> /boot/loader.conf
  100. echo 'vfs.usermount=1' >> /etc/sysctl.conf
  101. kldload fuse
  102. sysctl vfs.usermount=1
  103. pw groupmod operator -M vagrant
  104. # /dev/fuse has group operator
  105. chmod 666 /dev/fuse
  106. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  107. # install all the (security and other) updates, packages
  108. pkg update
  109. yes | pkg upgrade
  110. EOF
  111. end
  112. def packages_openbsd
  113. return <<-EOF
  114. echo 'installpath = http://ftp.hostserver.de/pub/OpenBSD/6.0/packages/amd64/' > /etc/pkg.conf
  115. echo 'export PKG_PATH=http://ftp.hostserver.de/pub/OpenBSD/6.0/packages/amd64/' >> ~/.profile
  116. . ~/.profile
  117. pkg_add bash
  118. chsh -s /usr/local/bin/bash vagrant
  119. pkg_add openssl
  120. pkg_add lz4
  121. pkg_add git # no fakeroot
  122. pkg_add py3-setuptools
  123. ln -sf /usr/local/bin/python3.4 /usr/local/bin/python3
  124. ln -sf /usr/local/bin/python3.4 /usr/local/bin/python
  125. easy_install-3.4 pip
  126. pip3 install virtualenv
  127. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  128. EOF
  129. end
  130. def packages_netbsd
  131. return <<-EOF
  132. hostname netbsd # the box we use has an invalid hostname
  133. PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/6.1.5/All/"
  134. export PKG_PATH
  135. pkg_add mozilla-rootcerts lz4 git bash
  136. chsh -s bash vagrant
  137. mkdir -p /usr/local/opt/lz4/include
  138. mkdir -p /usr/local/opt/lz4/lib
  139. ln -s /usr/pkg/include/lz4*.h /usr/local/opt/lz4/include/
  140. ln -s /usr/pkg/lib/liblz4* /usr/local/opt/lz4/lib/
  141. touch /etc/openssl/openssl.cnf # avoids a flood of "can't open ..."
  142. mozilla-rootcerts install
  143. pkg_add pkg-config # avoids some "pkg-config missing" error msg, even without fuse
  144. # pkg_add fuse # llfuse supports netbsd, but is still buggy.
  145. # https://bitbucket.org/nikratio/python-llfuse/issues/70/perfuse_open-setsockopt-no-buffer-space
  146. pkg_add python34 py34-setuptools
  147. ln -s /usr/pkg/bin/python3.4 /usr/pkg/bin/python
  148. ln -s /usr/pkg/bin/python3.4 /usr/pkg/bin/python3
  149. easy_install-3.4 pip
  150. pip install virtualenv
  151. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  152. EOF
  153. end
  154. def packages_openindiana
  155. return <<-EOF
  156. #pkg update # XXX needs separate provisioning step + reboot
  157. pkg install python-34 clang-3.4 lz4 git
  158. python3 -m ensurepip
  159. pip3 install -U setuptools pip wheel virtualenv
  160. touch ~vagrant/.bash_profile ; chown vagrant ~vagrant/.bash_profile
  161. EOF
  162. end
  163. # Install required cygwin packages and configure environment
  164. #
  165. # Microsoft/EdgeOnWindows10 image has MLS-OpenSSH installed by default,
  166. # which is based on cygwin x86_64 but should not be used together with cygwin.
  167. # In order to have have cygwin compatible bash 'ImagePath' is replaced with
  168. # cygrunsrv of newly installed cygwin
  169. #
  170. # supported cygwin versions:
  171. # x86_64
  172. # x86
  173. def packages_cygwin(version)
  174. setup_exe = "setup-#{version}.exe"
  175. return <<-EOF
  176. mkdir -p /cygdrive/c/cygwin
  177. powershell -Command '$client = new-object System.Net.WebClient; $client.DownloadFile("https://www.cygwin.com/#{setup_exe}","C:\\cygwin\\#{setup_exe}")'
  178. echo '
  179. REM --- Change to use different CygWin platform and final install path
  180. set CYGSETUP=#{setup_exe}
  181. REM --- Install build version of CygWin in a subfolder
  182. set OURPATH=%cd%
  183. set CYGBUILD="C:\\cygwin\\CygWin"
  184. set CYGMIRROR=ftp://mirrors.kernel.org/sourceware/cygwin/
  185. set BASEPKGS=openssh,rsync
  186. set BUILDPKGS=python3,python3-setuptools,python-devel,binutils,gcc-g++,libopenssl,openssl-devel,git,make,liblz4-devel,liblz4_1,curl
  187. %CYGSETUP% -q -B -o -n -R %CYGBUILD% -L -D -s %CYGMIRROR% -P %BASEPKGS%,%BUILDPKGS%
  188. cd /d C:\\cygwin\\CygWin\\bin
  189. regtool set /HKLM/SYSTEM/CurrentControlSet/Services/OpenSSHd/ImagePath "C:\\cygwin\\CygWin\\bin\\cygrunsrv.exe"
  190. bash -c "ssh-host-config --no"
  191. ' > /cygdrive/c/cygwin/install.bat
  192. cd /cygdrive/c/cygwin && cmd.exe /c install.bat
  193. echo "alias mkdir='mkdir -p'" > ~/.profile
  194. echo "export CYGWIN_ROOT=/cygdrive/c/cygwin/CygWin" >> ~/.profile
  195. echo 'export PATH=$PATH:$CYGWIN_ROOT/bin' >> ~/.profile
  196. echo '' > ~/.bash_profile
  197. cmd.exe /c 'setx /m PATH "%PATH%;C:\\cygwin\\CygWin\\bin"'
  198. source ~/.profile
  199. echo 'db_home: windows' > $CYGWIN_ROOT/etc/nsswitch.conf
  200. EOF
  201. end
  202. def install_cygwin_venv
  203. return <<-EOF
  204. easy_install-3.4 pip
  205. pip install virtualenv
  206. EOF
  207. end
  208. def install_pyenv(boxname)
  209. script = <<-EOF
  210. curl -s -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
  211. echo 'export PATH="$HOME/.pyenv/bin:/vagrant/borg:$PATH"' >> ~/.bash_profile
  212. echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
  213. echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
  214. echo 'export PYTHON_CONFIGURE_OPTS="--enable-shared"' >> ~/.bash_profile
  215. echo 'export LANG=en_US.UTF-8' >> ~/.bash_profile
  216. EOF
  217. script += "echo 'export XDISTN=%d' >> ~/.bash_profile\n" % [$xdistn]
  218. return script
  219. end
  220. def fix_pyenv_darwin(boxname)
  221. return <<-EOF
  222. echo 'export PYTHON_CONFIGURE_OPTS="--enable-framework"' >> ~/.bash_profile
  223. EOF
  224. end
  225. def install_pythons(boxname)
  226. return <<-EOF
  227. . ~/.bash_profile
  228. pyenv install 3.4.0 # tests
  229. pyenv install 3.5.0 # tests
  230. pyenv install 3.6.0 # tests
  231. pyenv install 3.5.3 # binary build, use latest 3.5.x release
  232. pyenv rehash
  233. EOF
  234. end
  235. def build_sys_venv(boxname)
  236. return <<-EOF
  237. . ~/.bash_profile
  238. cd /vagrant/borg
  239. virtualenv --python=python3 borg-env
  240. EOF
  241. end
  242. def build_pyenv_venv(boxname)
  243. return <<-EOF
  244. . ~/.bash_profile
  245. cd /vagrant/borg
  246. # use the latest 3.5 release
  247. pyenv global 3.5.3
  248. pyenv virtualenv 3.5.3 borg-env
  249. ln -s ~/.pyenv/versions/borg-env .
  250. EOF
  251. end
  252. def install_borg(fuse)
  253. script = <<-EOF
  254. . ~/.bash_profile
  255. cd /vagrant/borg
  256. . borg-env/bin/activate
  257. pip install -U wheel # upgrade wheel, too old for 3.5
  258. cd borg
  259. # clean up (wrong/outdated) stuff we likely got via rsync:
  260. rm -rf __pycache__
  261. find src -name '__pycache__' -exec rm -rf {} \\;
  262. pip install -r requirements.d/development.txt
  263. python setup.py clean
  264. EOF
  265. if fuse
  266. script += <<-EOF
  267. # by using [fuse], setup.py can handle different fuse requirements:
  268. pip install -e .[fuse]
  269. EOF
  270. else
  271. script += <<-EOF
  272. pip install -e .
  273. # do not install llfuse into the virtualenvs built by tox:
  274. sed -i.bak '/fuse.txt/d' tox.ini
  275. EOF
  276. end
  277. return script
  278. end
  279. def install_pyinstaller()
  280. return <<-EOF
  281. . ~/.bash_profile
  282. cd /vagrant/borg
  283. . borg-env/bin/activate
  284. git clone https://github.com/thomaswaldmann/pyinstaller.git
  285. cd pyinstaller
  286. git checkout v3.2.1
  287. python setup.py install
  288. EOF
  289. end
  290. def build_binary_with_pyinstaller(boxname)
  291. return <<-EOF
  292. . ~/.bash_profile
  293. cd /vagrant/borg
  294. . borg-env/bin/activate
  295. cd borg
  296. pyinstaller --clean --distpath=/vagrant/borg scripts/borg.exe.spec
  297. EOF
  298. end
  299. def run_tests(boxname)
  300. return <<-EOF
  301. . ~/.bash_profile
  302. cd /vagrant/borg/borg
  303. . ../borg-env/bin/activate
  304. if which pyenv 2> /dev/null; then
  305. # for testing, use the earliest point releases of the supported python versions:
  306. pyenv global 3.4.0 3.5.0 3.6.0
  307. pyenv local 3.4.0 3.5.0 3.6.0
  308. fi
  309. # otherwise: just use the system python
  310. if which fakeroot 2> /dev/null; then
  311. echo "Running tox WITH fakeroot -u"
  312. fakeroot -u tox --skip-missing-interpreters
  313. else
  314. echo "Running tox WITHOUT fakeroot -u"
  315. tox --skip-missing-interpreters
  316. fi
  317. EOF
  318. end
  319. def fix_perms
  320. return <<-EOF
  321. # . ~/.profile
  322. if id "vagrant" >/dev/null 2>&1; then
  323. chown -R vagrant /vagrant/borg
  324. else
  325. chown -R ubuntu /vagrant/borg
  326. fi
  327. EOF
  328. end
  329. Vagrant.configure(2) do |config|
  330. # use rsync to copy content to the folder
  331. config.vm.synced_folder ".", "/vagrant/borg/borg", :type => "rsync", :rsync__args => ["--verbose", "--archive", "--delete", "-z"], :rsync__chown => false
  332. # do not let the VM access . on the host machine via the default shared folder!
  333. config.vm.synced_folder ".", "/vagrant", disabled: true
  334. # fix permissions on synced folder
  335. config.vm.provision "fix perms", :type => :shell, :inline => fix_perms
  336. config.vm.provider :virtualbox do |v|
  337. #v.gui = true
  338. v.cpus = $cpus
  339. end
  340. # Linux
  341. config.vm.define "centos7_64" do |b|
  342. b.vm.box = "centos/7"
  343. b.vm.provider :virtualbox do |v|
  344. v.memory = 1024 + $wmem
  345. end
  346. b.vm.provision "install system packages", :type => :shell, :inline => packages_redhatted
  347. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("centos7_64")
  348. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("centos7_64")
  349. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("centos7_64")
  350. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  351. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("centos7_64")
  352. end
  353. config.vm.define "centos6_32" do |b|
  354. b.vm.box = "centos6-32"
  355. b.vm.provider :virtualbox do |v|
  356. v.memory = 768 + $wmem
  357. end
  358. b.vm.provision "install system packages", :type => :shell, :inline => packages_redhatted
  359. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("centos6_32")
  360. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("centos6_32")
  361. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("centos6_32")
  362. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  363. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("centos6_32")
  364. end
  365. config.vm.define "centos6_64" do |b|
  366. b.vm.box = "centos6-64"
  367. b.vm.provider :virtualbox do |v|
  368. v.memory = 1024 + $wmem
  369. end
  370. b.vm.provision "install system packages", :type => :shell, :inline => packages_redhatted
  371. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("centos6_64")
  372. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("centos6_64")
  373. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("centos6_64")
  374. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  375. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("centos6_64")
  376. end
  377. config.vm.define "xenial64" do |b|
  378. b.vm.box = "ubuntu/xenial64"
  379. b.vm.provider :virtualbox do |v|
  380. v.memory = 1024 + $wmem
  381. end
  382. b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
  383. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("xenial64")
  384. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  385. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("xenial64")
  386. end
  387. config.vm.define "trusty64" do |b|
  388. b.vm.box = "ubuntu/trusty64"
  389. b.vm.provider :virtualbox do |v|
  390. v.memory = 1024 + $wmem
  391. end
  392. b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
  393. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("trusty64")
  394. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  395. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("trusty64")
  396. end
  397. config.vm.define "jessie64" do |b|
  398. b.vm.box = "debian/jessie64"
  399. b.vm.provider :virtualbox do |v|
  400. v.memory = 1024 + $wmem
  401. end
  402. b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
  403. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("jessie64")
  404. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  405. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("jessie64")
  406. end
  407. config.vm.define "wheezy32" do |b|
  408. b.vm.box = "boxcutter/debian7-i386"
  409. b.vm.provider :virtualbox do |v|
  410. v.memory = 768 + $wmem
  411. end
  412. b.vm.provision "packages prepare wheezy", :type => :shell, :inline => packages_prepare_wheezy
  413. b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
  414. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("wheezy32")
  415. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy32")
  416. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy32")
  417. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  418. b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller()
  419. b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy32")
  420. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy32")
  421. end
  422. config.vm.define "wheezy64" do |b|
  423. b.vm.box = "boxcutter/debian7"
  424. b.vm.provider :virtualbox do |v|
  425. v.memory = 1024 + $wmem
  426. end
  427. b.vm.provision "packages prepare wheezy", :type => :shell, :inline => packages_prepare_wheezy
  428. b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
  429. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("wheezy64")
  430. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy64")
  431. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy64")
  432. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  433. b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller()
  434. b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy64")
  435. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy64")
  436. end
  437. # OS X
  438. config.vm.define "darwin64" do |b|
  439. b.vm.box = "jhcook/yosemite-clitools"
  440. b.vm.provider :virtualbox do |v|
  441. v.memory = 1536 + $wmem
  442. v.customize ['modifyvm', :id, '--ostype', 'MacOS1010_64']
  443. v.customize ['modifyvm', :id, '--paravirtprovider', 'default']
  444. # Adjust CPU settings according to
  445. # https://github.com/geerlingguy/macos-virtualbox-vm
  446. v.customize ['modifyvm', :id, '--cpuidset',
  447. '00000001', '000306a9', '00020800', '80000201', '178bfbff']
  448. # Disable USB variant requiring Virtualbox proprietary extension pack
  449. v.customize ["modifyvm", :id, '--usbehci', 'off', '--usbxhci', 'off']
  450. end
  451. b.vm.provision "packages darwin", :type => :shell, :privileged => false, :inline => packages_darwin
  452. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("darwin64")
  453. b.vm.provision "fix pyenv", :type => :shell, :privileged => false, :inline => fix_pyenv_darwin("darwin64")
  454. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("darwin64")
  455. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("darwin64")
  456. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  457. b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller()
  458. b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("darwin64")
  459. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("darwin64")
  460. end
  461. # BSD
  462. # note: the FreeBSD-10.3-RELEASE box needs "vagrant up" twice to start.
  463. config.vm.define "freebsd64" do |b|
  464. b.vm.box = "freebsd/FreeBSD-10.3-RELEASE"
  465. b.vm.provider :virtualbox do |v|
  466. v.memory = 1024 + $wmem
  467. end
  468. b.ssh.shell = "sh"
  469. b.vm.provision "install system packages", :type => :shell, :inline => packages_freebsd
  470. b.vm.provision "install pyenv", :type => :shell, :privileged => false, :inline => install_pyenv("freebsd")
  471. b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("freebsd")
  472. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("freebsd")
  473. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(true)
  474. b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller()
  475. b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("freebsd")
  476. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("freebsd")
  477. end
  478. config.vm.define "openbsd64" do |b|
  479. b.vm.box = "openbsd60-64" # note: basic openbsd install for vagrant WITH sudo and rsync pre-installed
  480. b.vm.provider :virtualbox do |v|
  481. v.memory = 1024 + $wmem
  482. end
  483. b.ssh.shell = "sh"
  484. b.vm.provision "packages openbsd", :type => :shell, :inline => packages_openbsd
  485. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("openbsd64")
  486. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  487. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("openbsd64")
  488. end
  489. config.vm.define "netbsd64" do |b|
  490. b.vm.box = "netbsd70-64"
  491. b.vm.provider :virtualbox do |v|
  492. v.memory = 1024 + $wmem
  493. end
  494. b.vm.provision "packages netbsd", :type => :shell, :inline => packages_netbsd
  495. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("netbsd64")
  496. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  497. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("netbsd64")
  498. end
  499. # rsync on openindiana has troubles, does not set correct owner for /vagrant/borg and thus gives lots of
  500. # permission errors. can be manually fixed in the VM by: sudo chown -R vagrant /vagrant/borg ; then rsync again.
  501. config.vm.define "openindiana64" do |b|
  502. b.vm.box = "openindiana/hipster"
  503. b.vm.provider :virtualbox do |v|
  504. v.memory = 1536 + $wmem
  505. end
  506. b.vm.provision "packages openindiana", :type => :shell, :inline => packages_openindiana
  507. b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_sys_venv("openindiana64")
  508. b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  509. b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("openindiana64")
  510. end
  511. config.vm.define "windows10" do |b|
  512. b.vm.box = "Microsoft/EdgeOnWindows10"
  513. b.vm.guest = :windows
  514. b.vm.boot_timeout = 180
  515. b.vm.graceful_halt_timeout = 120
  516. b.ssh.shell = "sh -l"
  517. b.ssh.username = "IEUser"
  518. b.ssh.password = "Passw0rd!"
  519. b.ssh.insert_key = false
  520. b.vm.provider :virtualbox do |v|
  521. v.memory = 1536 + $wmem
  522. #v.gui = true
  523. end
  524. # fix permissions placeholder
  525. b.vm.provision "fix perms", :type => :shell, :privileged => false, :inline => "echo 'fix permission placeholder'"
  526. b.vm.provision "packages cygwin", :type => :shell, :privileged => false, :inline => packages_cygwin("x86_64")
  527. b.vm.provision :reload
  528. b.vm.provision "cygwin install pip", :type => :shell, :privileged => false, :inline => install_cygwin_venv
  529. b.vm.provision "cygwin build env", :type => :shell, :privileged => false, :inline => build_sys_venv("windows10")
  530. b.vm.provision "cygwin install borg", :type => :shell, :privileged => false, :inline => install_borg(false)
  531. b.vm.provision "cygwin run tests", :type => :shell, :privileged => false, :inline => run_tests("windows10")
  532. end
  533. end