diff options
author | Derek Kulinski <d@kulinski.us> | 2022-05-12 09:32:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 18:32:16 +0200 |
commit | 80b396fa2067a94511ffc79a67dfc6ed3eea7867 (patch) | |
tree | e1a48c369e45ae45e2b13dac7edd465e80772549 | |
parent | ad6a0e8a63e1ecc98a9fae5e8e4ba06a3a827ec2 (diff) |
salt: 3004.1 - bugfixes (#172129)
-rw-r--r-- | pkgs/tools/admin/salt/0001-Fix-Jinja2-3.1.0.patch | 38 | ||||
-rw-r--r-- | pkgs/tools/admin/salt/default.nix | 52 |
2 files changed, 71 insertions, 19 deletions
diff --git a/pkgs/tools/admin/salt/0001-Fix-Jinja2-3.1.0.patch b/pkgs/tools/admin/salt/0001-Fix-Jinja2-3.1.0.patch new file mode 100644 index 0000000000000..bdcc82c708dfa --- /dev/null +++ b/pkgs/tools/admin/salt/0001-Fix-Jinja2-3.1.0.patch @@ -0,0 +1,38 @@ +From 0a763a13ef55964395dff60283ececc16f957792 Mon Sep 17 00:00:00 2001 +From: Derek Kulinski <d@kulinski.us> +Date: Sun, 8 May 2022 01:30:39 -0700 +Subject: [PATCH] Fix Jinja2 3.1.0 + +--- + salt/utils/jinja.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/salt/utils/jinja.py b/salt/utils/jinja.py +index 0cb70bf64a..322c2f7f46 100644 +--- a/salt/utils/jinja.py ++++ b/salt/utils/jinja.py +@@ -25,10 +25,11 @@ import salt.utils.json + import salt.utils.stringutils + import salt.utils.url + import salt.utils.yaml +-from jinja2 import BaseLoader, Markup, TemplateNotFound, nodes ++from jinja2 import BaseLoader, TemplateNotFound, nodes + from jinja2.environment import TemplateModule + from jinja2.exceptions import TemplateRuntimeError + from jinja2.ext import Extension ++from markupsafe import Markup + from salt.exceptions import TemplateError + from salt.utils.decorators.jinja import jinja_filter, jinja_global, jinja_test + from salt.utils.odict import OrderedDict +@@ -706,7 +707,7 @@ def method_call(obj, f_name, *f_args, **f_kwargs): + return getattr(obj, f_name, lambda *args, **kwargs: None)(*f_args, **f_kwargs) + + +-@jinja2.contextfunction ++@jinja2.pass_context + def show_full_context(ctx): + return salt.utils.data.simple_types_filter( + {key: value for key, value in ctx.items()} +-- +2.35.1 + diff --git a/pkgs/tools/admin/salt/default.nix b/pkgs/tools/admin/salt/default.nix index 774ea6c8cfa7a..b59bc46e9c2be 100644 --- a/pkgs/tools/admin/salt/default.nix +++ b/pkgs/tools/admin/salt/default.nix @@ -6,30 +6,16 @@ , extraInputs ? [] }: -let - py = python3.override { - packageOverrides = self: super: { - # Incompatible with pyzmq 22 - pyzmq = super.pyzmq.overridePythonAttrs (oldAttrs: rec { - version = "21.0.2"; - src = oldAttrs.src.override { - inherit version; - sha256 = "CYwTxhmJE8KgaQI1+nTS5JFhdV9mtmO+rsiWUVVMx5w="; - }; - }); - }; - }; -in -py.pkgs.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "salt"; version = "3004.1"; - src = py.pkgs.fetchPypi { + src = python3.pkgs.fetchPypi { inherit pname version; hash = "sha256-fzRKJDJkik8HjapazMaNzf/hCVzqE+wh5QQTVg8Ewpg="; }; - propagatedBuildInputs = with py.pkgs; [ + propagatedBuildInputs = with python3.pkgs; [ distro jinja2 markupsafe @@ -39,18 +25,46 @@ py.pkgs.buildPythonApplication rec { pyyaml pyzmq requests - tornado ] ++ extraInputs; - patches = [ ./fix-libcrypto-loading.patch ]; + patches = [ + ./fix-libcrypto-loading.patch + + # Bug in 3004.1: https://github.com/saltstack/salt/pull/61856 + ./0001-Fix-Jinja2-3.1.0.patch + ]; postPatch = '' substituteInPlace "salt/utils/rsax931.py" \ --subst-var-by "libcrypto" "${lib.getLib openssl}/lib/libcrypto.so" substituteInPlace requirements/base.txt \ --replace contextvars "" + + # Don't require optional dependencies on Darwin, let's use + # `extraInputs` like on any other platform + echo -n > "requirements/darwin.txt" + + # Bug in 3004.1: https://github.com/saltstack/salt/pull/61839 + substituteInPlace "salt/utils/entrypoints.py" \ + --replace 'if sys.version_info >= (3, 10):' 'if False:' + + # Bug in 3004.1: https://github.com/saltstack/salt/issues/61865 + substituteInPlace "salt/transport/tcp.py" \ + --replace 'payload = self.pack_publish(package)' 'package = self.pack_publish(package)' + + # 3004.1: requirement of pyzmq was restricted to <22.0.0; looks like that req was incorrect + # https://github.com/saltstack/salt/commit/070597e525bb7d56ffadede1aede325dfb1b73a4 + # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259279 + # https://github.com/saltstack/salt/pull/61163 + substituteInPlace "requirements/zeromq.txt" \ + --replace 'pyzmq<=20.0.0 ; python_version < "3.6"' "" \ + --replace 'pyzmq>=17.0.0,<22.0.0 ; python_version < "3.9"' 'pyzmq>=17.0.0 ; python_version < "3.9"' \ + --replace 'pyzmq>19.0.2,<22.0.0 ; python_version >= "3.9"' 'pyzmq>19.0.2 ; python_version >= "3.9"' ''; + # Don't use fixed dependencies on Darwin + USE_STATIC_REQUIREMENTS = "0"; + # The tests fail due to socket path length limits at the very least; # possibly there are more issues but I didn't leave the test suite running # as is it rather long. |