diff options
author | Luke Granger-Brown <git@lukegb.com> | 2023-06-25 13:37:18 +0000 |
---|---|---|
committer | Luke Granger-Brown <git@lukegb.com> | 2023-06-25 17:35:16 +0000 |
commit | 6c161ee4b9abdd5673e962b57b607f647f40ab70 (patch) | |
tree | e2a902a62e9c9efb5d7e5b621f09896326112773 /pkgs/servers/mail | |
parent | 16663f620a4f649e8ace1c1fd85458eadf487ea7 (diff) | |
download | nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar.gz nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar.bz2 nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar.lz nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar.xz nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.tar.zst nixpkgs-6c161ee4b9abdd5673e962b57b607f647f40ab70.zip |
spamassassin: enable tests
Diffstat (limited to 'pkgs/servers/mail')
-rw-r--r-- | pkgs/servers/mail/spamassassin/default.nix | 27 | ||||
-rw-r--r-- | pkgs/servers/mail/spamassassin/sa_compile-use-perl5lib.patch | 23 | ||||
-rw-r--r-- | pkgs/servers/mail/spamassassin/satest-no-clean-path.patch | 18 |
3 files changed, 66 insertions, 2 deletions
diff --git a/pkgs/servers/mail/spamassassin/default.nix b/pkgs/servers/mail/spamassassin/default.nix index 774558932c8..3fbab769fa0 100644 --- a/pkgs/servers/mail/spamassassin/default.nix +++ b/pkgs/servers/mail/spamassassin/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchurl, perlPackages, makeWrapper, gnupg, re2c, gcc, gnumake, libxcrypt }: +{ lib, fetchurl, perlPackages, makeWrapper, gnupg, re2c, gcc, gnumake, libxcrypt, coreutils, poppler_utils, tesseract, iana-etc }: perlPackages.buildPerlPackage rec { pname = "SpamAssassin"; @@ -9,6 +9,11 @@ perlPackages.buildPerlPackage rec { hash = "sha256-5aoXBQowvHK6qGr9xgSMrepNHsLsxh14dxegWbgxnog="; }; + patches = [ + ./satest-no-clean-path.patch + ./sa_compile-use-perl5lib.patch + ]; + nativeBuildInputs = [ makeWrapper ]; buildInputs = (with perlPackages; [ HTMLParser NetCIDRLite NetDNS NetAddrIP DBFile HTTPDate MailDKIM LWP @@ -24,7 +29,25 @@ perlPackages.buildPerlPackage rec { makeMakerFlags = [ "SYSCONFDIR=/etc LOCALSTATEDIR=/var/lib/spamassassin" ]; - doCheck = false; + checkInputs = (with perlPackages; [ + TextDiff # t/strip2.t + ]) ++ [ + coreutils # date, t/basic_meta.t + poppler_utils # pdftotext, t/extracttext.t + tesseract # tesseract, t/extracttext.t + iana-etc # t/dnsbl_subtests.t (/etc/protocols used by Net::DNS::Nameserver) + re2c gcc gnumake + ]; + preCheck = '' + substituteInPlace t/spamc_x_e.t \ + --replace "/bin/echo" "${coreutils}/bin/echo" + export C_INCLUDE_PATH='${lib.makeSearchPathOutput "include" "include" [ libxcrypt ]}' + export HARNESS_OPTIONS="j''${NIX_BUILD_CORES}" + + export HOME=$NIX_BUILD_TOP/home + mkdir -p $HOME + mkdir t/log # pre-create to avoid race conditions + ''; postInstall = '' mkdir -p $out/share/spamassassin diff --git a/pkgs/servers/mail/spamassassin/sa_compile-use-perl5lib.patch b/pkgs/servers/mail/spamassassin/sa_compile-use-perl5lib.patch new file mode 100644 index 00000000000..ba68142a92d --- /dev/null +++ b/pkgs/servers/mail/spamassassin/sa_compile-use-perl5lib.patch @@ -0,0 +1,23 @@ +diff -ru orig/t/sa_compile.t new/t/sa_compile.t +--- orig/t/sa_compile.t 2022-12-14 06:03:26.000000000 +0000 ++++ new/t/sa_compile.t 2023-06-25 12:30:39.735577152 +0000 +@@ -40,7 +40,7 @@ + + # we now have an "installed" version we can run sa-compile with. Ensure + # sarun() will use it appropriately +-$scr = "$instdir/$temp_binpath/spamassassin"; ++$scr = "$perl_cmd -T $instdir/$temp_binpath/spamassassin"; + $scr_localrules_args = $scr_cf_args = ""; # use the default rules dir, from our "install" + + &set_rules(' +@@ -86,8 +86,8 @@ + # ------------------------------------------------------------------- + + rmtree( glob "~/.spamassassin/sa-compile.cache". { safe => 1 }); # reset test +-system_or_die "TMP=$instdir TMPDIR=$instdir $instdir/$temp_binpath/sa-compile --quiet -p $cwd/$workdir/user.cf --keep-tmps -D 2>$instdir/sa-compile.debug"; # --debug +-$scr = "$instdir/$temp_binpath/spamassassin"; ++system_or_die "TMP=$instdir TMPDIR=$instdir $perl_cmd -T $instdir/$temp_binpath/sa-compile --quiet -p $cwd/$workdir/user.cf --keep-tmps -D 2>$instdir/sa-compile.debug"; # --debug ++$scr = "$perl_cmd -T $instdir/$temp_binpath/spamassassin"; + $scr_localrules_args = $scr_cf_args = ""; # use the default rules dir, from our "install" + + %patterns = ( diff --git a/pkgs/servers/mail/spamassassin/satest-no-clean-path.patch b/pkgs/servers/mail/spamassassin/satest-no-clean-path.patch new file mode 100644 index 00000000000..11f5c31d31e --- /dev/null +++ b/pkgs/servers/mail/spamassassin/satest-no-clean-path.patch @@ -0,0 +1,18 @@ +diff -ru orig/t/SATest.pm new/t/SATest.pm +--- orig/t/SATest.pm 2023-06-25 11:26:27.663204415 +0000 ++++ new/t/SATest.pm 2023-06-25 11:34:08.902174669 +0000 +@@ -65,9 +65,12 @@ + + # Clean PATH so taint doesn't complain + if (!$RUNNING_ON_WINDOWS) { +- $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; ++ # untaint PATH ++ $ENV{'PATH'} =~ /^(.+)$/; ++ $ENV{'PATH'} = $1; ++ # $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; + # Remove tainted envs, at least ENV used in FreeBSD +- delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; ++ # delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; + } else { + # Windows might need non-system directories in PATH to run a Perl installation + # The best we can do is clean out obviously bad stuff such as relative paths or \..\ |