Merge pull request #195197 from yorickvP/upd-pypolicy

This commit is contained in:
Sandro 2022-11-21 20:06:20 +01:00 committed by GitHub
commit 16bc8a29d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 80 additions and 29 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, m4 }:
{ lib, stdenv, fetchurl, m4, fixDarwinDylibNames }:
stdenv.mkDerivation rec {
pname = "libmilter";
@ -34,7 +34,11 @@ stdenv.mkDerivation rec {
patches = [ ./install.patch ./sharedlib.patch ./glibc-2.30.patch ./darwin.patch ];
nativeBuildInputs = [ m4 ];
nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
postInstall = lib.optionalString stdenv.isDarwin ''
fixDarwinDylibNames $out/lib/libmilter.dylib.1
'';
meta = with lib; {
description = "Sendmail Milter mail filtering API library";

View File

@ -0,0 +1,40 @@
{ lib, python, buildPythonPackage, fetchFromGitHub, libmilter, bsddb3, pydns, iana-etc, libredirect }:
buildPythonPackage rec {
pname = "pymilter";
version = "1.0.5";
src = fetchFromGitHub {
owner = "sdgathman";
repo = pname;
rev = "${pname}-${version}";
hash = "sha256-gZUWEDVZfDRiOOdG3lpiQldHxm/93l8qYVOHOEpHhzQ=";
};
buildInputs = [ libmilter ];
propagatedBuildInputs = [ bsddb3 pydns ];
preBuild = ''
sed -i 's/import thread/import _thread as thread/' Milter/greylist.py
'';
# requires /etc/resolv.conf
# testpolicy: requires makemap (#100419)
# using exec -a makemap smtpctl results in "unknown group smtpq"
preCheck = ''
echo "nameserver 127.0.0.1" > resolv.conf
export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf)
export LD_PRELOAD=${libredirect}/lib/libredirect.so
sed -i '/testpolicy/d' test.py
rm testpolicy.py
'';
pythonImportsCheck = [ "Milter" ];
meta = with lib; {
homepage = "http://bmsi.com/python/milter.html";
description = "Python bindings for libmilter api";
maintainers = with maintainers; [ yorickvp ];
license = licenses.gpl2;
};
}

View File

@ -1,26 +0,0 @@
{ lib, buildPythonApplication, fetchurl, pyspf }:
buildPythonApplication rec {
pname = "pypolicyd-spf";
majorVersion = "2.0";
version = "${majorVersion}.2";
src = fetchurl {
url = "https://launchpad.net/pypolicyd-spf/${majorVersion}/${version}/+download/${pname}-${version}.tar.gz";
sha256 = "1nm8y1jjgx6mxrbcxrbdnmkf8vglwp0wiw6jipzh641wb24gi76z";
};
propagatedBuildInputs = [ pyspf ];
preBuild = ''
substituteInPlace setup.py --replace "'/etc'" "'$out/etc'"
'';
meta = with lib; {
homepage = "https://launchpad.net/pypolicyd-spf/";
description = "Postfix policy engine for Sender Policy Framework (SPF) checking";
maintainers = with maintainers; [ abbradar ];
license = licenses.asl20;
platforms = platforms.all;
};
}

View File

@ -0,0 +1,30 @@
{ lib, buildPythonApplication, fetchurl, pyspf, dnspython, authres, pymilter }:
buildPythonApplication rec {
pname = "spf-engine";
version = "2.9.3";
src = fetchurl {
url = "https://launchpad.net/${pname}/${lib.versions.majorMinor version}/${version}/+download/${pname}-${version}.tar.gz";
sha256 = "sha256-w0Nb+L/Os3KPApENoylxCVaCD4FvgmvpfVvwCkt2IDE=";
};
propagatedBuildInputs = [ pyspf dnspython authres pymilter ];
pythonImportsCheck = [
"spf_engine"
"spf_engine.milter_spf"
"spf_engine.policyd_spf"
];
postPatch = ''
substituteInPlace setup.py --replace "'/etc'" "'$out/etc'"
'';
meta = with lib; {
homepage = "https://launchpad.net/spf-engine/";
description = "Postfix policy engine for Sender Policy Framework (SPF) checking";
maintainers = with maintainers; [ abbradar ];
license = licenses.asl20;
};
}

View File

@ -1234,6 +1234,7 @@ mapAliases ({
pyload = throw "pyload has been removed from nixpkgs, as it was unmaintained"; # Added 2021-03-21
pynagsystemd = throw "pynagsystemd was removed as it was unmaintained and incompatible with recent systemd versions. Instead use its fork check_systemd"; # Added 2020-10-24
pyo3-pack = maturin;
pypolicyd-spf = spf-engine; # Added 2022-10-09
pyrex = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12
pyrex095 = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12
pyrex096 = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12

View File

@ -24383,7 +24383,7 @@ with pkgs;
pure-ftpd = callPackage ../servers/ftp/pure-ftpd { };
pypolicyd-spf = python3.pkgs.callPackage ../servers/mail/pypolicyd-spf { };
spf-engine = python3.pkgs.callPackage ../servers/mail/spf-engine { };
pypiserver = with python3Packages; toPythonApplication pypiserver;

View File

@ -8144,6 +8144,8 @@ self: super: with self; {
pymicrobot = callPackage ../development/python-modules/pymicrobot { };
pymilter = callPackage ../development/python-modules/pymilter { };
pymitv = callPackage ../development/python-modules/pymitv { };
pymfy = callPackage ../development/python-modules/pymfy { };