mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-27 16:34:34 +00:00
Add a method to detect out of date binary extension modules
This commit is contained in:
parent
e398d5f632
commit
92c333c071
5 changed files with 23 additions and 2 deletions
|
@ -16,7 +16,7 @@
|
|||
from attic.helpers import Error, location_validator, format_time, \
|
||||
format_file_mode, ExcludePattern, exclude_path, adjust_patterns, to_localtime, \
|
||||
get_cache_dir, get_keys_dir, format_timedelta, prune_within, prune_split, \
|
||||
Manifest, remove_surrogates, update_excludes, format_archive
|
||||
Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules
|
||||
from attic.remote import RepositoryServer, RemoteRepository
|
||||
|
||||
|
||||
|
@ -399,6 +399,7 @@ def preprocess_args(self, args):
|
|||
return args
|
||||
|
||||
def run(self, args=None):
|
||||
check_extension_modules()
|
||||
keys_dir = get_keys_dir()
|
||||
if not os.path.exists(keys_dir):
|
||||
os.makedirs(keys_dir)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
API_VERSION = 1
|
||||
|
||||
from libc.stdlib cimport free
|
||||
|
||||
cdef extern from "_chunker.c":
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
This could be replaced by PyCrypto or something similar when the performance
|
||||
of their PBKDF2 implementation is comparable to the OpenSSL version.
|
||||
"""
|
||||
|
||||
from libc.string cimport memcpy
|
||||
from libc.stdlib cimport malloc, free
|
||||
|
||||
API_VERSION = 1
|
||||
|
||||
cdef extern from "openssl/rand.h":
|
||||
int RAND_bytes(unsigned char *buf,int num)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
|
||||
API_VERSION = 1
|
||||
|
||||
|
||||
cdef extern from "_hashindex.c":
|
||||
ctypedef struct HashIndex:
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
from operator import attrgetter
|
||||
import fcntl
|
||||
|
||||
import attic.hashindex
|
||||
import attic.chunker
|
||||
import attic.crypto
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
"""Error base class"""
|
||||
|
@ -23,6 +27,10 @@ def get_message(self):
|
|||
return 'Error: ' + type(self).__doc__.format(*self.args)
|
||||
|
||||
|
||||
class ExtensionModuleError(Error):
|
||||
"""The Attic binary extension modules does not seem to be properly installed"""
|
||||
|
||||
|
||||
class UpgradableLock:
|
||||
|
||||
class LockUpgradeFailed(Error):
|
||||
|
@ -52,6 +60,13 @@ def release(self):
|
|||
self.fd.close()
|
||||
|
||||
|
||||
def check_extension_modules():
|
||||
if (attic.hashindex.API_VERSION != 1 or
|
||||
attic.chunker.API_VERSION != 1 or
|
||||
attic.crypto.API_VERSION != 1):
|
||||
raise ExtensionModuleError
|
||||
|
||||
|
||||
class Manifest:
|
||||
|
||||
MANIFEST_ID = b'\0' * 32
|
||||
|
|
Loading…
Reference in a new issue