View previous topic :: View next topic |
Author |
Message |
freke Veteran
Joined: 23 Jan 2003 Posts: 1033 Location: Somewhere in Denmark
|
Posted: Tue Nov 28, 2023 7:03 pm Post subject: [SOLVED]postfix-mta-sts-resolver-1.4.0 - ebuild |
|
|
At last decided I wanted to try and make an ebuild for this, as I kept forgetting about it everytime I updated python...
Does this look somewhat sane? (worksforme™) Code: | # Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYPI_NO_NORMALIZE=1
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1 pypi
DESCRIPTION="Daemon which provides TLS client policy for Postfix via socketmap, according to domain MTA-STS policy."
HOMEPAGE="https://github.com/Snawoot/postfix-mta-sts-resolver https://pypi.org/project/postfix-mta-sts-resolver/"
SRC_URI="https://github.com/Snawoot/postfix-mta-sts-resolver/releases/download/v${PV}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64"
IUSE="uvloop"
DOCS="README.md"
RDEPEND="
${PYTHON_DEPS}
>=dev-python/aiodns-1.1.1[${PYTHON_USEDEP}]
>=dev-python/aiohttp-3.4.4[${PYTHON_USEDEP}]
>=dev-python/pyyaml-3.12[${PYTHON_USEDEP}]
>=dev-python/pycares-4.0.0[${PYTHON_USEDEP}]
>=dev-python/attrs-17.3.0[${PYTHON_USEDEP}]
>=dev-python/charset-normalizer-2.0[${PYTHON_USEDEP}]
<dev-python/charset-normalizer-4.0[${PYTHON_USEDEP}]
>=dev-python/multidict-4.5[${PYTHON_USEDEP}]
<dev-python/multidict-7.0[${PYTHON_USEDEP}]
>=dev-python/async-timeout-4.0.0[${PYTHON_USEDEP}]
<dev-python/async-timeout-5.0[${PYTHON_USEDEP}]
>=dev-python/yarl-1.0[${PYTHON_USEDEP}]
<dev-python/yarl-2.0[${PYTHON_USEDEP}]
>=dev-python/frozenlist-1.1.1[${PYTHON_USEDEP}]
>=dev-python/aiosignal-1.1.2[${PYTHON_USEDEP}]
>=dev-python/cffi-1.5.0[${PYTHON_USEDEP}]
>=dev-python/idna-2.0[${PYTHON_USEDEP}]
dev-python/pycparser[${PYTHON_USEDEP}]
uvloop? (
dev-python/uvloop[${PYTHON_USEDEP}]
)
"
DEPEND="${RDEPEND}" | The RDEPENDs are what is listed when I installed it via Code: | python3 -m pip install postfix-mta-sts-resolver --break-system-packages |
Last edited by freke on Wed Nov 29, 2023 7:46 am; edited 1 time in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1935
|
Posted: Tue Nov 28, 2023 7:14 pm Post subject: |
|
|
I believe the direct dependencies can be cut down by what is in the setup.py file: Code: | install_requires=[
'aiodns>=1.1.1',
'aiohttp>=3.4.4',
'PyYAML>=3.12',
], |
Optionally adding support for these: Code: | extras_require={
'sqlite': 'aiosqlite>=0.10.0',
'redis': 'redis>=4.2.0rc1',
'postgres': 'asyncpg>=0.27',
'uvloop': 'uvloop>=0.11.0',
}, |
|
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31294 Location: here
|
Posted: Tue Nov 28, 2023 7:25 pm Post subject: |
|
|
Based information from github, the dependencies can be as following:
So RDEPEND can be
Code: | RDEPEND="
${PYTHON_DEPS}
dev-python/aiodns[${PYTHON_USEDEP}]
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
postgres? (
dev-python/asyncpg[${PYTHON_USEDEP}] #only present in guru overlay
)
sqlite? (
dev-python/aiosqlite[${PYTHON_USEDEP}]
)
redis? (
dev-python/redis[${PYTHON_USEDEP}]
)
uvloop? (
dev-python/uvloop[${PYTHON_USEDEP}]
)
" |
_________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
freke Veteran
Joined: 23 Jan 2003 Posts: 1033 Location: Somewhere in Denmark
|
Posted: Tue Nov 28, 2023 7:31 pm Post subject: |
|
|
Thanks, you can tell it's my first time trying an ebuild for some python-stuff - didn't know/think about to simply look at the setup.py...
Never used/tried any of the DBs - only used internal cache. Might give it a go |
|
Back to top |
|
|
freke Veteran
Joined: 23 Jan 2003 Posts: 1033 Location: Somewhere in Denmark
|
Posted: Wed Nov 29, 2023 7:19 am Post subject: |
|
|
fedeliallalinea wrote: | Based information from github, the dependencies can be as following:
So RDEPEND can be
Code: | RDEPEND="
${PYTHON_DEPS}
dev-python/aiodns[${PYTHON_USEDEP}]
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
postgres? (
dev-python/asyncpg[${PYTHON_USEDEP}] #only present in guru overlay
)
sqlite? (
dev-python/aiosqlite[${PYTHON_USEDEP}]
)
redis? (
dev-python/redis[${PYTHON_USEDEP}]
)
uvloop? (
dev-python/uvloop[${PYTHON_USEDEP}]
)
" |
|
Thanks, only tried sqlite for now and got that working fine - not going to test postgres (don't have a server running), but will give redis a test-drive, too as I have a redis-server running for rspamd. |
|
Back to top |
|
|
freke Veteran
Joined: 23 Jan 2003 Posts: 1033 Location: Somewhere in Denmark
|
Posted: Wed Dec 06, 2023 2:52 pm Post subject: |
|
|
Code: | # Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
PYPI_NO_NORMALIZE=1
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1 pypi
DESCRIPTION="Daemon which provides TLS client policy for Postfix via socketmap, according to domain MTA-STS policy"
HOMEPAGE="https://github.com/Snawoot/postfix-mta-sts-resolver https://pypi.org/project/postfix-mta-sts-resolver/"
SRC_URI="https://github.com/Snawoot/postfix-mta-sts-resolver/releases/download/v${PV}/${P}.tar.gz"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="uvloop sqlite redis postgres"
DOCS="README.md"
RDEPEND="
${PYTHON_DEPS}
dev-python/aiodns[${PYTHON_USEDEP}]
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
postgres? (
dev-python/asyncpg[${PYTHON_USEDEP}]
)
sqlite? (
dev-python/aiosqlite[${PYTHON_USEDEP}]
)
redis? (
dev-python/redis[${PYTHON_USEDEP}]
)
uvloop? (
dev-python/uvloop[${PYTHON_USEDEP}]
)
"
DEPEND="${RDEPEND}"
distutils_enable_tests pytest |
Haven't tested test (requires x-org which I'm not going to do on my servers) nor postgres as I don't have that running either; sqlite and redis seems to work fine with appropiate config.
I created these for running with openrc Code: | # /etc/conf.d/mta-sts
# Configuration file
MTASTS_CONFIGFILE="/etc/mta-sts-daemon.yml"
# PID file
MTASTS_PIDFILE="/run/mta-sts.pid"
# Options to mta-sts-daemon
MTASTS_OPTS="-l /var/log/mta-sts.log -v debug"
|
Code: | #!/sbin/openrc-run
# Copyright 2015-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
use net
before postfix
}
command="/usr/bin/mta-sts-daemon"
command_args="${MTASTS_OPTS} -c \"${MTASTS_CONFIGFILE}\" -p \"${MTASTS_PIDFILE}\" &"
pidfile="${MTASTS_PIDFILE}"
required_files="${MTASTS_CONFIGFILE}"
description="Postfix MTA-STS resolver" | Which *works* but I don't like the & in the init-file (mta-sts-daemon doesn't detach) - it keeps the start-stop-daemon process running |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1935
|
Posted: Wed Dec 06, 2023 3:46 pm Post subject: |
|
|
freke wrote: | Code: | #!/sbin/openrc-run
# Copyright 2015-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
use net
before postfix
}
command="/usr/bin/mta-sts-daemon"
command_args="${MTASTS_OPTS} -c \"${MTASTS_CONFIGFILE}\" -p \"${MTASTS_PIDFILE}\" &"
pidfile="${MTASTS_PIDFILE}"
required_files="${MTASTS_CONFIGFILE}"
description="Postfix MTA-STS resolver" | Which *works* but I don't like the & in the init-file (mta-sts-daemon doesn't detach) - it keeps the start-stop-daemon process running |
Instead of the &, use command_background="yes" and drop the -p option to let the supervisor control the pidfile. |
|
Back to top |
|
|
freke Veteran
Joined: 23 Jan 2003 Posts: 1033 Location: Somewhere in Denmark
|
Posted: Wed Dec 06, 2023 7:09 pm Post subject: |
|
|
grknight wrote: | Instead of the &, use command_background="yes" and drop the -p option to let the supervisor control the pidfile. |
Thanks - works like a charm |
|
Back to top |
|
|
|