Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]postfix-mta-sts-resolver-1.4.0 - ebuild
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1035
Location: Somewhere in Denmark

PostPosted: Tue Nov 28, 2023 7:03 pm    Post subject: [SOLVED]postfix-mta-sts-resolver-1.4.0 - ebuild Reply with quote

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
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1947

PostPosted: Tue Nov 28, 2023 7:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31335
Location: here

PostPosted: Tue Nov 28, 2023 7:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1035
Location: Somewhere in Denmark

PostPosted: Tue Nov 28, 2023 7:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1035
Location: Somewhere in Denmark

PostPosted: Wed Nov 29, 2023 7:19 am    Post subject: Reply with quote

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
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1035
Location: Somewhere in Denmark

PostPosted: Wed Dec 06, 2023 2:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1947

PostPosted: Wed Dec 06, 2023 3:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
freke
Veteran
Veteran


Joined: 23 Jan 2003
Posts: 1035
Location: Somewhere in Denmark

PostPosted: Wed Dec 06, 2023 7:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum