[arch-commits] Commit in salt/trunk (PKGBUILD jinja-3.1.patch)

Evangelos Foutras foutrelis at gemini.archlinux.org
Tue May 24 13:19:08 UTC 2022


    Date: Tuesday, May 24, 2022 @ 13:19:08
  Author: foutrelis
Revision: 1210205

upgpkg: salt 3004.1-3: fix for jinja 3.1

Added:
  salt/trunk/jinja-3.1.patch
Modified:
  salt/trunk/PKGBUILD

-----------------+
 PKGBUILD        |    7 +++++-
 jinja-3.1.patch |   62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-05-24 12:58:52 UTC (rev 1210204)
+++ PKGBUILD	2022-05-24 13:19:08 UTC (rev 1210205)
@@ -7,7 +7,7 @@
 
 pkgname=salt
 pkgver=3004.1
-pkgrel=2
+pkgrel=3
 
 pkgdesc='Central system and configuration manager'
 arch=('any')
@@ -38,9 +38,11 @@
 
 install=salt.install
 source=("https://pypi.io/packages/source/s/salt/salt-$pkgver.tar.gz"
+        jinja-3.1.patch
         salt.logrotate)
 
 sha256sums=('7f344a2432648a4f078daa5accc68dcdffe1095cea13ec21e50413560f04c298'
+            'bfce486e45a37c6e78af545cd653f932da20c6d13c2bbbc874686924838fbcdf'
             'abecc3c1be124c4afffaaeb3ba32b60dfee8ba6dc32189edfa2ad154ecb7a215')
 
 prepare() {
@@ -47,6 +49,9 @@
   cd salt-$pkgver
   sed -i '/^contextvars/d' requirements/base.txt
 
+  # https://github.com/saltstack/salt/pull/61856
+  patch -Np1 -i ../jinja-3.1.patch
+
   # remove version requirements for pyzmq, there's no point in it
   # we only have one version and the "python_version <=> *" checks are discarded
   # so pyzmq<=20.0.0 ends up in the final requirements.txt

Added: jinja-3.1.patch
===================================================================
--- jinja-3.1.patch	                        (rev 0)
+++ jinja-3.1.patch	2022-05-24 13:19:08 UTC (rev 1210205)
@@ -0,0 +1,62 @@
+From 240e165ebcd06370a1aa47f37c6842581c82e3f8 Mon Sep 17 00:00:00 2001
+From: Megan Wilhite <mwilhite at vmware.com>
+Date: Fri, 25 Mar 2022 08:31:24 -0600
+Subject: [PATCH] Use the correct Markup from jinja for each version
+
+---
+ salt/utils/jinja.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/salt/utils/jinja.py b/salt/utils/jinja.py
+index 207a2cb77035..558f063d7206 100644
+--- a/salt/utils/jinja.py
++++ b/salt/utils/jinja.py
+@@ -26,7 +26,7 @@
+ 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
+@@ -35,6 +35,12 @@
+ from salt.utils.odict import OrderedDict
+ from salt.utils.versions import LooseVersion
+ 
++try:
++    from jinja2 import Markup
++except ImportError:
++    # Markup moved to markupsafe in jinja>= 3.1
++    from markupsafe import Markup
++
+ log = logging.getLogger(__name__)
+ 
+ __all__ = ["SaltCacheLoader", "SerializerExtension"]
+
+From 2c39d8626527d1d753f5447753855bc7e265874b Mon Sep 17 00:00:00 2001
+From: jonyhy96 <hy352144278 at gmail.com>
+Date: Thu, 10 Mar 2022 10:41:48 +0800
+Subject: [PATCH] fix: jinja2 contextfuntion base on version
+
+---
+ salt/utils/jinja.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/salt/utils/jinja.py b/salt/utils/jinja.py
+index 4c430b5ccf32..9a1938c2d69b 100644
+--- a/salt/utils/jinja.py
++++ b/salt/utils/jinja.py
+@@ -707,7 +707,11 @@ def method_call(obj, f_name, *f_args, **f_kwargs):
+     return getattr(obj, f_name, lambda *args, **kwargs: None)(*f_args, **f_kwargs)
+ 
+ 
+- at jinja2.contextfunction
++if jinja2.__version__ < '3.0.0' :
++    contextfunction = jinja2.contextfunction
++else:
++    contextfunction =  jinja2.pass_context
++ at contextfunction
+ def show_full_context(ctx):
+     return salt.utils.data.simple_types_filter(
+         {key: value for key, value in ctx.items()}



More information about the arch-commits mailing list