diff --git a/contextvars.patch b/contextvars.patch index 380e21c..ae0cf2c 100644 --- a/contextvars.patch +++ b/contextvars.patch @@ -1,18 +1,14 @@ ---- salt-3005/requirements/base.txt.fix 2022-08-25 17:13:58.740984435 -0600 -+++ salt-3005/requirements/base.txt 2022-08-25 17:14:14.428036445 -0600 -@@ -4,5 +4,4 @@ PyYAML - MarkupSafe - requests>=1.0.0 - distro>=1.0.1 +--- salt-3006.1/requirements/base.txt~ 2023-05-05 12:53:34.000000000 -0500 ++++ salt-3006.1/requirements/base.txt 2023-05-24 09:59:08.874838801 -0500 +@@ -9,4 +9,3 @@ + packaging>=21.3 + looseversion + # We need contextvars for salt-ssh -contextvars - psutil>=5.0.0 ---- salt-3005/requirements/zeromq.txt.fix 2022-08-25 17:05:45.496349067 -0600 -+++ salt-3005/requirements/zeromq.txt 2022-08-25 17:06:19.011460188 -0600 -@@ -1,6 +1,4 @@ - -r base.txt +--- salt-3006.1/requirements/zeromq.txt~ 2023-05-05 12:53:34.000000000 -0500 ++++ salt-3006.1/requirements/zeromq.txt 2023-05-24 10:02:57.943989348 -0500 +@@ -2,4 +2,3 @@ -r crypto.txt --pyzmq<=20.0.0 ; python_version < "3.6" --pyzmq>=17.0.0 ; python_version < "3.9" --pyzmq>19.0.2 ; python_version >= "3.9" -+pyzmq>=19.0.2 + pyzmq>=20.0.0 +-pyzmq==25.0.2 ; sys_platform == "win32" diff --git a/pr62677.patch b/pr62677.patch deleted file mode 100644 index 3c63645..0000000 --- a/pr62677.patch +++ /dev/null @@ -1,236 +0,0 @@ -Author: Leif Liddy - -https://github.com/saltstack/salt/pull/62677 - -diff --git a/changelog/62676.fixed b/changelog/62676.fixed -new file mode 100644 -index 0000000000..81e96f5466 ---- /dev/null -+++ b/changelog/62676.fixed -@@ -0,0 +1 @@ -+Modified "_get_flags" function so that it returns regex flags instead of integers -diff --git a/salt/modules/file.py b/salt/modules/file.py -index f39d618203..93eeaf312e 100644 ---- a/salt/modules/file.py -+++ b/salt/modules/file.py -@@ -16,7 +16,6 @@ import hashlib - import itertools - import logging - import mmap --import operator - import os - import re - import shutil -@@ -28,7 +27,6 @@ import time - import urllib.parse - from collections import namedtuple - from collections.abc import Iterable, Mapping --from functools import reduce - - import salt.utils.args - import salt.utils.atomicfile -@@ -1622,38 +1620,38 @@ def comment_line(path, regex, char="#", cmnt=True, backup=".bak"): - - def _get_flags(flags): - """ -- Return an integer appropriate for use as a flag for the re module from a -- list of human-readable strings -+ Return the names of the Regex flags that correspond to flags - - .. code-block:: python - -- >>> _get_flags(['MULTILINE', 'IGNORECASE']) -- 10 -+ >>> _get_flags(['IGNORECASE', 'MULTILINE']) -+ re.IGNORECASE|re.MULTILINE - >>> _get_flags('MULTILINE') -- 8 -- >>> _get_flags(2) -- 2 -+ re.MULTILINE -+ >>> _get_flags(8) -+ re.MULTILINE -+ >>> _get_flags(re.IGNORECASE) -+ re.IGNORECASE - """ -- if isinstance(flags, str): -+ if isinstance(flags, re.RegexFlag): -+ return flags -+ elif isinstance(flags, int): -+ return re.RegexFlag(flags) -+ elif isinstance(flags, str): - flags = [flags] - - if isinstance(flags, Iterable) and not isinstance(flags, Mapping): -- _flags_acc = [0] # An initial 0 avoids resucing on empty list, an error -+ _flags = re.RegexFlag(0) - for flag in flags: -- _flag = getattr(re, str(flag).upper()) -- -- if not isinstance(_flag, int): -- raise SaltInvocationError("Invalid re flag given: {}".format(flag)) -- -- _flags_acc.append(_flag) -- -- return reduce(operator.__or__, _flags_acc) -- elif isinstance(flags, int): -- return flags -+ _flag = getattr(re.RegexFlag, str(flag).upper(), None) -+ if not _flag: -+ raise CommandExecutionError(f"Invalid re flag given: {flag}") -+ _flags |= _flag -+ return _flags - else: -- raise SaltInvocationError( -- 'Invalid re flags: "{}", must be given either as a single flag ' -- "string, a list of strings, or as an integer".format(flags) -+ raise CommandExecutionError( -+ f'Invalid re flags: "{flags}", must be given either as a single flag ' -+ "string, a list of strings, as an integer, or as an re flag" - ) - - -@@ -2513,8 +2511,8 @@ def replace( - "Only one of append and prepend_if_not_found is permitted" - ) - -- flags_num = _get_flags(flags) -- cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), flags_num) -+ re_flags = _get_flags(flags) -+ cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), re_flags) - filesize = os.path.getsize(path) - if bufsize == "file": - bufsize = filesize -@@ -2582,7 +2580,7 @@ def replace( - "^{}($|(?=\r\n))".format(re.escape(content)) - ), - r_data, -- flags=flags_num, -+ flags=re_flags, - ): - # Content was found, so set found. - found = True -@@ -3132,7 +3130,11 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline - salt '*' file.search /etc/crontab 'mymaintenance.sh' - """ - if multiline: -- flags = _add_flags(flags, "MULTILINE") -+ re_flags = _add_flags(flags, "MULTILINE") -+ else: -+ re_flags = _get_flags(flags) -+ -+ if re.RegexFlag.MULTILINE in re_flags: - bufsize = "file" - - # This function wraps file.replace on purpose in order to enforce -@@ -3142,7 +3144,7 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline - path, - pattern, - "", -- flags=flags, -+ flags=re_flags, - bufsize=bufsize, - dry_run=True, - search_only=True, -@@ -4597,7 +4599,7 @@ def get_managed( - skip_verify=False, - verify_ssl=True, - use_etag=False, -- **kwargs -+ **kwargs, - ): - """ - Return the managed file data for file.managed -@@ -4805,7 +4807,7 @@ def get_managed( - pillar=__pillar__, - grains=__opts__["grains"], - opts=__opts__, -- **kwargs -+ **kwargs, - ) - else: - return ( -@@ -5417,7 +5419,7 @@ def check_managed( - setype=None, - serange=None, - follow_symlinks=False, -- **kwargs -+ **kwargs, - ): - """ - Check to see what changes need to be made for a file -@@ -5458,7 +5460,7 @@ def check_managed( - context, - defaults, - skip_verify, -- **kwargs -+ **kwargs, - ) - if comments: - __clean_tmp(sfn) -@@ -5516,7 +5518,7 @@ def check_managed_changes( - serange=None, - verify_ssl=True, - follow_symlinks=False, -- **kwargs -+ **kwargs, - ): - """ - Return a dictionary of what changes need to be made for a file -@@ -5568,7 +5570,7 @@ def check_managed_changes( - defaults, - skip_verify, - verify_ssl=verify_ssl, -- **kwargs -+ **kwargs, - ) - - # Ensure that user-provided hash string is lowercase -@@ -5981,7 +5983,7 @@ def manage_file( - serange=None, - verify_ssl=True, - use_etag=False, -- **kwargs -+ **kwargs, - ): - """ - Checks the destination against what was retrieved with get_managed and -diff --git a/tests/pytests/unit/modules/file/test_file_module.py b/tests/pytests/unit/modules/file/test_file_module.py -index 299375570d..b9f6d3cbfe 100644 ---- a/tests/pytests/unit/modules/file/test_file_module.py -+++ b/tests/pytests/unit/modules/file/test_file_module.py -@@ -1,5 +1,6 @@ - import logging - import os -+import re - import shutil - import textwrap - -@@ -361,6 +362,27 @@ def test_group_to_gid_int(): - assert ret == group - - -+def test__get_flags(): -+ """ -+ Test to ensure _get_flags returns a regex flag -+ """ -+ flags = 10 -+ ret = filemod._get_flags(flags) -+ assert ret == re.IGNORECASE | re.MULTILINE -+ -+ flags = "MULTILINE" -+ ret = filemod._get_flags(flags) -+ assert ret == re.MULTILINE -+ -+ flags = ["IGNORECASE", "MULTILINE"] -+ ret = filemod._get_flags(flags) -+ assert ret == re.IGNORECASE | re.MULTILINE -+ -+ flags = re.IGNORECASE | re.MULTILINE -+ ret = filemod._get_flags(flags) -+ assert ret == re.IGNORECASE | re.MULTILINE -+ -+ - def test_patch(): - with patch("os.path.isdir", return_value=False) as mock_isdir, patch( - "salt.utils.path.which", return_value="/bin/patch" diff --git a/rel b/rel index b8626c4..d00491f 100644 --- a/rel +++ b/rel @@ -1 +1 @@ -4 +1 diff --git a/salt-3005.1.tar.gz.sha512 b/salt-3005.1.tar.gz.sha512 deleted file mode 100644 index 5b3802e..0000000 --- a/salt-3005.1.tar.gz.sha512 +++ /dev/null @@ -1 +0,0 @@ -391f995f0129f3d7104a0eea4fd83b18aa6ecae0fd7a2c77c1154e24b0bcd52cef4b63db12597c85737bb33ddf605e0c23370cef3bf47f9ea85af5b77d74dc50 diff --git a/salt-3006.1.tar.gz.sha512 b/salt-3006.1.tar.gz.sha512 new file mode 100644 index 0000000..4175dfd --- /dev/null +++ b/salt-3006.1.tar.gz.sha512 @@ -0,0 +1 @@ +edfb60c93e2c5b03e4945870bd394b70bdc7598abe12056124bbf912dc29f23e08f6ef569352e3bcdd4d96f092bb6b8ab1765d13f582ea2d3512f85a92de5e95 diff --git a/salt.spec.in b/salt.spec.in index f76f0ee..0637adc 100644 --- a/salt.spec.in +++ b/salt.spec.in @@ -40,7 +40,6 @@ Source20: %{name}-run.fish Source21: %{name}-syndic.fish Patch0: contextvars.patch -Patch1: pr62677.patch BuildArch: noarch %ifarch %{ix86} x86_64 @@ -63,13 +62,14 @@ BuildRequires: python3-devel BuildRequires: python3dist(distro) >= 1.0.1 BuildRequires: python3dist(jinja2) BuildRequires: python3dist(jmespath) +BuildRequires: python3dist(looseversion) BuildRequires: python3dist(markupsafe) -BuildRequires: python3dist(packaging) +BuildRequires: python3dist(packaging) >= 21.3 BuildRequires: python3dist(pip) >= 19 BuildRequires: python3dist(psutil) >= 5 BuildRequires: python3dist(pycryptodomex) >= 3.9.8 BuildRequires: python3dist(pyyaml) -BuildRequires: python3dist(pyzmq) >= 19.0.2 +BuildRequires: python3dist(pyzmq) >= 20 BuildRequires: python3dist(requests) >= 1 BuildRequires: python3dist(setuptools) >= 40.8 BuildRequires: python3dist(wheel) @@ -219,7 +219,7 @@ install -p -m 0644 %{SOURCE21} %{buildroot}%{fish_dir}/%{name}-syndic.fish # ZSH completion mkdir -p %{buildroot}%{zsh_dir} -install -p -m 0644 pkg/%{name}.zsh %{buildroot}%{zsh_dir}/_%{name} +install -p -m 0644 pkg/common/%{name}.zsh %{buildroot}%{zsh_dir}/_%{name} %check @@ -240,6 +240,7 @@ install -p -m 0644 pkg/%{name}.zsh %{buildroot}%{zsh_dir}/_%{name} %dir %{_sysconfdir}/%{name}/pki/ %{fish_dir}/%{name}*.fish %{zsh_dir}/_%{name} +%{_bindir}/salt-pip %files master %doc %{_mandir}/man7/%{name}.7* diff --git a/version b/version index 4a82ea8..544a534 100644 --- a/version +++ b/version @@ -1 +1 @@ -3005.1 +3006.1