1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

archivers/py-borgbackup: unbreak on FreeBSD 13

import acl_extended_file_np.c from src/lib/libc/posix1e,
taken from FreeBSD src branch as of 559a218c9b25, 2023-11-01T16:43:37Z
and tell Cython to include it on FreeBSD before 1400033,
i. e., before FreeBSD's libc had it.

This fixes https://github.com/borgbackup/borg/issues/8269 and
makes it unnecessary to look into
PR:		280453
This commit is contained in:
Matthias Andree 2024-07-26 15:23:06 +02:00
parent 03e67b293c
commit bd04537abb
4 changed files with 116 additions and 9 deletions

View File

@ -5,15 +5,15 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades. you update your ports collection, before attempting any port upgrades.
20240724: 20240726:
AFFECTS: users of archivers/py-borgbackup AFFECTS: users of archivers/py-borgbackup
AUTHOR: mandree@FreeBSD.org AUTHOR: mandree@FreeBSD.org
Borgbackup has been upgraded to version 1.4.0, which does not yet Borgbackup has been upgraded to version 1.4.0.
support FreeBSD 13.x, see https://github.com/borgbackup/borg/issues/8269 The FreeBSD port as of 2024-07-26 reinstates FreeBSD 13 compatibility.
For users who are on FreeBSD 13, or who wish to continue using For users who wish to continue using version 1.2,
version 1.2, use either of these commands for upgrading: use either of these commands for upgrading:
With binary packages through pkg: With binary packages through pkg:
pkg set -o archivers/py-borgbackup:archivers/py-borgbackup12 pkg set -o archivers/py-borgbackup:archivers/py-borgbackup12

View File

@ -1,6 +1,6 @@
PORTNAME= borgbackup PORTNAME= borgbackup
DISTVERSION= 1.4.0 DISTVERSION= 1.4.0
PORTREVISION= 0 PORTREVISION= 1
CATEGORIES= archivers python CATEGORIES= archivers python
MASTER_SITES= PYPI MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -12,8 +12,6 @@ WWW= https://pypi.org/project/borgbackup/
LICENSE= BSD3CLAUSE LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN_FreeBSD_13= uses acl_extended_link_np, see https://github.com/borgbackup/borg/issues/8269
# note that borgbackup pins the msgpack version range per patchlevel version! # note that borgbackup pins the msgpack version range per patchlevel version!
_BB_DEPENDS= ${PYTHON_PKGNAMEPREFIX}msgpack>=1.0.2<1.1.0:devel/py-msgpack@${PY_FLAVOR} _BB_DEPENDS= ${PYTHON_PKGNAMEPREFIX}msgpack>=1.0.2<1.1.0:devel/py-msgpack@${PY_FLAVOR}
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pkgconfig>=0:devel/py-pkgconfig@${PY_FLAVOR} \ BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pkgconfig>=0:devel/py-pkgconfig@${PY_FLAVOR} \
@ -39,6 +37,21 @@ OPTIONS_DEFAULT= FUSE
FUSE_DESC= Support to mount locally borg backup files FUSE_DESC= Support to mount locally borg backup files
FUSE_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}llfuse>0:devel/py-llfuse@${PY_FLAVOR} FUSE_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}llfuse>0:devel/py-llfuse@${PY_FLAVOR}
.include <bsd.port.pre.mk>
.if (${OPSYS} == FreeBSD) && ${OSVERSION} < 1400033 # why 1400033?
# 1. check for the OLDEST (last in list) history entry on the file, when it was added:
# git -C /usr/src hist lib/libc/posix1e/acl_extended_file_np.c
# 2. check for the version you have obtained what __FreeBSD_version was
# and increment by one. This is inaccurate for the interim between file addition
# and __FreeBSD_version bump back then, but those versions were no releases and
# should no longer be in the field.
EXTRA_PATCHES += ${FILESDIR}/extrapatch-setup.py
post-patch:
${CP} ${FILESDIR}/acl_extended_file_np.c ${WRKSRC}/src/borg/platform/
.endif
_BORGHOME=${WRKDIR}/testhome _BORGHOME=${WRKDIR}/testhome
_BORGENV=-i BORG_PASSPHRASE=secret123 PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR} HOME=${_BORGHOME} _BORGENV=-i BORG_PASSPHRASE=secret123 PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR} HOME=${_BORGHOME}
post-install: post-install:
@ -71,4 +84,4 @@ post-install:
do-test: do-test:
cd ${WRKSRC} && ${SETENV} ${_BORGENV} ${TEST_ENV} tox-${PYTHON_VER} -e ${PY_FLAVOR} -vv cd ${WRKSRC} && ${SETENV} ${_BORGENV} ${TEST_ENV} tox-${PYTHON_VER} -e ${PY_FLAVOR} -vv
.include <bsd.port.mk> .include <bsd.port.post.mk>

View File

@ -0,0 +1,83 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 Gleb Popov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* taken from FreeBSD src branch as of 559a218c9b25 Wed Nov 1 16:43:37 2023 -0600 */
/*
* acl_extended_file_np: Check if the file has extended ACLs set.
*/
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/acl.h>
#include <unistd.h>
typedef acl_t (*acl_get_func)(const char *, acl_type_t);
typedef long (*pathconf_func)(const char *, int);
static int
_acl_extended_file(acl_get_func f, pathconf_func pathconf_f, const char* path_p);
int
acl_extended_file_np(const char *path_p)
{
return (_acl_extended_file(acl_get_file, pathconf, path_p));
}
int
acl_extended_file_nofollow_np(const char *path_p)
{
return (_acl_extended_file(acl_get_link_np, lpathconf, path_p));
}
int
acl_extended_link_np(const char *path_p)
{
return (_acl_extended_file(acl_get_link_np, lpathconf, path_p));
}
int
_acl_extended_file(acl_get_func acl_get, pathconf_func pathconf_f, const char* path_p)
{
acl_t acl;
int retval, istrivial, acltype = ACL_TYPE_ACCESS;
retval = pathconf_f(path_p, _PC_ACL_NFS4);
if (retval > 0)
acltype = ACL_TYPE_NFS4;
acl = acl_get(path_p, acltype);
if (acl == NULL)
return (-1);
retval = acl_is_trivial_np(acl, &istrivial);
acl_free(acl);
if (retval == -1)
return (-1);
return (!istrivial);
}

View File

@ -0,0 +1,11 @@
--- setup.py.orig 2024-07-02 22:06:38 UTC
+++ setup.py
@@ -181,7 +181,7 @@ if not on_rtd:
syncfilerange_ext = Extension(
"borg.platform.syncfilerange", [platform_syncfilerange_source], extra_compile_args=cflags
)
- freebsd_ext = Extension("borg.platform.freebsd", [platform_freebsd_source], extra_compile_args=cflags)
+ freebsd_ext = Extension("borg.platform.freebsd", [platform_freebsd_source, 'src/borg/platform/acl_extended_file_np.c'], extra_compile_args=cflags)
darwin_ext = Extension("borg.platform.darwin", [platform_darwin_source], extra_compile_args=cflags)
windows_ext = Extension("borg.platform.windows", [platform_windows_source], extra_compile_args=cflags)