From 552fc3ba95eab5c2c1a8b2b55ab432a1019739a0 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 30 Jan 2023 08:57:14 +0000 Subject: gentoo auto-resync : 30:01:2023 - 08:57:13 --- .../salt-3005.1-importlib-metadata-5-r1.patch | 29 +++++ ...salt-3005.1-modules-file-python-3.11-host.patch | 123 +++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch create mode 100644 app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch (limited to 'app-admin/salt/files') diff --git a/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch b/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch new file mode 100644 index 000000000000..c4c8056c1a6a --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch @@ -0,0 +1,29 @@ +diff --git a/salt/utils/entrypoints.py b/salt/utils/entrypoints.py +index 3effa0b494..9452878ade 100644 +--- a/salt/utils/entrypoints.py ++++ b/salt/utils/entrypoints.py +@@ -38,13 +38,20 @@ def iter_entry_points(group, name=None): + entry_points_listing = [] + entry_points = importlib_metadata.entry_points() + +- for entry_point_group, entry_points_list in entry_points.items(): +- if entry_point_group != group: +- continue +- for entry_point in entry_points_list: ++ try: ++ for entry_point in entry_points.select(group=group): + if name is not None and entry_point.name != name: + continue + entry_points_listing.append(entry_point) ++ except AttributeError: ++ # importlib-metadata<5.0.0 ++ for entry_point_group, entry_points_list in entry_points.items(): ++ if entry_point_group != group: ++ continue ++ for entry_point in entry_points_list: ++ if name is not None and entry_point.name != name: ++ continue ++ entry_points_listing.append(entry_point) + + return entry_points_listing + diff --git a/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch b/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch new file mode 100644 index 000000000000..2e9be8db18c0 --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch @@ -0,0 +1,123 @@ +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, -- cgit v1.2.3