forked from QubesOS/qubes-salt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debian: include backports from Fedora package
- Loading branch information
Showing
7 changed files
with
5,441 additions
and
0 deletions.
There are no files selected for viewing
516 changes: 516 additions & 0 deletions
516
debian-pkg/debian/patches/0001-Backport-locale.getdefaultlocale-into-Salt.-It-s-get.patch
Large diffs are not rendered by default.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
debian-pkg/debian/patches/0002-Hide-known-DeprecationWarning-related-to-PEP-594.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
From 9a1efaa31d8b748c29d374c1726b940e43d5d36a Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= | ||
<marmarek@invisiblethingslab.com> | ||
Date: Thu, 22 Jun 2023 00:35:15 +0200 | ||
Subject: [PATCH] Hide known DeprecationWarning related to PEP 594 | ||
|
||
The code is prepared to handle the situation where those modules will be | ||
missing (with very minor functionality loss), so do not confuse the | ||
users. | ||
--- | ||
salt/modules/linux_shadow.py | 6 +++++- | ||
salt/utils/pycrypto.py | 6 +++++- | ||
2 files changed, 10 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/salt/modules/linux_shadow.py b/salt/modules/linux_shadow.py | ||
index aa149ac4c8..6b0204b4b7 100644 | ||
--- a/salt/modules/linux_shadow.py | ||
+++ b/salt/modules/linux_shadow.py | ||
@@ -18,7 +18,11 @@ import salt.utils.files | ||
from salt.exceptions import CommandExecutionError | ||
|
||
try: | ||
- import spwd | ||
+ import warnings | ||
+ | ||
+ with warnings.catch_warnings(): | ||
+ warnings.filterwarnings("ignore",category=DeprecationWarning) | ||
+ import spwd | ||
except ImportError: | ||
pass | ||
|
||
diff --git a/salt/utils/pycrypto.py b/salt/utils/pycrypto.py | ||
index a0f3874035..ab26ed75c3 100644 | ||
--- a/salt/utils/pycrypto.py | ||
+++ b/salt/utils/pycrypto.py | ||
@@ -23,7 +23,11 @@ except ImportError: | ||
HAS_RANDOM = False | ||
|
||
try: | ||
- import crypt | ||
+ import warnings | ||
+ | ||
+ with warnings.catch_warnings(): | ||
+ warnings.filterwarnings("ignore",category=DeprecationWarning) | ||
+ import crypt | ||
|
||
HAS_CRYPT = True | ||
except (ImportError, PermissionError): | ||
-- | ||
2.39.2 | ||
|
130 changes: 130 additions & 0 deletions
130
debian-pkg/debian/patches/0003-Stop-using-the-deprecated-cgi-module.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
From 72fc1094cef37fd433d560bd094b611f38b7dd5b Mon Sep 17 00:00:00 2001 | ||
From: Pedro Algarvio <palgarvio@vmware.com> | ||
Date: Wed, 22 Feb 2023 16:08:35 +0000 | ||
Subject: [PATCH] Stop using the deprecated `cgi` module. | ||
|
||
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com> | ||
--- | ||
salt/utils/http.py | 48 ++++++++++++++++++++-------------------------- | ||
1 file changed, 21 insertions(+), 27 deletions(-) | ||
|
||
diff --git a/salt/utils/http.py b/salt/utils/http.py | ||
index 9928847ed6..53a03377df 100644 | ||
--- a/salt/utils/http.py | ||
+++ b/salt/utils/http.py | ||
@@ -5,7 +5,7 @@ and the like, but also useful for basic HTTP testing. | ||
.. versionadded:: 2015.5.0 | ||
""" | ||
|
||
-import cgi | ||
+import email.message | ||
import gzip | ||
import http.client | ||
import http.cookiejar | ||
@@ -85,7 +85,7 @@ except ImportError: | ||
HAS_CERTIFI = False | ||
|
||
log = logging.getLogger(__name__) | ||
-USERAGENT = "Salt/{}".format(salt.version.__version__) | ||
+USERAGENT = f"Salt/{salt.version.__version__}" | ||
|
||
|
||
def __decompressContent(coding, pgctnt): | ||
@@ -171,7 +171,7 @@ def query( | ||
formdata_fieldname=None, | ||
formdata_filename=None, | ||
decode_body=True, | ||
- **kwargs | ||
+ **kwargs, | ||
): | ||
""" | ||
Query a resource, and decode the return data | ||
@@ -296,7 +296,7 @@ def query( | ||
auth = (username, password) | ||
|
||
if agent == USERAGENT: | ||
- agent = "{} http.query()".format(agent) | ||
+ agent = f"{agent} http.query()" | ||
header_dict["User-agent"] = agent | ||
|
||
if backend == "requests": | ||
@@ -361,14 +361,14 @@ def query( | ||
url, | ||
params=params, | ||
files={formdata_fieldname: (formdata_filename, io.StringIO(data))}, | ||
- **req_kwargs | ||
+ **req_kwargs, | ||
) | ||
else: | ||
result = sess.request(method, url, params=params, data=data, **req_kwargs) | ||
result.raise_for_status() | ||
if stream is True: | ||
# fake a HTTP response header | ||
- header_callback("HTTP/1.0 {} MESSAGE".format(result.status_code)) | ||
+ header_callback(f"HTTP/1.0 {result.status_code} MESSAGE") | ||
# fake streaming the content | ||
streaming_callback(result.content) | ||
return { | ||
@@ -484,15 +484,12 @@ def query( | ||
result_headers = dict(result.info()) | ||
result_text = result.read() | ||
if "Content-Type" in result_headers: | ||
- res_content_type, res_params = cgi.parse_header( | ||
- result_headers["Content-Type"] | ||
- ) | ||
- if ( | ||
- res_content_type.startswith("text/") | ||
- and "charset" in res_params | ||
- and not isinstance(result_text, str) | ||
- ): | ||
- result_text = result_text.decode(res_params["charset"]) | ||
+ msg = email.message.EmailMessage() | ||
+ msg.add_header("Content-Type", result_headers["Content-Type"]) | ||
+ if msg.get_content_type().startswith("text/"): | ||
+ content_charset = msg.get_content_charset() | ||
+ if content_charset and not isinstance(result_text, str): | ||
+ result_text = result_text.decode(content_charset) | ||
if isinstance(result_text, bytes) and decode_body: | ||
result_text = result_text.decode("utf-8") | ||
ret["body"] = result_text | ||
@@ -637,15 +634,12 @@ def query( | ||
result_headers = result.headers | ||
result_text = result.body | ||
if "Content-Type" in result_headers: | ||
- res_content_type, res_params = cgi.parse_header( | ||
- result_headers["Content-Type"] | ||
- ) | ||
- if ( | ||
- res_content_type.startswith("text/") | ||
- and "charset" in res_params | ||
- and not isinstance(result_text, str) | ||
- ): | ||
- result_text = result_text.decode(res_params["charset"]) | ||
+ msg = email.message.EmailMessage() | ||
+ msg.add_header("Content-Type", result_headers["Content-Type"]) | ||
+ if msg.get_content_type().startswith("text/"): | ||
+ content_charset = msg.get_content_charset() | ||
+ if content_charset and not isinstance(result_text, str): | ||
+ result_text = result_text.decode(content_charset) | ||
if isinstance(result_text, bytes) and decode_body: | ||
result_text = result_text.decode("utf-8") | ||
ret["body"] = result_text | ||
@@ -1039,12 +1033,12 @@ def _sanitize_url_components(comp_list, field): | ||
""" | ||
if not comp_list: | ||
return "" | ||
- elif comp_list[0].startswith("{}=".format(field)): | ||
- ret = "{}=XXXXXXXXXX&".format(field) | ||
+ elif comp_list[0].startswith(f"{field}="): | ||
+ ret = f"{field}=XXXXXXXXXX&" | ||
comp_list.remove(comp_list[0]) | ||
return ret + _sanitize_url_components(comp_list, field) | ||
else: | ||
- ret = "{}&".format(comp_list[0]) | ||
+ ret = f"{comp_list[0]}&" | ||
comp_list.remove(comp_list[0]) | ||
return ret + _sanitize_url_components(comp_list, field) | ||
|
||
-- | ||
2.39.2 | ||
|
Oops, something went wrong.