Skip to content

Commit

Permalink
app-backup/borgbackup: use system msgpack
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Anthony G. Basile <[email protected]>
  • Loading branch information
blueness committed Mar 11, 2020
1 parent 54262d9 commit af46668
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ DEPEND="
"

python_prepare_all() {
# allow use of new (renamed) msgpack
sed -i "s|'msgpack-python.*',||g" setup.py || die
rm -rf src/borg/algorithms/msgpack
eapply "${FILESDIR}"/${P}-unbundle-msgpack.patch
distutils-r1_python_prepare_all
}

Expand Down
110 changes: 110 additions & 0 deletions app-backup/borgbackup/files/borgbackup-1.1.11-unbundle-msgpack.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
diff -Naur borgbackup-1.1.11.orig/setup.cfg borgbackup-1.1.11/setup.cfg
--- borgbackup-1.1.11.orig/setup.cfg 2020-03-07 18:44:15.000000000 -0500
+++ borgbackup-1.1.11/setup.cfg 2020-03-11 10:28:25.168481822 -0400
@@ -6,7 +6,7 @@
F401,F405,F811,
W504
max-line-length = 255
-exclude = build,dist,.git,.idea,.cache,.tox,docs/conf.py,src/borg/algorithms/msgpack
+exclude = build,dist,.git,.idea,.cache,.tox,docs/conf.py

[egg_info]
tag_build =
diff -Naur borgbackup-1.1.11.orig/setup.py borgbackup-1.1.11/setup.py
--- borgbackup-1.1.11.orig/setup.py 2020-03-07 18:32:06.000000000 -0500
+++ borgbackup-1.1.11/setup.py 2020-03-11 10:28:15.568759338 -0400
@@ -25,8 +25,6 @@
# True: use the shared libb2 from the system, False: use the bundled blake2 code
prefer_system_libb2 = True

-# prefer_system_msgpack is another option, but you need to set it in src/borg/helpers.py.
-
min_python = (3, 4)
my_python = sys.version_info

@@ -79,8 +77,6 @@
platform_syncfilerange_source = 'src/borg/platform/syncfilerange.pyx'
platform_darwin_source = 'src/borg/platform/darwin.pyx'
platform_freebsd_source = 'src/borg/platform/freebsd.pyx'
-msgpack_packer_source = 'src/borg/algorithms/msgpack/_packer.pyx'
-msgpack_unpacker_source = 'src/borg/algorithms/msgpack/_unpacker.pyx'

cython_c_sources = [
# these .pyx will get compiled to .c
@@ -98,12 +94,6 @@
platform_darwin_source,
]

-cython_cpp_sources = [
- # these .pyx will get compiled to .cpp
- msgpack_packer_source,
- msgpack_unpacker_source,
-]
-
try:
from Cython.Distutils import build_ext
import Cython.Compiler.Main as cython_compiler
@@ -133,8 +123,6 @@
'src/borg/platform/syncfilerange.c',
'src/borg/platform/freebsd.c',
'src/borg/platform/darwin.c',
- 'src/borg/algorithms/msgpack/_packer.cpp',
- 'src/borg/algorithms/msgpack/_unpacker.cpp',
])
super().make_distribution()

@@ -155,14 +143,12 @@
platform_freebsd_source = platform_freebsd_source.replace('.pyx', '.c')
platform_darwin_source = platform_darwin_source.replace('.pyx', '.c')

- msgpack_packer_source = msgpack_packer_source.replace('.pyx', '.cpp')
- msgpack_unpacker_source = msgpack_unpacker_source.replace('.pyx', '.cpp')

from distutils.command.build_ext import build_ext
if not on_rtd and not all(os.path.exists(path) for path in [
compress_source, crypto_ll_source, chunker_source, hashindex_source, item_source, checksums_source,
platform_posix_source, platform_linux_source, platform_syncfilerange_source, platform_freebsd_source, platform_darwin_source,
- msgpack_packer_source, msgpack_unpacker_source]):
+ ]):
raise ImportError('The GIT version of Borg needs Cython. Install Cython or use a released version.')


@@ -805,26 +791,7 @@
system_prefix=libb2_prefix, system=libb2_system,
**crypto_ext_kwargs)

- msgpack_endian = '__BIG_ENDIAN__' if (sys.byteorder == 'big') else '__LITTLE_ENDIAN__'
- msgpack_macros = [(msgpack_endian, '1')]
- msgpack_packer_ext_kwargs = dict(
- sources=[msgpack_packer_source],
- include_dirs=include_dirs,
- library_dirs=library_dirs,
- define_macros=msgpack_macros,
- language='c++',
- )
- msgpack_unpacker_ext_kwargs = dict(
- sources=[msgpack_unpacker_source],
- include_dirs=include_dirs,
- library_dirs=library_dirs,
- define_macros=msgpack_macros,
- language='c++',
- )
-
ext_modules += [
- Extension('borg.algorithms.msgpack._packer', **msgpack_packer_ext_kwargs),
- Extension('borg.algorithms.msgpack._unpacker', **msgpack_unpacker_ext_kwargs),
Extension('borg.compress', **compress_ext_kwargs),
Extension('borg.crypto.low_level', **crypto_ext_kwargs),
Extension('borg.hashindex', [hashindex_source]),
diff -Naur borgbackup-1.1.11.orig/src/borg/helpers.py borgbackup-1.1.11/src/borg/helpers.py
--- borgbackup-1.1.11.orig/src/borg/helpers.py 2020-03-07 18:32:06.000000000 -0500
+++ borgbackup-1.1.11/src/borg/helpers.py 2020-03-11 10:28:42.519980213 -0400
@@ -55,7 +55,7 @@
# any feedback related to issues caused by this will be ignored.
# - especially, it is known that msgpack 0.6.x does NOT work for borg 1.1.x.

-prefer_system_msgpack = False
+prefer_system_msgpack = True

try:
if prefer_system_msgpack:

0 comments on commit af46668

Please sign in to comment.