borgbackup: Fix ImportError
described in #9207
This commit is contained in:
parent
9849f01987
commit
c65432f6c5
@ -3,40 +3,59 @@ TERMUX_PKG_DESCRIPTION="Deduplicating and compressing backup program"
|
||||
TERMUX_PKG_LICENSE="BSD 3-Clause"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=1.1.17
|
||||
TERMUX_PKG_REVISION=6
|
||||
TERMUX_PKG_REVISION=7
|
||||
TERMUX_PKG_SRCURL=https://github.com/borgbackup/borg/releases/download/${TERMUX_PKG_VERSION}/borgbackup-${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=7ab924fc017b24929bedceba0dcce16d56f9868bf9b5050d2aae2eb080671674
|
||||
TERMUX_PKG_AUTO_UPDATE=true
|
||||
TERMUX_PKG_DEPENDS="libacl, liblz4, openssl, python, zstd"
|
||||
# Cannot be updated to 1.2.0 (or newer) as it requires external python package
|
||||
#TERMUX_PKG_AUTO_UPDATE=true
|
||||
TERMUX_PKG_DEPENDS="libacl, liblz4, openssl, python, xxhash, zstd"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
|
||||
_PYTHON_VERSION=3.10
|
||||
_PYTHON_VERSION=$(. $TERMUX_SCRIPTDIR/packages/python/build.sh; echo $_MAJOR_VERSION)
|
||||
|
||||
TERMUX_PKG_RM_AFTER_INSTALL="
|
||||
lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
|
||||
lib/python${_PYTHON_VERSION}/site-packages/site.py
|
||||
lib/python${_PYTHON_VERSION}/site-packages/__pycache__
|
||||
"
|
||||
termux_step_pre_configure() {
|
||||
termux_setup_python_crossenv
|
||||
pushd $TERMUX_PYTHON_CROSSENV_SRCDIR
|
||||
_CROSSENV_PREFIX=$TERMUX_PKG_BUILDDIR/python-crossenv-prefix
|
||||
python${_PYTHON_VERSION} -m crossenv \
|
||||
$TERMUX_PREFIX/bin/python${_PYTHON_VERSION} \
|
||||
${_CROSSENV_PREFIX}
|
||||
popd
|
||||
. ${_CROSSENV_PREFIX}/bin/activate
|
||||
|
||||
termux_step_make_install() {
|
||||
export PYTHONPATH=$TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages
|
||||
export CPPFLAGS+=" -I${TERMUX_PREFIX}/include/python${_PYTHON_VERSION}"
|
||||
export LDFLAGS+=" -lpython${_PYTHON_VERSION}"
|
||||
export LDSHARED="$CC -shared"
|
||||
export BORG_OPENSSL_PREFIX=$TERMUX_PREFIX
|
||||
export BORG_LIBLZ4_PREFIX=$TERMUX_PREFIX
|
||||
export BORG_LIBZSTD_PREFIX=$TERMUX_PREFIX
|
||||
python${_PYTHON_VERSION} setup.py install --prefix=$TERMUX_PREFIX --force
|
||||
}
|
||||
|
||||
termux_step_make() {
|
||||
python setup.py install --force
|
||||
}
|
||||
|
||||
termux_step_make_install() {
|
||||
pushd ${_CROSSENV_PREFIX}/cross/lib/python${_PYTHON_VERSION}/site-packages
|
||||
_BORGBACKUP_EGGDIR=
|
||||
for f in borgbackup-${TERMUX_PKG_VERSION}-py${_PYTHON_VERSION}-linux-*.egg; do
|
||||
if [ -d "$f" ]; then
|
||||
_BORGBACKUP_EGGDIR="$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
test -n "${_BORGBACKUP_EGGDIR}"
|
||||
cp -rT "${_BORGBACKUP_EGGDIR}" $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/"${_BORGBACKUP_EGGDIR}"
|
||||
popd
|
||||
for f in borg borgfs; do
|
||||
cp -T ${_CROSSENV_PREFIX}/cross/bin/$f $TERMUX_PREFIX/bin/$f
|
||||
done
|
||||
}
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
cat <<- EOF > ./postinst
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
echo "./borgbackup-${TERMUX_PKG_VERSION}-py${_PYTHON_VERSION}-linux-x86_64.egg" >> $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
|
||||
echo "./${_BORGBACKUP_EGGDIR}" >> $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
|
||||
EOF
|
||||
|
||||
cat <<- EOF > ./prerm
|
||||
#!$TERMUX_PREFIX/bin/sh
|
||||
sed -i "/\.\/borgbackup-${TERMUX_PKG_VERSION}-py${_PYTHON_VERSION}-linux-x86_64\.egg/d" $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
|
||||
sed -i "/\.\/${_BORGBACKUP_EGGDIR//./\\.}/d" $TERMUX_PREFIX/lib/python${_PYTHON_VERSION}/site-packages/easy-install.pth
|
||||
EOF
|
||||
}
|
||||
|
52
packages/borgbackup/setup.py-prefixes.patch
Normal file
52
packages/borgbackup/setup.py-prefixes.patch
Normal file
@ -0,0 +1,52 @@
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -167,8 +167,7 @@
|
||||
library_dirs = []
|
||||
define_macros = []
|
||||
|
||||
-possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl',
|
||||
- '/usr/local/borg', '/opt/local', '/opt/pkg', '/opt/homebrew/opt/openssl@1.1', ]
|
||||
+possible_openssl_prefixes = ['@TERMUX_PREFIX@', ]
|
||||
if os.environ.get('BORG_OPENSSL_PREFIX'):
|
||||
possible_openssl_prefixes.insert(0, os.environ.get('BORG_OPENSSL_PREFIX'))
|
||||
ssl_prefix = detect_openssl(possible_openssl_prefixes)
|
||||
@@ -178,8 +177,7 @@
|
||||
library_dirs.append(os.path.join(ssl_prefix, 'lib'))
|
||||
|
||||
|
||||
-possible_liblz4_prefixes = ['/usr', '/usr/local', '/usr/local/opt/lz4', '/usr/local/lz4',
|
||||
- '/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
||||
+possible_liblz4_prefixes = ['@TERMUX_PREFIX@', ]
|
||||
if os.environ.get('BORG_LIBLZ4_PREFIX'):
|
||||
possible_liblz4_prefixes.insert(0, os.environ.get('BORG_LIBLZ4_PREFIX'))
|
||||
liblz4_prefix = setup_lz4.lz4_system_prefix(possible_liblz4_prefixes)
|
||||
@@ -190,8 +188,7 @@
|
||||
else:
|
||||
liblz4_system = False
|
||||
|
||||
-possible_libb2_prefixes = ['/usr', '/usr/local', '/usr/local/opt/libb2', '/usr/local/libb2',
|
||||
- '/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
||||
+possible_libb2_prefixes = ['@TERMUX_PREFIX@', ]
|
||||
if os.environ.get('BORG_LIBB2_PREFIX'):
|
||||
possible_libb2_prefixes.insert(0, os.environ.get('BORG_LIBB2_PREFIX'))
|
||||
libb2_prefix = setup_b2.b2_system_prefix(possible_libb2_prefixes)
|
||||
@@ -202,8 +199,7 @@
|
||||
else:
|
||||
libb2_system = False
|
||||
|
||||
-possible_libzstd_prefixes = ['/usr', '/usr/local', '/usr/local/opt/libzstd', '/usr/local/libzstd',
|
||||
- '/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
||||
+possible_libzstd_prefixes = ['@TERMUX_PREFIX@', ]
|
||||
if os.environ.get('BORG_LIBZSTD_PREFIX'):
|
||||
possible_libzstd_prefixes.insert(0, os.environ.get('BORG_LIBZSTD_PREFIX'))
|
||||
libzstd_prefix = setup_zstd.zstd_system_prefix(possible_libzstd_prefixes)
|
||||
@@ -214,8 +210,7 @@
|
||||
else:
|
||||
libzstd_system = False
|
||||
|
||||
-possible_libxxhash_prefixes = ['/usr', '/usr/local', '/usr/local/opt/libxxhash', '/usr/local/libxxhash',
|
||||
- '/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
||||
+possible_libxxhash_prefixes = ['@TERMUX_PREFIX@', ]
|
||||
if os.environ.get('BORG_LIBXXHASH_PREFIX'):
|
||||
possible_libxxhash_prefixes.insert(0, os.environ.get('BORG_LIBXXHASH_PREFIX'))
|
||||
libxxhash_prefix = setup_xxhash.xxhash_system_prefix(possible_libxxhash_prefixes)
|
Loading…
Reference in New Issue
Block a user