borgbackup: update use-distutils.patch

This commit is contained in:
Leonid Pliushch 2021-07-26 13:25:08 +03:00
parent 80764d3e5a
commit ea20bf9f43
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 69 additions and 5 deletions

View File

@ -3,7 +3,7 @@ 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=1
TERMUX_PKG_REVISION=2
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_DEPENDS="libacl, liblz4, openssl, python, zstd"

View File

@ -1,3 +1,8 @@
From a90b4d665e6145f7d10535ec77510ba7f04f7515 Mon Sep 17 00:00:00 2001
From: Leonid Pliushch <leonid.pliushch@gmail.com>
Date: Mon, 26 Jul 2021 13:11:32 +0300
Subject: [PATCH] Termux borgbackup: use distutils instead of packaging
Do not remove this patch unless you know what you are doing!
We don't have module "packaging" packaged and thus cannot use it without
@ -8,9 +13,14 @@ So if you decide to drop this patch:
* Add python3-packaging to termux-packages.
* Alternatively: create a postinst deb script (pip3 install packaging)
and move borgbackup to https://github.com/termux/unstable-packages
---
setup.py | 21 +++++++--------------
src/borg/__init__.py | 5 ++---
src/borg/xattr.py | 6 +++---
3 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/setup.py b/setup.py
index 7ad8f814..5a642fff 100644
index 7ad8f814..526757ed 100644
--- a/setup.py
+++ b/setup.py
@@ -11,8 +11,9 @@
@ -24,7 +34,15 @@ index 7ad8f814..5a642fff 100644
try:
from Cython.Build import cythonize
@@ -137,16 +138,9 @@ def rm(file):
@@ -70,7 +71,6 @@
# Please note:
# using any other version is not supported by borg development and
# any feedback related to issues caused by this will be ignored.
- 'packaging',
]
# note for package maintainers: if you package borgbackup for distribution,
@@ -137,16 +137,9 @@ def rm(file):
pass
@ -43,7 +61,7 @@ index 7ad8f814..5a642fff 100644
for source in cython_sources:
genc = source.replace('.pyx', '.c')
rm(genc)
@@ -160,7 +154,7 @@ def run(self):
@@ -160,7 +153,7 @@ def run(self):
'build_usage': setup_docs.build_usage,
'build_man': setup_docs.build_man,
'sdist': Sdist,
@ -52,7 +70,7 @@ index 7ad8f814..5a642fff 100644
}
ext_modules = []
@@ -227,8 +221,8 @@ def members_appended(*ds):
@@ -227,8 +220,8 @@ def members_appended(*ds):
# sometimes there's no need to cythonize
# this breaks chained commands like 'clean sdist'
@ -63,3 +81,49 @@ index 7ad8f814..5a642fff 100644
if cythonize and cythonizing:
cython_opts = dict(
diff --git a/src/borg/__init__.py b/src/borg/__init__.py
index 9f13c7d6..47adb1b6 100644
--- a/src/borg/__init__.py
+++ b/src/borg/__init__.py
@@ -1,12 +1,11 @@
-from packaging.version import parse as parse_version
+from distutils.version import LooseVersion
# IMPORTANT keep imports from borg here to a minimum because our testsuite depends on
# being able to import borg.constants and then monkey patching borg.constants.PBKDF2_ITERATIONS
from ._version import version as __version__
-_v = parse_version(__version__)
-__version_tuple__ = _v._version.release
+__version_tuple__ = tuple(LooseVersion(__version__).version[:3])
# assert that all semver components are integers
# this is mainly to show errors when people repackage poorly
diff --git a/src/borg/xattr.py b/src/borg/xattr.py
index a2039ebb..dd412edd 100644
--- a/src/borg/xattr.py
+++ b/src/borg/xattr.py
@@ -7,7 +7,7 @@
import sys
import tempfile
-from packaging.version import parse as parse_version
+from distutils.version import LooseVersion
from .helpers import prepare_subprocess_env
@@ -29,8 +29,8 @@
if preload.startswith("libfakeroot"):
env = prepare_subprocess_env(system=True)
fakeroot_output = subprocess.check_output(['fakeroot', '-v'], env=env)
- fakeroot_version = parse_version(fakeroot_output.decode('ascii').split()[-1])
- if fakeroot_version >= parse_version("1.20.2"):
+ fakeroot_version = LooseVersion(fakeroot_output.decode('ascii').split()[-1])
+ if fakeroot_version >= LooseVersion("1.20.2"):
# 1.20.2 has been confirmed to have xattr support
# 1.18.2 has been confirmed not to have xattr support
# Versions in-between are unknown
--
2.30.2