Skip to content

Commit

Permalink
remove bundled blake2 code, usage of libb2
Browse files Browse the repository at this point in the history
we just use it via python3 now.
  • Loading branch information
ThomasWaldmann committed Jan 28, 2021
1 parent 1dbe86a commit c8e9131
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 780 deletions.
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
# needed: openssl >=1.0.2 or >=1.1.0 (or compatible)
system_prefix_openssl = os.environ.get('BORG_OPENSSL_PREFIX')

# needed: blake2 (>= 0.98.1)
prefer_system_libb2 = not bool(os.environ.get('BORG_USE_BUNDLED_B2'))
system_prefix_libb2 = os.environ.get('BORG_LIBB2_PREFIX')

# needed: lz4 (>= 1.7.0 / r129)
prefer_system_liblz4 = not bool(os.environ.get('BORG_USE_BUNDLED_LZ4'))
system_prefix_liblz4 = os.environ.get('BORG_LIBLZ4_PREFIX')
Expand Down Expand Up @@ -180,7 +176,6 @@ def members_appended(*ds):
crypto_ext_kwargs = members_appended(
dict(sources=[crypto_ll_source, crypto_helpers]),
setup_crypto.crypto_ext_kwargs(pc, system_prefix_openssl),
setup_crypto.b2_ext_kwargs(pc, prefer_system_libb2, system_prefix_libb2),
)

compress_ext_kwargs = members_appended(
Expand Down
33 changes: 0 additions & 33 deletions setup_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,3 @@ def crypto_ext_kwargs(pc, system_prefix):
return pc.parse('libcrypto')

raise Exception('Could not find OpenSSL lib/headers, please set BORG_OPENSSL_PREFIX')


# b2 files, structure as seen in BLAKE2 (reference implementation) project repository:

# path relative (to this file) to the bundled library source code files
b2_bundled_path = 'src/borg/algorithms/blake2'

b2_sources = [
'ref/blake2b-ref.c',
]

b2_includes = [
'ref',
]


def b2_ext_kwargs(pc, prefer_system, system_prefix):
if prefer_system:
if system_prefix:
print('Detected and preferring libb2 [via BORG_LIBB2_PREFIX]')
return dict(include_dirs=[os.path.join(system_prefix, 'include')],
library_dirs=[os.path.join(system_prefix, 'lib')],
libraries=['b2'])

if pc and pc.installed('libb2', '>= 0.98.1'):
print('Detected and preferring libb2 [via pkg-config]')
return pc.parse('libb2')

print('Using bundled BLAKE2')
sources = multi_join(b2_sources, b2_bundled_path)
include_dirs = multi_join(b2_includes, b2_bundled_path)
define_macros = [('BORG_USE_BUNDLED_B2', 'YES')]
return dict(sources=sources, include_dirs=include_dirs, define_macros=define_macros)
8 changes: 5 additions & 3 deletions src/borg/algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
This package is intended for hash and checksum functions.
Ideally these would be sourced from existing libraries,
but are frequently not available yet (blake2), are
available but in poor form (crc32) or don't really
make sense as a library (xxHash).
but:
- are frequently not available yet (lz4, zstd),
- are available but in poor form (crc32), or
- don't really make sense as a library (xxHash).
"""
5 changes: 0 additions & 5 deletions src/borg/algorithms/blake2-libselect.h

This file was deleted.

160 changes: 0 additions & 160 deletions src/borg/algorithms/blake2/ref/blake2-impl.h

This file was deleted.

Loading

0 comments on commit c8e9131

Please sign in to comment.