git: 3a5cc256fcf8 - main - sysutils/duplicity: Improve port

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Sun, 14 Jan 2024 09:38:04 UTC
The branch main has been updated by eduardo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3a5cc256fcf8b3d54d8f786979c013ced54cf423

commit 3a5cc256fcf8b3d54d8f786979c013ced54cf423
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-01-14 09:27:40 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-01-14 09:37:50 +0000

    sysutils/duplicity: Improve port
    
    - Switch to DISTVERSION
    - Switch to pep517 build
    - Update WWW (redirection)
    - Remove FTP and FTPS from default options
    - Use py-boto3 run dep on S3 option
    - Add dropbox backend option
    - Add pytest testunit
    - Take maintainership
    
    PR:             268850, 270572, 274904
---
 sysutils/duplicity/Makefile                   | 88 +++++++++++----------------
 sysutils/duplicity/distinfo                   |  2 +-
 sysutils/duplicity/files/extra-patch-setup.py | 30 +++++++++
 sysutils/duplicity/files/patch-setup.py       | 21 +++++++
 sysutils/duplicity/pkg-message                | 17 ------
 5 files changed, 86 insertions(+), 72 deletions(-)

diff --git a/sysutils/duplicity/Makefile b/sysutils/duplicity/Makefile
index 2c075d626625..a5f0d127c1af 100644
--- a/sysutils/duplicity/Makefile
+++ b/sysutils/duplicity/Makefile
@@ -1,95 +1,75 @@
 PORTNAME=	duplicity
-PORTVERSION=	2.1.5
+DISTVERSION=	2.1.5
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	PYPI
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	eduardo@FreeBSD.org
 COMMENT=	Backup tool that uses librsync and GnuPG
-WWW=		https://duplicity.nongnu.org
+WWW=		https://duplicity.gitlab.io/
 
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools_scm>=0:devel/py-setuptools_scm@${PY_FLAVOR}
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
 LIB_DEPENDS=	librsync.so:net/librsync
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}fasteners>=0:devel/py-fasteners@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}future>0:devel/py-future@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}paramiko>=0:security/py-paramiko@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pexpect>0:misc/py-pexpect@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}urllib3>=0:net/py-urllib3@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}future>0:devel/py-future@${PY_FLAVOR}
+		${PYTHON_PKGNAMEPREFIX}urllib3>=0:net/py-urllib3@${PY_FLAVOR}
+TEST_DEPENDS=	gtar>0:archivers/gtar \
+		par2cmdline>0:archivers/par2cmdline
 
 USES=		cpe localbase python shebangfix
 CPE_VENDOR=	${PORTNAME}_project
-USE_PYTHON=	autoplist distutils noflavors
 USE_LDCONFIG=	yes
+USE_PYTHON=	autoplist noflavors pep517 pytest
 
-SHEBANG_FILES=	bin/duplicity
-
-PORTDOCS=	CHANGELOG.md COPYING README.md README-REPO.md README-LOG.md
+SHEBANG_FILES=	bin/duplicity testing/overrides/bin/*
 
-POST_PLIST=	trim-duplicity-testing
+PORTDOCS=	CONTRIBUTING.md README-LOG.md README-REPO.md README-TESTING.md \
+		README.md
 
-OPTIONS_DEFINE=		B2 DOCS FTP FTPS GDOCS NLS S3
+OPTIONS_DEFINE=		B2 DOCS DROPBOX FTP FTPS GDOCS NLS S3
+OPTIONS_DEFAULT=	B2 DROPBOX GNUPG2 S3
 OPTIONS_GROUP=		GPG
 OPTIONS_SINGLE=		GPG
 OPTIONS_SINGLE_GPG=	GNUPG GNUPG2
-OPTIONS_DEFAULT=	B2 FTP FTPS GNUPG2 S3
 
-B2_DESC=		Backblaze B2 backend
-FTP_DESC=		FTP backend
-FTPS_DESC=		FTPS backend
-GDOCS_DESC=		Google Docs backend
-GPG_DESC=		GnuPG support
-GNUPG_DESC=		Use GnuPG 1
-GNUPG2_DESC=		Use GnuPG 2
-S3_DESC=		Amazon S3 backend
+B2_DESC=	Backblaze B2 backend
+DROPBOX_DESC=	Dropbox backend
+FTP_DESC=	FTP backend
+FTPS_DESC=	FTPS backend
+GDOCS_DESC=	Google Docs backend
+GPG_DESC=	GnuPG support
+GNUPG_DESC=	Use GnuPG 1
+GNUPG2_DESC=	Use GnuPG 2
+S3_DESC=	Amazon S3 backend
 
 B2_RUN_DEPENDS=		${PYTHON_PKGNAMEPREFIX}b2sdk>=0.1.8:devel/py-b2sdk@${PY_FLAVOR}
+DROPBOX_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}dropbox>0:www/py-dropbox@${PY_FLAVOR}
 FTP_RUN_DEPENDS=	ncftp>=3.2.2:ftp/ncftp3
 FTPS_RUN_DEPENDS=	lftp>=3.7.15:ftp/lftp
 GDOCS_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pydrive>0:devel/py-pydrive@${PY_FLAVOR}
 GNUPG_RUN_DEPENDS=	gnupg1>=1.4.7:security/gnupg1
 GNUPG2_RUN_DEPENDS=	gpg2:security/gnupg
-NLS_USES=		gettext
-S3_RUN_DEPENDS=		${PYTHON_PKGNAMEPREFIX}boto>=1.6b:devel/py-boto@${PY_FLAVOR}
-
-post-patch:
-.for f in cfbackend _cf_cloudfiles _cf_pyrax giobackend
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/${f}.py
-.endfor
-	@${REINPLACE_CMD} '/self.inplace = True/d' ${WRKSRC}/setup.py
-
-post-patch-NLS-off:
-	@${REINPLACE_CMD} -e '109,133d' \
-		${WRKSRC}/setup.py
-
-post-patch-FTP-off:
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/ftpbackend.py
-
-post-patch-FTPS-off:
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/ftpsbackend.py
-
-post-patch-S3-off:
-.for f in botobackend _boto_multi _boto_single
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/${f}.py
-.endfor
-
-post-patch-GDOCS-off:
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/gdocsbackend.py
-
-post-patch-B2-off:
-	@${RM} ${WRKSRC}/${PORTNAME}/backends/b2backend.py
+NLS_USES=		gettext-tools
+NLS_EXTRA_PATCHES_OFF=	${FILESDIR}/extra-patch-setup.py
+S3_RUN_DEPENDS=		${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3@${PY_FLAVOR}
 
 post-install:
 	@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/duplicity/_librsync*.so
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
-	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|g} ${STAGEDIR}${DOCSDIR}
+	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
 
-trim-duplicity-testing:
-	@${REINPLACE_CMD} '/\/testing\//d' ${TMPPLIST}
+pre-test:
+	@${REINPLACE_CMD} -e 's,python3,${PYTHON_CMD:T},' \
+		${WRKSRC}/testing/functional/__init__.py
 
 .include <bsd.port.mk>
diff --git a/sysutils/duplicity/distinfo b/sysutils/duplicity/distinfo
index 951ef253d1cf..ebd071b5d335 100644
--- a/sysutils/duplicity/distinfo
+++ b/sysutils/duplicity/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1705179320
+TIMESTAMP = 1704707559
 SHA256 (duplicity-2.1.5.tar.gz) = 676c14e1b0029396954a054ddc2e9f12c939dfcfa95a4fb79b27ec396d6c15d1
 SIZE (duplicity-2.1.5.tar.gz) = 1559641
diff --git a/sysutils/duplicity/files/extra-patch-setup.py b/sysutils/duplicity/files/extra-patch-setup.py
new file mode 100644
index 000000000000..b9b8c66d973d
--- /dev/null
+++ b/sysutils/duplicity/files/extra-patch-setup.py
@@ -0,0 +1,30 @@
+--- setup.py.orig	2023-12-25 18:14:22 UTC
++++ setup.py
+@@ -105,27 +105,6 @@ def get_data_files():
+     if os.environ.get("READTHEDOCS") == "True":
+         return data_files
+ 
+-    # msgfmt the translation files
+-    assert os.path.exists("po"), "Missing 'po' directory."
+-
+-    linguas = glob.glob("po/*.po")
+-    for lang in linguas:
+-        lang = lang[3:-3]
+-        try:
+-            os.mkdir(os.path.join("po", lang))
+-        except os.error:
+-            pass
+-        assert not os.system(f"cp po/{lang}.po po/{lang}"), lang
+-        assert not os.system(f"msgfmt po/{lang}.po -o po/{lang}/duplicity.mo"), lang
+-
+-    for root, dirs, files in os.walk("po"):
+-        for file in files:
+-            path = os.path.join(root, file)
+-            if path.endswith("duplicity.mo"):
+-                lang = os.path.split(root)[-1]
+-                data_files.append((f"share/locale/{lang}/LC_MESSAGES", [f"po/{lang}/duplicity.mo"]))
+-
+-    return data_files
+ 
+ 
+ def VersionedCopy(source, dest):
diff --git a/sysutils/duplicity/files/patch-setup.py b/sysutils/duplicity/files/patch-setup.py
new file mode 100644
index 000000000000..1c5e69fb4034
--- /dev/null
+++ b/sysutils/duplicity/files/patch-setup.py
@@ -0,0 +1,21 @@
+--- setup.py.orig	2023-12-25 16:22:33 UTC
++++ setup.py
+@@ -87,18 +87,6 @@ def get_data_files():
+                 "bin/duplicity.1",
+             ],
+         ),
+-        (
+-            f"share/doc/duplicity-{Version}",
+-            [
+-                "CHANGELOG.md",
+-                "CONTRIBUTING.md",
+-                "COPYING",
+-                "README.md",
+-                "README-LOG.md",
+-                "README-REPO.md",
+-                "README-TESTING.md",
+-            ],
+-        ),
+     ]
+ 
+     # short circuit fot READTHEDOCS
diff --git a/sysutils/duplicity/pkg-message b/sysutils/duplicity/pkg-message
index af575d9ab71b..5b3cc6112e19 100644
--- a/sysutils/duplicity/pkg-message
+++ b/sysutils/duplicity/pkg-message
@@ -5,7 +5,6 @@
  require manual installation of their respective dependencies because
  they are not yet available in the ports tree:
 
-   - The Dropbox backend
    - The HSI backend
    - The mega backend for mega.co.nz
    - The swift backend for OpenStack Object Storage
@@ -18,20 +17,4 @@
  and "allow-loopback-pinentry" into ~/.gnupg/gpg-agent.conf
 EOM
 }
-{ type: upgrade
-  maximum_version: "0.8.12"
-  message: <<EOM
-  The sysutils/duplicity port has been updated to 0.8.12, current stable
-  release. A new port sysutils/duplicity07 has been created to keep version
-  0.7.19 in the tree, as it uses a deprecated version of Python, it will be
-  removed soon. It will be kept for a while just in case some incompatibilities
-  still show up.
-
-  If you would like to keep using 0.7.19, please run the following command
-  to update pkg database:
-
-    pkg set -n duplicity:duplicity07
-    pkg set -o sysutils/duplicity:sysutils/duplicity07
-EOM
-}
 ]