Vagrantfile 25 KB

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