Vagrantfile 27 KB

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