From 126f821c6e9b6b32387c111e5914d4ffdbfab6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 3 Aug 2025 03:28:25 +0200 Subject: [PATCH] Update to 3007.6 - refresh patches - apply most patches from rpm package to debian package too (especially for Python 3.13 compat - for Debian 13) - update man pages path in Debian package - consolidate 0001-Drop-versioned-dependencies.patch patch - add 0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch - verify tarball using hash file, as upstream stopped publishing tarball signatures :( QubesOS/qubes-issues#8841 --- .qubesbuilder | 7 +- 0001-Drop-versioned-dependencies.patch | 57 +++++-- 0001-Drop-versioned-requests-dependency.patch | 27 ---- ....13-compatibility-regarding-maxsplit.patch | 74 +++++++++ ...e-aware-datetime-objects-for-UTC-too.patch | 3 +- 0002-Drop-Windows-dependencies.patch | 14 +- Makefile | 4 +- contextvars.patch | 18 +-- .../0001-Drop-versioned-dependencies.patch | 50 ++++-- ....13-compatibility-regarding-maxsplit.patch | 74 +++++++++ ...e-aware-datetime-objects-for-UTC-too.patch | 147 ++++++++++++++++++ .../0002-Drop-Windows-dependencies.patch | 14 +- debian-pkg/debian/patches/contextvars.patch | 12 ++ .../patches/remove-privacy-breach.patch | 16 +- debian-pkg/debian/patches/rpmvercmp.patch | 24 +++ debian-pkg/debian/patches/series | 5 + debian-pkg/debian/patches/urllib.patch | 53 +++++++ debian-pkg/debian/salt-api.manpages | 2 +- debian-pkg/debian/salt-cloud.manpages | 2 +- debian-pkg/debian/salt-common.manpages | 4 +- debian-pkg/debian/salt-doc.manpages | 2 +- debian-pkg/debian/salt-master.manpages | 10 +- debian-pkg/debian/salt-minion.manpages | 2 +- debian-pkg/debian/salt-ssh.manpages | 2 +- debian-pkg/debian/salt-syndic.manpages | 2 +- rpmvercmp.patch | 31 +++- salt-3007.6.tar.gz.sha512 | 1 + salt.spec.in | 8 +- urllib.patch | 53 +++++++ version | 2 +- 30 files changed, 600 insertions(+), 120 deletions(-) delete mode 100644 0001-Drop-versioned-requests-dependency.patch create mode 100644 0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch create mode 100644 debian-pkg/debian/patches/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch create mode 100644 debian-pkg/debian/patches/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch create mode 100644 debian-pkg/debian/patches/contextvars.patch create mode 100644 debian-pkg/debian/patches/rpmvercmp.patch create mode 100644 debian-pkg/debian/patches/urllib.patch create mode 100644 salt-3007.6.tar.gz.sha512 create mode 100644 urllib.patch diff --git a/.qubesbuilder b/.qubesbuilder index e898686..06cae79 100644 --- a/.qubesbuilder +++ b/.qubesbuilder @@ -29,6 +29,7 @@ vm-noble: source: files: - url: https://github.com/saltstack/salt/releases/download/v@VERSION@/salt-@VERSION@.tar.gz - signature: https://github.com/saltstack/salt/releases/download/v@VERSION@/salt-@VERSION@.tar.gz.asc - pubkeys: - - SALT-PROJECT-GPG-PUBKEY-2023.pub + sha512: salt-@VERSION@.tar.gz.sha512 +# signature: https://github.com/saltstack/salt/releases/download/v@VERSION@/salt-@VERSION@.tar.gz.asc +# pubkeys: +# - SALT-PROJECT-GPG-PUBKEY-2023.pub diff --git a/0001-Drop-versioned-dependencies.patch b/0001-Drop-versioned-dependencies.patch index 4cac27a..d795e3b 100644 --- a/0001-Drop-versioned-dependencies.patch +++ b/0001-Drop-versioned-dependencies.patch @@ -7,6 +7,8 @@ Subject: [PATCH 1/2] Drop versioned dependencies Upstream bumps version requirements arbitrarily, in most cases without any specific API or functional requirement. Use package version available in the distribution instead. + +And also cryptography was twice. --- requirements/base.txt | 12 ++++++------ requirements/zeromq.txt | 3 +-- @@ -16,18 +18,36 @@ diff --git a/requirements/base.txt b/requirements/base.txt index 0061087e35..a42ff50f7d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt -@@ -10,20 +10,20 @@ distro>=1.0.1 - psutil>=5.0.0 - packaging>=21.3 +@@ -1,34 +1,32 @@ + --constraint=constraints.txt + +-Jinja2>=3.1.5 ++Jinja2 + jmespath + msgpack>=1.0.0 + PyYAML + MarkupSafe +-requests<2.32.0 ; python_version < '3.10' +-requests>=2.32.3 ; python_version >= '3.10' ++requests +-certifi==2023.07.22; python_version < '3.10' +-certifi>=2024.7.4; python_version >= '3.10' ++certifi + distro>=1.0.1 + psutil<6.0.0; python_version <= '3.9' + psutil>=5.0.0; python_version >= '3.10' + # Packaging 24.1 imports annotations from __future__ which breaks salt ssh + # tests on target hosts with older python versions. +-packaging==24.0 ++packaging>=21.3 looseversion --tornado>=6.3.3 +-tornado>=6.4.1 -aiohttp>=3.9.0 +tornado +aiohttp - - # We need contextvars for salt-ssh. - # Even on python versions which ships with contextvars in the standard library! - + + croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' + setproctitle>=1.2.3 -timelib>=0.2.5 -pyopenssl>=24.0.0 @@ -39,9 +59,23 @@ index 0061087e35..a42ff50f7d 100644 importlib-metadata>=3.3.0 -cryptography>=42.0.0 +cryptography + + # From old windows.txt requirements file + gitpython>=3.1.37; sys_platform == 'win32' +@@ -44,10 +43,7 @@ - # From old requirements/static/pkg/linux.in - rpm-vercmp; sys_platform == 'linux' + # We need contextvars for salt-ssh + +-cryptography>=42.0.0 ++urllib3 + +-urllib3>=1.26.20,<2.0.0; python_version < '3.10' +-urllib3>=2.5.0; python_version >= '3.10' +- +-jaraco.text>=4.0.0 +-jaraco.functools>=4.1.0 ++jaraco.text ++jaraco.functools diff --git a/requirements/zeromq.txt b/requirements/zeromq.txt index 4000f5eb01..ec03558d33 100644 --- a/requirements/zeromq.txt @@ -50,8 +84,7 @@ index 4000f5eb01..ec03558d33 100644 -r base.txt -r crypto.txt --pyzmq>=25.1.1 +-pyzmq>=25.1.2 +pyzmq -- 2.46.0 - diff --git a/0001-Drop-versioned-requests-dependency.patch b/0001-Drop-versioned-requests-dependency.patch deleted file mode 100644 index c2b3956..0000000 --- a/0001-Drop-versioned-requests-dependency.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 668a5a89109526e39540174b4a8a56574d0d09bd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Thu, 15 Aug 2024 03:46:12 +0200 -Subject: [PATCH] Drop versioned requests dependency - -Let it pick the version from the distribution. ---- - requirements/base.txt | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/requirements/base.txt b/requirements/base.txt -index de9cbaab17..bce14bc510 100644 ---- a/requirements/base.txt -+++ b/requirements/base.txt -@@ -7,7 +7,7 @@ PyYAML - msgpack>=1.0.0 - PyYAML - MarkupSafe --requests>=2.25.1 -+requests - distro>=1.0.1 - psutil>=5.0.0 - packaging>=21.3 --- -2.45.2 - diff --git a/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch b/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch new file mode 100644 index 0000000..2a844b9 --- /dev/null +++ b/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch @@ -0,0 +1,74 @@ +--- a/salt/client/ssh/__init__.py 2025-08-03 02:14:39.661813905 +0200 ++++ b/salt/client/ssh/__init__.py 2025-08-03 02:14:41.471814027 +0200 +@@ -1566,9 +1566,9 @@ ARGS = {arguments}\n'''.format( + saltwinshell.deploy_python(self) + stdout, stderr, retcode = self.shim_cmd(cmd_str) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + elif error == "Undefined SHIM state": + self.deploy() + stdout, stderr, retcode = self.shim_cmd(cmd_str) +@@ -1583,27 +1583,27 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + else: + return f"ERROR: {error}", stderr, retcode + + # FIXME: this discards output from ssh_shim if the shim succeeds. It should + # always save the shim output regardless of shim success or failure. + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + + if re.search(RSTR_RE, stderr): + # Found RSTR in stderr which means SHIM completed and only + # and remaining output is only from salt. + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + + else: + # RSTR was found in stdout but not stderr - which means there + # is a SHIM command for the master. +- shim_command = re.split(r"\r?\n", stdout, 1)[0].strip() ++ shim_command = re.split(r"\r?\n", stdout, maxsplit=1)[0].strip() + log.debug("SHIM retcode(%s) and command: %s", retcode, shim_command) + if ( + "deploy" == shim_command +@@ -1634,12 +1634,12 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + if self.tty: + stderr = "" + else: + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + elif "ext_mods" == shim_command: + self.deploy_ext() + stdout, stderr, retcode = self.shim_cmd(cmd_str) +@@ -1652,9 +1652,9 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + + return stdout, stderr, retcode + diff --git a/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch b/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch index 313db0b..a43a1c4 100644 --- a/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch +++ b/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch @@ -56,7 +56,7 @@ index b5006807ea..7446a5739a 100644 delta = utc_finish_time - utc_start_time # duration in milliseconds.microseconds @@ -2152,7 +2150,7 @@ class State: - instance = cls(**init_kwargs) + instance.states.inject_globals = inject_globals # we need to re-record start/end duration here because it is impossible to # correctly calculate further down the chain - utc_start_time = datetime.datetime.utcnow() @@ -144,4 +144,3 @@ index 7574a068e8..d8f7d20b06 100644 else: -- 2.45.2 - diff --git a/0002-Drop-Windows-dependencies.patch b/0002-Drop-Windows-dependencies.patch index 7c3ab18..74ad9af 100644 --- a/0002-Drop-Windows-dependencies.patch +++ b/0002-Drop-Windows-dependencies.patch @@ -12,20 +12,24 @@ diff --git a/requirements/base.txt b/requirements/base.txt index a42ff50f7d..73f058c5ff 100644 --- a/requirements/base.txt +++ b/requirements/base.txt -@@ -33,13 +33,3 @@ cryptography - - # From old requirements/static/pkg/linux.in - rpm-vercmp; sys_platform == 'linux' +@@ -33,17 +33,6 @@ cryptography + cherrypy>=18.6.1 + importlib-metadata>=3.3.0 + cryptography - -# From old windows.txt requirements file -gitpython>=3.1.37; sys_platform == 'win32' -lxml>=4.6.3; sys_platform == 'win32' --pymssql>=2.2.1; sys_platform == 'win32' +-pymssql>=2.2.11; sys_platform == 'win32' -pymysql>=1.0.2; sys_platform == 'win32' -pythonnet>=3.0.1; sys_platform == 'win32' -pywin32>=305; sys_platform == 'win32' -wmi>=1.5.1; sys_platform == 'win32' -xmltodict>=0.13.0; sys_platform == 'win32' +-croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' + + # We need contextvars for salt-ssh + -- 2.46.0 diff --git a/Makefile b/Makefile index f8841ee..a7d7206 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,8 @@ keyring-import := gpg -q --no-auto-check-trustdb --no-default-keyring --import $(keyring-file): SALT-PROJECT-GPG-PUBKEY-2023.pub @rm -f $(keyring-file) && $(keyring-import) --keyring $(keyring) $^ -salt-%.tar.gz.asc: - @$(FETCH_CMD) $@ $(filter %/$(patsubst %.asc,%,$@),$(SRC_URLS)).asc +#salt-%.tar.gz.asc: +# @$(FETCH_CMD) $@ $(filter %/$(patsubst %.asc,%,$@),$(SRC_URLS)).asc %: %.asc $(keyring-file) @$(FETCH_CMD) $@$(UNTRUSTED_SUFF) $(filter %/$@,$(SRC_URLS)) diff --git a/contextvars.patch b/contextvars.patch index d9cf838..45175ec 100644 --- a/contextvars.patch +++ b/contextvars.patch @@ -2,21 +2,11 @@ Index: salt-3007.1/requirements/base.txt =================================================================== --- salt-3007.1.orig/requirements/base.txt 2024-11-06 20:25:51.898374912 +0100 +++ salt-3007.1/requirements/base.txt 2024-11-06 20:26:23.586354279 +0100 -@@ -15,7 +15,6 @@ aiohttp>=3.9.0 +@@ -45,7 +45,6 @@ aiohttp>=3.9.0 + croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' - # We need contextvars for salt-ssh. - # Even on python versions which ships with contextvars in the standard library! + # We need contextvars for salt-ssh -contextvars - setproctitle>=1.2.3 - timelib>=0.2.5 -Index: salt-3007.1/requirements/zeromq.txt -=================================================================== ---- salt-3007.1.orig/requirements/zeromq.txt 2024-11-06 20:25:51.899374912 +0100 -+++ salt-3007.1/requirements/zeromq.txt 2024-11-06 20:27:44.898301325 +0100 -@@ -1,4 +1,4 @@ - -r base.txt - -r crypto.txt + cryptography>=42.0.0 --pyzmq>=25.1.2 -+pyzmq>=25.1.1 diff --git a/debian-pkg/debian/patches/0001-Drop-versioned-dependencies.patch b/debian-pkg/debian/patches/0001-Drop-versioned-dependencies.patch index 1a6c7d4..6ed1cf3 100644 --- a/debian-pkg/debian/patches/0001-Drop-versioned-dependencies.patch +++ b/debian-pkg/debian/patches/0001-Drop-versioned-dependencies.patch @@ -7,6 +7,8 @@ Subject: [PATCH 1/2] Drop versioned dependencies Upstream bumps version requirements arbitrarily, in most cases without any specific API or functional requirement. Use package version available in the distribution instead. + +And also cryptography was twice. --- requirements/base.txt | 12 ++++++------ requirements/zeromq.txt | 3 +-- @@ -16,19 +18,30 @@ diff --git a/requirements/base.txt b/requirements/base.txt index 0061087e35..a42ff50f7d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt -@@ -10,21 +10,21 @@ distro>=1.0.1 - psutil>=5.0.0 - packaging>=21.3 +@@ -7,29 +7,27 @@ + PyYAML + MarkupSafe +-requests<2.32.0 ; python_version < '3.10' +-requests>=2.32.3 ; python_version >= '3.10' ++requests +-certifi==2023.07.22; python_version < '3.10' +-certifi>=2024.7.4; python_version >= '3.10' ++certifi + distro>=1.0.1 + psutil<6.0.0; python_version <= '3.9' + psutil>=5.0.0; python_version >= '3.10' + # Packaging 24.1 imports annotations from __future__ which breaks salt ssh + # tests on target hosts with older python versions. +-packaging==24.0 ++packaging>=21.3 looseversion --tornado>=6.3.3 +-tornado>=6.4.1 -aiohttp>=3.9.0 +tornado +aiohttp - - # We need contextvars for salt-ssh. - # Even on python versions which ships with contextvars in the standard library! - contextvars - + + croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' + setproctitle>=1.2.3 -timelib>=0.2.5 -pyopenssl>=24.0.0 @@ -40,9 +53,23 @@ index 0061087e35..a42ff50f7d 100644 importlib-metadata>=3.3.0 -cryptography>=42.0.0 +cryptography + + # From old windows.txt requirements file + gitpython>=3.1.37; sys_platform == 'win32' +@@ -44,10 +43,7 @@ - # From old requirements/static/pkg/linux.in - rpm-vercmp; sys_platform == 'linux' + # We need contextvars for salt-ssh + +-cryptography>=42.0.0 ++urllib3 + +-urllib3>=1.26.20,<2.0.0; python_version < '3.10' +-urllib3>=2.5.0; python_version >= '3.10' +- +-jaraco.text>=4.0.0 +-jaraco.functools>=4.1.0 ++jaraco.text ++jaraco.functools diff --git a/requirements/zeromq.txt b/requirements/zeromq.txt index 4000f5eb01..ec03558d33 100644 --- a/requirements/zeromq.txt @@ -55,4 +82,3 @@ index 4000f5eb01..ec03558d33 100644 +pyzmq -- 2.46.0 - diff --git a/debian-pkg/debian/patches/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch b/debian-pkg/debian/patches/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch new file mode 100644 index 0000000..2a844b9 --- /dev/null +++ b/debian-pkg/debian/patches/0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch @@ -0,0 +1,74 @@ +--- a/salt/client/ssh/__init__.py 2025-08-03 02:14:39.661813905 +0200 ++++ b/salt/client/ssh/__init__.py 2025-08-03 02:14:41.471814027 +0200 +@@ -1566,9 +1566,9 @@ ARGS = {arguments}\n'''.format( + saltwinshell.deploy_python(self) + stdout, stderr, retcode = self.shim_cmd(cmd_str) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + elif error == "Undefined SHIM state": + self.deploy() + stdout, stderr, retcode = self.shim_cmd(cmd_str) +@@ -1583,27 +1583,27 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + else: + return f"ERROR: {error}", stderr, retcode + + # FIXME: this discards output from ssh_shim if the shim succeeds. It should + # always save the shim output regardless of shim success or failure. + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + + if re.search(RSTR_RE, stderr): + # Found RSTR in stderr which means SHIM completed and only + # and remaining output is only from salt. + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + + else: + # RSTR was found in stdout but not stderr - which means there + # is a SHIM command for the master. +- shim_command = re.split(r"\r?\n", stdout, 1)[0].strip() ++ shim_command = re.split(r"\r?\n", stdout, maxsplit=1)[0].strip() + log.debug("SHIM retcode(%s) and command: %s", retcode, shim_command) + if ( + "deploy" == shim_command +@@ -1634,12 +1634,12 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + if self.tty: + stderr = "" + else: + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + elif "ext_mods" == shim_command: + self.deploy_ext() + stdout, stderr, retcode = self.shim_cmd(cmd_str) +@@ -1652,9 +1652,9 @@ ARGS = {arguments}\n'''.format( + retcode, + ) + while re.search(RSTR_RE, stdout): +- stdout = re.split(RSTR_RE, stdout, 1)[1].strip() ++ stdout = re.split(RSTR_RE, stdout, maxsplit=1)[1].strip() + while re.search(RSTR_RE, stderr): +- stderr = re.split(RSTR_RE, stderr, 1)[1].strip() ++ stderr = re.split(RSTR_RE, stderr, maxsplit=1)[1].strip() + + return stdout, stderr, retcode + diff --git a/debian-pkg/debian/patches/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch b/debian-pkg/debian/patches/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch new file mode 100644 index 0000000..ceb56dd --- /dev/null +++ b/debian-pkg/debian/patches/0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch @@ -0,0 +1,147 @@ +From 4e015640d283ced576bd59925f9a81b2901c860c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Thu, 15 Aug 2024 14:57:01 +0200 +Subject: [PATCH] Use timezone-aware datetime objects, for UTC too + +datetime.datetime.utcnow() is deprecated in Python 3.12, and it's +recommended to switch to timezone-aware objects, so do this. It also +simplifies local time handling, as .astimezone() method can be used +instead of calculating timezone_delta manually. + +Part of #65604 +--- + salt/grains/core.py | 4 ++-- + salt/state.py | 34 ++++++++++++++-------------------- + salt/utils/jid.py | 2 +- + salt/utils/pkg/rpm.py | 2 +- + 4 files changed, 18 insertions(+), 24 deletions(-) + +diff --git a/salt/grains/core.py b/salt/grains/core.py +index 529c3dff2f..e7709fb703 100644 +--- a/salt/grains/core.py ++++ b/salt/grains/core.py +@@ -2905,12 +2905,12 @@ def ip_fqdn(): + if not ret["ipv" + ipv_num]: + ret[key] = [] + else: +- start_time = datetime.datetime.utcnow() ++ start_time = datetime.datetime.now(tz=datetime.timezone.utc) + try: + info = socket.getaddrinfo(_fqdn, None, socket_type) + ret[key] = list({item[4][0] for item in info}) + except (OSError, UnicodeError): +- timediff = datetime.datetime.utcnow() - start_time ++ timediff = datetime.datetime.now(tz=datetime.timezone.utc) - start_time + if timediff.seconds > 5 and __opts__["__role"] == "master": + log.warning( + 'Unable to find IPv%s record for "%s" causing a %s ' +diff --git a/salt/state.py b/salt/state.py +index b5006807ea..7446a5739a 100644 +--- a/salt/state.py ++++ b/salt/state.py +@@ -171,11 +171,9 @@ def _calculate_fake_duration(): + Generate a NULL duration for when states do not run + but we want the results to be consistent. + """ +- utc_start_time = datetime.datetime.utcnow() +- local_start_time = utc_start_time - ( +- datetime.datetime.utcnow() - datetime.datetime.now() +- ) +- utc_finish_time = datetime.datetime.utcnow() ++ utc_start_time = datetime.datetime.now(tz=datetime.timezone.utc) ++ local_start_time = utc_start_time.astimezone() ++ utc_finish_time = datetime.datetime.now(tz=datetime.timezone.utc) + start_time = local_start_time.time().isoformat() + delta = utc_finish_time - utc_start_time + # duration in milliseconds.microseconds +@@ -2152,7 +2150,7 @@ class State: + instance.states.inject_globals = inject_globals + # we need to re-record start/end duration here because it is impossible to + # correctly calculate further down the chain +- utc_start_time = datetime.datetime.utcnow() ++ utc_start_time = datetime.datetime.now(tz=datetime.zoneinfo.utc) + + instance.format_slots(cdata) + tag = _gen_tag(low) +@@ -2172,10 +2170,9 @@ class State: + "comment": f"An exception occurred in this state: {trb}", + } + +- utc_finish_time = datetime.datetime.utcnow() +- timezone_delta = datetime.datetime.utcnow() - datetime.datetime.now() +- local_finish_time = utc_finish_time - timezone_delta +- local_start_time = utc_start_time - timezone_delta ++ utc_finish_time = datetime.datetime.now(tz=datetime.zoneinfo.utc) ++ local_finish_time = utc_finish_time.astimezone() ++ local_start_time = utc_start_time.astimezone() + ret["start_time"] = local_start_time.time().isoformat() + delta = utc_finish_time - utc_start_time + # duration in milliseconds.microseconds +@@ -2205,8 +2202,8 @@ class State: + *cdata["args"], **cdata["kwargs"] + ) + +- utc_start_time = datetime.datetime.utcnow() +- utc_finish_time = datetime.datetime.utcnow() ++ utc_start_time = datetime.datetime.now(tz=datetime.timezone.utc) ++ utc_finish_time = datetime.datetime.now(tz=datetime.timezone.utc) + delta = utc_finish_time - utc_start_time + duration = (delta.seconds * 1000000 + delta.microseconds) / 1000.0 + retry_ret["duration"] = duration +@@ -2293,10 +2290,8 @@ class State: + Call a state directly with the low data structure, verify data + before processing. + """ +- utc_start_time = datetime.datetime.utcnow() +- local_start_time = utc_start_time - ( +- datetime.datetime.utcnow() - datetime.datetime.now() +- ) ++ utc_start_time = datetime.datetime.now(tz=datetime.timezone.utc) ++ local_start_time = utc_start_time.astimezone() + log.info( + "Running state [%s] at time %s", + low["name"].strip() if isinstance(low["name"], str) else low["name"], +@@ -2485,10 +2480,9 @@ class State: + self.__run_num += 1 + format_log(ret) + self.check_refresh(low, ret) +- utc_finish_time = datetime.datetime.utcnow() +- timezone_delta = datetime.datetime.utcnow() - datetime.datetime.now() +- local_finish_time = utc_finish_time - timezone_delta +- local_start_time = utc_start_time - timezone_delta ++ utc_finish_time = datetime.datetime.now(tz=datetime.timezone.utc) ++ local_finish_time = utc_finish_time.astimezone() ++ local_start_time = utc_start_time.astimezone() + ret["start_time"] = local_start_time.time().isoformat() + delta = utc_finish_time - utc_start_time + # duration in milliseconds.microseconds +diff --git a/salt/utils/jid.py b/salt/utils/jid.py +index 69d926469b..84f5b3c4a3 100644 +--- a/salt/utils/jid.py ++++ b/salt/utils/jid.py +@@ -16,7 +16,7 @@ def _utc_now(): + """ + Helper method so tests do not have to patch the built-in method. + """ +- return datetime.datetime.utcnow() ++ return datetime.datetime.now(tz=datetime.timezone.utc) + + + def gen_jid(opts): +diff --git a/salt/utils/pkg/rpm.py b/salt/utils/pkg/rpm.py +index 7574a068e8..d8f7d20b06 100644 +--- a/salt/utils/pkg/rpm.py ++++ b/salt/utils/pkg/rpm.py +@@ -130,7 +130,7 @@ def parse_pkginfo(line, osarch=None): + + if install_time not in ("(none)", "0"): + install_date = ( +- datetime.datetime.utcfromtimestamp(int(install_time)).isoformat() + "Z" ++ datetime.datetime.fromtimestamp(int(install_time), datetime.UTC).isoformat() + "Z" + ) + install_date_time_t = int(install_time) + else: +-- +2.45.2 + diff --git a/debian-pkg/debian/patches/0002-Drop-Windows-dependencies.patch b/debian-pkg/debian/patches/0002-Drop-Windows-dependencies.patch index 7c3ab18..74ad9af 100644 --- a/debian-pkg/debian/patches/0002-Drop-Windows-dependencies.patch +++ b/debian-pkg/debian/patches/0002-Drop-Windows-dependencies.patch @@ -12,20 +12,24 @@ diff --git a/requirements/base.txt b/requirements/base.txt index a42ff50f7d..73f058c5ff 100644 --- a/requirements/base.txt +++ b/requirements/base.txt -@@ -33,13 +33,3 @@ cryptography - - # From old requirements/static/pkg/linux.in - rpm-vercmp; sys_platform == 'linux' +@@ -33,17 +33,6 @@ cryptography + cherrypy>=18.6.1 + importlib-metadata>=3.3.0 + cryptography - -# From old windows.txt requirements file -gitpython>=3.1.37; sys_platform == 'win32' -lxml>=4.6.3; sys_platform == 'win32' --pymssql>=2.2.1; sys_platform == 'win32' +-pymssql>=2.2.11; sys_platform == 'win32' -pymysql>=1.0.2; sys_platform == 'win32' -pythonnet>=3.0.1; sys_platform == 'win32' -pywin32>=305; sys_platform == 'win32' -wmi>=1.5.1; sys_platform == 'win32' -xmltodict>=0.13.0; sys_platform == 'win32' +-croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' + + # We need contextvars for salt-ssh + -- 2.46.0 diff --git a/debian-pkg/debian/patches/contextvars.patch b/debian-pkg/debian/patches/contextvars.patch new file mode 100644 index 0000000..45175ec --- /dev/null +++ b/debian-pkg/debian/patches/contextvars.patch @@ -0,0 +1,12 @@ +Index: salt-3007.1/requirements/base.txt +=================================================================== +--- salt-3007.1.orig/requirements/base.txt 2024-11-06 20:25:51.898374912 +0100 ++++ salt-3007.1/requirements/base.txt 2024-11-06 20:26:23.586354279 +0100 +@@ -45,7 +45,6 @@ aiohttp>=3.9.0 + croniter>=0.3.0,!=0.3.22; sys_platform != 'win32' + + # We need contextvars for salt-ssh +-contextvars + + cryptography>=42.0.0 + diff --git a/debian-pkg/debian/patches/remove-privacy-breach.patch b/debian-pkg/debian/patches/remove-privacy-breach.patch index e47a344..2ad0c21 100644 --- a/debian-pkg/debian/patches/remove-privacy-breach.patch +++ b/debian-pkg/debian/patches/remove-privacy-breach.patch @@ -14,7 +14,7 @@ diff --git a/README.rst b/README.rst index 4fbd92b..06deb7b 100644 --- a/README.rst +++ b/README.rst -@@ -1,38 +1,3 @@ +@@ -1,30 +1,3 @@ -.. image:: https://img.shields.io/github/license/saltstack/salt - :alt: Salt Project License: Apache v2.0 - :target: https://github.com/saltstack/salt/blob/master/LICENSE @@ -23,17 +23,9 @@ index 4fbd92b..06deb7b 100644 - :alt: PyPi Package Downloads - :target: https://pypi.org/project/salt - --.. image:: https://img.shields.io/lgtm/grade/python/github/saltstack/salt -- :alt: PyPi Package Downloads -- :target: https://lgtm.com/projects/g/saltstack/salt/context:python -- --.. image:: https://img.shields.io/badge/slack-SaltProject-blue.svg?logo=slack -- :alt: Salt Project Slack Community -- :target: https://via.vmw.com/salt-slack -- --.. image:: https://img.shields.io/twitch/status/saltprojectoss -- :alt: Salt Project Twitch Channel -- :target: https://www.twitch.tv/saltprojectoss +-.. image:: https://img.shields.io/badge/discord-SaltProject-blue.svg?logo=discord +- :alt: Salt Project Discord Community +- :target: https://discord.com/invite/J7b7EscrAs - -.. image:: https://img.shields.io/reddit/subreddit-subscribers/saltstack?style=social - :alt: Salt Project subreddit diff --git a/debian-pkg/debian/patches/rpmvercmp.patch b/debian-pkg/debian/patches/rpmvercmp.patch new file mode 100644 index 0000000..a872b77 --- /dev/null +++ b/debian-pkg/debian/patches/rpmvercmp.patch @@ -0,0 +1,24 @@ +From cdc4bc6fa37e3d5173b3cad3d0f2e2d9816f8eb1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Sun, 15 Dec 2024 16:13:42 +0100 +Subject: [PATCH] Drop rpm-vercmp requirement + +It's a cmdline tool, part of rpmdevtools, not a python package. +--- +diff --git a/requirements/base.txt b/requirements/base.txt +index 0061087e35..a42ff50f7d 100644 +--- a/requirements/base.txt ++++ b/requirements/base.txt +@@ -28,9 +28,6 @@ + cherrypy>=18.6.1 + importlib-metadata>=3.3.0 + cryptography>=42.0.0 +- +-# From old requirements/static/pkg/linux.in +-rpm-vercmp; sys_platform == 'linux' + + # From old windows.txt requirements file + gitpython>=3.1.37; sys_platform == 'win32' +-- +2.46.0 diff --git a/debian-pkg/debian/patches/series b/debian-pkg/debian/patches/series index d91e7d3..dafb10b 100644 --- a/debian-pkg/debian/patches/series +++ b/debian-pkg/debian/patches/series @@ -7,5 +7,10 @@ ensure-searchtools.js-gets-included.patch dpkg_lowpkg-Do-not-access-var-lib-dpkg-info-package-.patch dpkg_lowpkg-Drop-reading-var-lib-dpkg-available-dire.patch 0002-Hide-known-DeprecationWarning-related-to-PEP-594.patch +contextvars.patch +rpmvercmp.patch 0001-Drop-versioned-dependencies.patch 0002-Drop-Windows-dependencies.patch +0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch +0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch +urllib.patch diff --git a/debian-pkg/debian/patches/urllib.patch b/debian-pkg/debian/patches/urllib.patch new file mode 100644 index 0000000..a72b5df --- /dev/null +++ b/debian-pkg/debian/patches/urllib.patch @@ -0,0 +1,53 @@ +From 0f69a5a227bfba6ced8a3826d69d556967967fcc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Wed, 18 Sep 2024 04:54:24 +0200 +Subject: [PATCH] Fix Python3.13 compatibility regarding urllib.parse module + +Python 3.13 fixed handling relative paths in urllib.parse module. +Specifically, relative file URL is now constructed as file:path instead +of converting it to absolute file:///path. This breaks +salt.utils.url.create which expects file:/// specifically. The mismatch +results in for example changing salt://top.sls into salt://.sls and thus +not finding the top file. + +Fix this by handling both prefixes. + +Relevant python change: https://github.com/python/cpython/issues/85110 +Fixes: #66898 +--- + changelog/66898.fixed.md | 1 + + salt/utils/url.py | 5 ++--- + 2 files changed, 3 insertions(+), 3 deletions(-) + create mode 100644 changelog/66898.fixed.md + +diff --git a/changelog/66898.fixed.md b/changelog/66898.fixed.md +new file mode 100644 +index 000000000000..2549d5e00ed1 +--- /dev/null ++++ b/changelog/66898.fixed.md +@@ -0,0 +1 @@ ++Fixed Python 3.13 compatibility regarding urllib.parse module +diff --git a/salt/utils/url.py b/salt/utils/url.py +index 478d8e911c2b..839db611c972 100644 +--- a/salt/utils/url.py ++++ b/salt/utils/url.py +@@ -4,7 +4,7 @@ + + import re + import sys +-from urllib.parse import urlparse, urlunparse ++from urllib.parse import urlparse, urlunparse, urlunsplit + + import salt.utils.data + import salt.utils.path +@@ -46,8 +46,7 @@ def create(path, saltenv=None): + path = salt.utils.data.decode(path) + + query = f"saltenv={saltenv}" if saltenv else "" +- url = salt.utils.data.decode(urlunparse(("file", "", path, "", query, ""))) +- return "salt://{}".format(url[len("file:///") :]) ++ return f'salt://{salt.utils.data.decode(urlunsplit(("", "", path, query, "")))}' + + + def is_escaped(url): diff --git a/debian-pkg/debian/salt-api.manpages b/debian-pkg/debian/salt-api.manpages index f0e26e0..38f98d6 100644 --- a/debian-pkg/debian/salt-api.manpages +++ b/debian-pkg/debian/salt-api.manpages @@ -1 +1 @@ -doc/_build/man/salt-api.1 +doc/man/salt-api.1 diff --git a/debian-pkg/debian/salt-cloud.manpages b/debian-pkg/debian/salt-cloud.manpages index ef5ae18..d2a06a3 100644 --- a/debian-pkg/debian/salt-cloud.manpages +++ b/debian-pkg/debian/salt-cloud.manpages @@ -1 +1 @@ -doc/_build/man/salt-cloud.1 +doc/man/salt-cloud.1 diff --git a/debian-pkg/debian/salt-common.manpages b/debian-pkg/debian/salt-common.manpages index 3148c78..32e5ba9 100644 --- a/debian-pkg/debian/salt-common.manpages +++ b/debian-pkg/debian/salt-common.manpages @@ -1,2 +1,2 @@ -doc/_build/man/salt-call.1 -doc/_build/man/spm.1 +doc/man/salt-call.1 +doc/man/spm.1 diff --git a/debian-pkg/debian/salt-doc.manpages b/debian-pkg/debian/salt-doc.manpages index 2a39714..ce2ea17 100644 --- a/debian-pkg/debian/salt-doc.manpages +++ b/debian-pkg/debian/salt-doc.manpages @@ -1 +1 @@ -doc/_build/man/salt.7 +doc/man/salt.7 diff --git a/debian-pkg/debian/salt-master.manpages b/debian-pkg/debian/salt-master.manpages index c8d2642..79e9cb2 100644 --- a/debian-pkg/debian/salt-master.manpages +++ b/debian-pkg/debian/salt-master.manpages @@ -1,5 +1,5 @@ -doc/_build/man/salt-cp.1 -doc/_build/man/salt-key.1 -doc/_build/man/salt-master.1 -doc/_build/man/salt-run.1 -doc/_build/man/salt.1 +doc/man/salt-cp.1 +doc/man/salt-key.1 +doc/man/salt-master.1 +doc/man/salt-run.1 +doc/man/salt.1 diff --git a/debian-pkg/debian/salt-minion.manpages b/debian-pkg/debian/salt-minion.manpages index 8de9da8..f16e1a4 100644 --- a/debian-pkg/debian/salt-minion.manpages +++ b/debian-pkg/debian/salt-minion.manpages @@ -1 +1 @@ -doc/_build/man/salt-minion.1 +doc/man/salt-minion.1 diff --git a/debian-pkg/debian/salt-ssh.manpages b/debian-pkg/debian/salt-ssh.manpages index 8a62d0a..a6dd51e 100644 --- a/debian-pkg/debian/salt-ssh.manpages +++ b/debian-pkg/debian/salt-ssh.manpages @@ -1 +1 @@ -doc/_build/man/salt-ssh.1 +doc/man/salt-ssh.1 diff --git a/debian-pkg/debian/salt-syndic.manpages b/debian-pkg/debian/salt-syndic.manpages index 0c51f2d..09238dc 100644 --- a/debian-pkg/debian/salt-syndic.manpages +++ b/debian-pkg/debian/salt-syndic.manpages @@ -1 +1 @@ -doc/_build/man/salt-syndic.1 +doc/man/salt-syndic.1 diff --git a/rpmvercmp.patch b/rpmvercmp.patch index c504558..a872b77 100644 --- a/rpmvercmp.patch +++ b/rpmvercmp.patch @@ -1,9 +1,24 @@ -Index: salt-3007.1/requirements/base.txt -=================================================================== ---- salt-3007.1.orig/requirements/base.txt 2024-11-06 20:30:10.965206223 +0100 -+++ salt-3007.1/requirements/base.txt 2024-11-06 20:50:55.462658609 +0100 -@@ -26,4 +26,3 @@ importlib-metadata>=3.3.0 - cryptography - - # From old requirements/static/pkg/linux.in +From cdc4bc6fa37e3d5173b3cad3d0f2e2d9816f8eb1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Sun, 15 Dec 2024 16:13:42 +0100 +Subject: [PATCH] Drop rpm-vercmp requirement + +It's a cmdline tool, part of rpmdevtools, not a python package. +--- +diff --git a/requirements/base.txt b/requirements/base.txt +index 0061087e35..a42ff50f7d 100644 +--- a/requirements/base.txt ++++ b/requirements/base.txt +@@ -28,9 +28,6 @@ + cherrypy>=18.6.1 + importlib-metadata>=3.3.0 + cryptography>=42.0.0 +- +-# From old requirements/static/pkg/linux.in -rpm-vercmp; sys_platform == 'linux' + + # From old windows.txt requirements file + gitpython>=3.1.37; sys_platform == 'win32' +-- +2.46.0 diff --git a/salt-3007.6.tar.gz.sha512 b/salt-3007.6.tar.gz.sha512 new file mode 100644 index 0000000..7d2854b --- /dev/null +++ b/salt-3007.6.tar.gz.sha512 @@ -0,0 +1 @@ +6706f2925531980210178a8d7c186676e39782f102c23bd3e99cc63846c0c7d49fa53b39368badd961fa267cd48bf72fd5234921316ba83770cf6d2932b6f2fb diff --git a/salt.spec.in b/salt.spec.in index b456efa..3314198 100644 --- a/salt.spec.in +++ b/salt.spec.in @@ -41,16 +41,16 @@ Source21: %{name}-syndic.fish Source22: %{name}.sysusers Patch0: contextvars.patch +# Don't require rpm-vercmp, we can use python3-rpm +Patch1: rpmvercmp.patch Patch2: 0002-Hide-known-DeprecationWarning-related-to-PEP-594.patch -Patch3: 0001-Drop-versioned-requests-dependency.patch Patch4: 0001-Use-timezone-aware-datetime-objects-for-UTC-too.patch # Fix urlib changes in python >= 3.12.6 # https://github.com/saltstack/salt/issues/66898 -Patch5: 0001-Fix-Python3.13-compatibility-regarding-urllib.parse-.patch +Patch5: urllib.patch Patch6: 0001-Drop-versioned-dependencies.patch Patch7: 0002-Drop-Windows-dependencies.patch -# Don't require rpm-vercmp, we can use python3-rpm -Patch8: rpmvercmp.patch +Patch9: 0001-Fix-Python3.13-compatibility-regarding-maxsplit.patch BuildArch: noarch %ifarch %{ix86} x86_64 diff --git a/urllib.patch b/urllib.patch new file mode 100644 index 0000000..a72b5df --- /dev/null +++ b/urllib.patch @@ -0,0 +1,53 @@ +From 0f69a5a227bfba6ced8a3826d69d556967967fcc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Wed, 18 Sep 2024 04:54:24 +0200 +Subject: [PATCH] Fix Python3.13 compatibility regarding urllib.parse module + +Python 3.13 fixed handling relative paths in urllib.parse module. +Specifically, relative file URL is now constructed as file:path instead +of converting it to absolute file:///path. This breaks +salt.utils.url.create which expects file:/// specifically. The mismatch +results in for example changing salt://top.sls into salt://.sls and thus +not finding the top file. + +Fix this by handling both prefixes. + +Relevant python change: https://github.com/python/cpython/issues/85110 +Fixes: #66898 +--- + changelog/66898.fixed.md | 1 + + salt/utils/url.py | 5 ++--- + 2 files changed, 3 insertions(+), 3 deletions(-) + create mode 100644 changelog/66898.fixed.md + +diff --git a/changelog/66898.fixed.md b/changelog/66898.fixed.md +new file mode 100644 +index 000000000000..2549d5e00ed1 +--- /dev/null ++++ b/changelog/66898.fixed.md +@@ -0,0 +1 @@ ++Fixed Python 3.13 compatibility regarding urllib.parse module +diff --git a/salt/utils/url.py b/salt/utils/url.py +index 478d8e911c2b..839db611c972 100644 +--- a/salt/utils/url.py ++++ b/salt/utils/url.py +@@ -4,7 +4,7 @@ + + import re + import sys +-from urllib.parse import urlparse, urlunparse ++from urllib.parse import urlparse, urlunparse, urlunsplit + + import salt.utils.data + import salt.utils.path +@@ -46,8 +46,7 @@ def create(path, saltenv=None): + path = salt.utils.data.decode(path) + + query = f"saltenv={saltenv}" if saltenv else "" +- url = salt.utils.data.decode(urlunparse(("file", "", path, "", query, ""))) +- return "salt://{}".format(url[len("file:///") :]) ++ return f'salt://{salt.utils.data.decode(urlunsplit(("", "", path, query, "")))}' + + + def is_escaped(url): diff --git a/version b/version index 7db14f1..aeb2d85 100644 --- a/version +++ b/version @@ -1 +1 @@ -3007.1 +3007.6