use vagrant to create test installations

debian/ubuntu 32/64 bit
freebsd
darwin

note: darwin is starting up, but no ssh/rsync yet
This commit is contained in:
Thomas Waldmann 2015-09-13 01:22:44 +02:00
commit b47f49629d
9 changed files with 2420 additions and 23 deletions

View File

@ -5,6 +5,7 @@ omit =
borg/__init__.py
borg/__main__.py
borg/_version.py
borg/support/*.py
[report]
exclude_lines =

17
Vagrantfile vendored
View File

@ -1,12 +1,6 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# TODO
# add pkg-config to sphinx docs, needed for fuse
# reduce lzma compression level to << 9 in unit tests, needs more memory than vagrant box has
# /usr/local/include/lz4.h for freebsd - use same code as for finding the openssl headers
# llfuse <0.41 >0.41.1 broken install due to UnicodeError
def packages_prepare_wheezy
return <<-EOF
# debian 7 wheezy does not have lz4, but it is available from wheezy-backports:
@ -28,7 +22,6 @@ def packages_debianoid
apt-get install -y libssl-dev libacl1-dev liblz4-dev
apt-get install -y libfuse-dev fuse pkg-config
apt-get install -y fakeroot build-essential git
apt-get install -y curl
# this way it works on older dists (like ubuntu 12.04) also:
easy_install3 pip
pip3 install virtualenv
@ -42,7 +35,6 @@ def packages_freebsd
pkg install -y openssl liblz4
pkg install -y fusefs-libs pkgconf
pkg install -y fakeroot git
pkg install -y curl
easy_install-3.4 pip
pip3 install virtualenv
# make FUSE work
@ -100,11 +92,17 @@ end
Vagrant.configure(2) do |config|
# use rsync to copy content to the folder
config.vm.synced_folder ".", "/vagrant/borg/borg", :type => "rsync"
# do not let the VM access . on the host machine via the default shared folder!
config.vm.synced_folder ".", "/vagrant", disabled: true
# fix permissions on synced folder
config.vm.provision "fix perms", :type => :shell, :inline => fix_perms
config.vm.provider :virtualbox do |v|
v.gui = false
v.cpus = 2
end
config.vm.define "trusty64" do |b|
b.vm.box = "ubuntu/trusty64"
b.vm.provision "packages debianoid", :type => :shell, :inline => packages_debianoid
@ -134,12 +132,11 @@ Vagrant.configure(2) do |config|
# BSD
config.vm.define "freebsd" do |b|
b.vm.box = "geoffgarside/freebsd-10.2"
#b.vm.base_mac = "11:22:33:44:56:67"
b.vm.provision "packages freebsd", :type => :shell, :inline => packages_freebsd
b.vm.provision "prepare user", :type => :shell, :privileged => false, :inline => prepare_user("freebsd")
end
# OS X
# OS X - TODO: make rsync/ssh work
config.vm.define "darwin" do |b|
b.vm.box = "jhcook/yosemite-clitools"
b.vm.provision "packages darwin", :type => :shell, :privileged => false, :inline => packages_darwin

View File

@ -1,4 +1,6 @@
import argparse
from .support import argparse # see support/__init__.py docstring
# DEPRECATED - remove after requiring py 3.4
from binascii import hexlify
from datetime import datetime
from operator import attrgetter

View File

@ -37,7 +37,8 @@ cdef class IndexBase:
def __cinit__(self, capacity=0, path=None, key_size=32):
self.key_size = key_size
if path:
self.index = hashindex_read(os.fsencode(path))
path = os.fsencode(path)
self.index = hashindex_read(path)
if not self.index:
raise Exception('hashindex_read failed')
else:
@ -54,7 +55,8 @@ cdef class IndexBase:
return cls(path=path)
def write(self, path):
if not hashindex_write(self.index, os.fsencode(path)):
path = os.fsencode(path)
if not hashindex_write(self.index, path):
raise Exception('hashindex_write failed')
def clear(self):

View File

@ -1,4 +1,6 @@
import argparse
from .support import argparse # see support/__init__.py docstring
# DEPRECATED - remove after requiring py 3.4
import binascii
from collections import namedtuple
from functools import wraps

16
borg/support/__init__.py Normal file
View File

@ -0,0 +1,16 @@
"""
3rd party stuff that needed fixing
Note: linux package maintainers feel free to remove any of these hacks
IF your python version is not affected.
argparse is broken with default args (double conversion):
affects: 3.2.0 <= python < 3.2.4
affects: 3.3.0 <= python < 3.3.1
as we still support 3.2 and 3.3 there is no other way than to bundle
a fixed version (I just took argparse.py from 3.2.6) and import it from
here (see import in archiver.py).
DEPRECATED - remove support.argparse after requiring python 3.4.
"""

2383
borg/support/argparse.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -264,7 +264,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
st = os.stat(filename)
self.assert_equal(st.st_size, total_len)
if sparse_support and hasattr(st, 'st_blocks'):
self.assert_true(st.st_blocks * 512 < total_len / 10) # is input sparse?
self.assert_true(st.st_blocks * 512 < total_len / 9) # is input sparse?
self.cmd('init', self.repository_location)
self.cmd('create', self.repository_location + '::test', 'input')
with changedir('output'):
@ -279,7 +279,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
st = os.stat(filename)
self.assert_equal(st.st_size, total_len)
if sparse_support and hasattr(st, 'st_blocks'):
self.assert_true(st.st_blocks * 512 < total_len / 10) # is output sparse?
self.assert_true(st.st_blocks * 512 < total_len / 9) # is output sparse?
def test_unusual_filenames(self):
filenames = ['normal', 'with some blanks', '(with_parens)', ]

View File

@ -14,12 +14,6 @@ if my_python < min_python:
# Also, we might use some rather recent API features.
install_requires=['msgpack-python>=0.4.6', ]
if (my_python < (3, 2, 4) or
(3, 3, 0) <= my_python < (3, 3, 1)):
# argparse in stdlib does not work there due to a bug,
# pull a fixed argparse from pypi
install_requires.append("argparse>=1.4.0")
from setuptools import setup, Extension
from setuptools.command.sdist import sdist
@ -161,7 +155,7 @@ setup(
'Topic :: Security :: Cryptography',
'Topic :: System :: Archiving :: Backup',
],
packages=['borg', 'borg.testsuite'],
packages=['borg', 'borg.testsuite', 'borg.support', ],
entry_points={
'console_scripts': [
'borg = borg.archiver:main',