git: 774288eaf19b - main - [NEW] net/onionprobe: Test and monitor Tor Onion Services

From: Vinícius Zavam <egypcio_at_FreeBSD.org>
Date: Sun, 07 Aug 2022 15:44:36 UTC
The branch main has been updated by egypcio:

URL: https://cgit.FreeBSD.org/ports/commit/?id=774288eaf19bf92ba54381e954082dfee02ad2cb

commit 774288eaf19bf92ba54381e954082dfee02ad2cb
Author:     Vinícius Zavam <egypcio@FreeBSD.org>
AuthorDate: 2022-08-07 15:42:14 +0000
Commit:     Vinícius Zavam <egypcio@FreeBSD.org>
CommitDate: 2022-08-07 15:42:14 +0000

    [NEW] net/onionprobe: Test and monitor Tor Onion Services
    
      Onionprobe is a tool for testing and monitoring the status of
      Tor Onion Services sites. It can run a single time or continuously to
      probe a set of onion services endpoints and paths, optionally
      exporting to Prometheus.
    
      WWW: https://pypi.org/project/onionprobe
    
    Sponsored by:   TorBSD Diversity Project, TDP
    Sponsored by:   The Tor Project
---
 net/Makefile                                       |  1 +
 net/onionprobe/Makefile                            | 45 ++++++++++++++++++++++
 net/onionprobe/distinfo                            |  3 ++
 net/onionprobe/files/extras-setup.py               |  5 +++
 .../files/patch-docs_man_onionprobe.1.md           | 11 ++++++
 .../files/patch-packages_onionprobe_config.py      | 14 +++++++
 net/onionprobe/pkg-descr                           |  6 +++
 7 files changed, 85 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index a081af47e3f6..b5c621caca10 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -545,6 +545,7 @@
     SUBDIR += onedrive
     SUBDIR += onenetd
     SUBDIR += onioncat
+    SUBDIR += onionprobe
     SUBDIR += ooni-mini
     SUBDIR += ooni-probe-cli
     SUBDIR += opal
diff --git a/net/onionprobe/Makefile b/net/onionprobe/Makefile
new file mode 100644
index 000000000000..c9f685b219e4
--- /dev/null
+++ b/net/onionprobe/Makefile
@@ -0,0 +1,45 @@
+PORTNAME=	onionprobe
+PORTVERSION=	1.0.0
+CATEGORIES=	net python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	egypcio@FreeBSD.org
+COMMENT=	Test and monitor the status of Tor Onion Services
+
+LICENSE=	GPLv3+
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=  ${PYTHON_PKGNAMEPREFIX}poetry-core>=0:devel/py-poetry-core@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cryptography>=0:security/py-cryptography@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}prometheus-client>=0:net-mgmt/py-prometheus-client@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pysocks>=0:net/py-pysocks@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}requests>=0:www/py-requests@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}stem>=0:security/py-stem@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}yaml>=0:devel/py-yaml@${PY_FLAVOR} \
+		tor:security/tor
+
+USES=		python:3.6+ shebangfix
+USE_PYTHON=	autoplist distutils
+
+SHEBANG_FILES=	packages/*.py \
+		packages/onionprobe/*.py
+
+OPTIONS_DEFINE=		MANPAGES
+OPTIONS_DEFAULT=	MANPAGES
+
+MANPAGES_PLIST_FILES=	share/man/man1/onionprobe.1.md.gz
+
+post-patch:
+	${REINPLACE_CMD} "s|%%ETCDIR%%|${ETCDIR}|g" \
+	  ${WRKSRC}/docs/man/onionprobe.1.md \
+	  ${WRKSRC}/packages/onionprobe/config.py
+	${CP} ${FILESDIR}/extras-setup.py ${WRKSRC}/setup.py \
+	  && ${REINPLACE_CMD} "s|%%NAME%%|${PORTNAME}|g; s|%%VERSION%%|${PORTVERSION}|g" ${WRKSRC}/setup.py
+
+post-install-MANPAGES-on:
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/man/man1 \
+	  && ${INSTALL_MAN} ${WRKSRC}/docs/man/onionprobe.1.md ${STAGEDIR}${PREFIX}/share/man/man1/.
+
+.include <bsd.port.mk>
diff --git a/net/onionprobe/distinfo b/net/onionprobe/distinfo
new file mode 100644
index 000000000000..6517e0625a0b
--- /dev/null
+++ b/net/onionprobe/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1659871179
+SHA256 (onionprobe-1.0.0.tar.gz) = d1faf87bfc6d6c881ee16109cb4c69595d641dcf4c6e6791cdb1ae880834194f
+SIZE (onionprobe-1.0.0.tar.gz) = 123121
diff --git a/net/onionprobe/files/extras-setup.py b/net/onionprobe/files/extras-setup.py
new file mode 100644
index 000000000000..443da665d733
--- /dev/null
+++ b/net/onionprobe/files/extras-setup.py
@@ -0,0 +1,5 @@
+from setuptools import setup
+setup(
+    name="%%NAME%%",
+    version="%%VERSION%%",
+)
diff --git a/net/onionprobe/files/patch-docs_man_onionprobe.1.md b/net/onionprobe/files/patch-docs_man_onionprobe.1.md
new file mode 100644
index 000000000000..f3f2b35c3d17
--- /dev/null
+++ b/net/onionprobe/files/patch-docs_man_onionprobe.1.md
@@ -0,0 +1,11 @@
+--- docs/man/onionprobe.1.md.orig	2022-08-07 13:42:24 UTC
++++ docs/man/onionprobe.1.md
+@@ -536,7 +536,7 @@ This is a sample configuration file that can be adapte
+ 
+ # FILES
+ 
+-/etc/onionprobe
++%%ETCDIR%%
+ :  System-wide Onionprobe configuration files.
+ 
+ # LIMITATIONS
diff --git a/net/onionprobe/files/patch-packages_onionprobe_config.py b/net/onionprobe/files/patch-packages_onionprobe_config.py
new file mode 100644
index 000000000000..5d6059133880
--- /dev/null
+++ b/net/onionprobe/files/patch-packages_onionprobe_config.py
@@ -0,0 +1,14 @@
+--- packages/onionprobe/config.py.orig	2022-08-07 13:42:37 UTC
++++ packages/onionprobe/config.py
+@@ -476,9 +476,9 @@ def cmdline_parser_compiler(default_source=None):
+     # package)
+     config_template = os.path.normpath(os.path.join(basepath, 'configs', 'tor.yaml'))
+ 
+-    # Fallback config_template to /etc/onionprobe
++    # Fallback config_template to %%ETCDIR%%
+     if not os.path.exists(config_template):
+-        config_template = os.path.normpath(os.path.join(os.sep, 'etc', 'onionprobe', 'tor.yaml'))
++        config_template = '%%ETCDIR%%/tor.yaml'
+ 
+     # Try to use the configs/ folder as the default output_folder (will match
+     # when running directly from the Onionprobe repository or from the python
diff --git a/net/onionprobe/pkg-descr b/net/onionprobe/pkg-descr
new file mode 100644
index 000000000000..0104549234d8
--- /dev/null
+++ b/net/onionprobe/pkg-descr
@@ -0,0 +1,6 @@
+Onionprobe is a tool for testing and monitoring the status of
+Tor Onion Services sites. It can run a single time or continuously to
+probe a set of onion services endpoints and paths, optionally
+exporting to Prometheus.
+
+WWW: https://pypi.org/project/onionprobe