Compare commits

...

1 Commits
main ... 1.1

7 changed files with 35 additions and 1456 deletions

View File

@ -1,87 +0,0 @@
From 771f7ad29ca4d259761eaa88673c2e32f6412bbe Mon Sep 17 00:00:00 2001
From: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Date: Wed, 6 Nov 2024 10:20:26 -0500
Subject: [PATCH] update ansible-galaxy resolvelib requirement to >= 0.5.3, <
2.0.0 (#84218)
* Update resolvelib upperbound to 2.0.0
Minor SemVer releases should not contain breaking changes
* Test the latest minor release and reduce number of resolvelib versions tested for efficiency
---
.../fragments/update-resolvelib-lt-2_0_0.yml | 2 ++
.../galaxy/dependency_resolution/providers.py | 2 +-
requirements.txt | 2 +-
.../ansible-galaxy-collection/vars/main.yml | 14 ++++++++------
.../ansible_test/_data/requirements/ansible.txt | 2 +-
5 files changed, 13 insertions(+), 9 deletions(-)
create mode 100644 changelogs/fragments/update-resolvelib-lt-2_0_0.yml
diff --git a/changelogs/fragments/update-resolvelib-lt-2_0_0.yml b/changelogs/fragments/update-resolvelib-lt-2_0_0.yml
new file mode 100644
index 00000000000000..10c4f1a0838b91
--- /dev/null
+++ b/changelogs/fragments/update-resolvelib-lt-2_0_0.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - ansible-galaxy - support ``resolvelib >= 0.5.3, < 2.0.0`` (https://github.com/ansible/ansible/issues/84217).
diff --git a/lib/ansible/galaxy/dependency_resolution/providers.py b/lib/ansible/galaxy/dependency_resolution/providers.py
index 7578cae785c100..d336c3441e2e1d 100644
--- a/lib/ansible/galaxy/dependency_resolution/providers.py
+++ b/lib/ansible/galaxy/dependency_resolution/providers.py
@@ -39,7 +39,7 @@ class AbstractProvider: # type: ignore[no-redef]
# TODO: add python requirements to ansible-test's ansible-core distribution info and remove the hardcoded lowerbound/upperbound fallback
RESOLVELIB_LOWERBOUND = SemanticVersion("0.5.3")
-RESOLVELIB_UPPERBOUND = SemanticVersion("1.1.0")
+RESOLVELIB_UPPERBOUND = SemanticVersion("2.0.0")
RESOLVELIB_VERSION = SemanticVersion.from_loose_version(LooseVersion(resolvelib_version))
diff --git a/requirements.txt b/requirements.txt
index 5eaf9f2cbc2911..45c9c01b803647 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,4 +12,4 @@ packaging
# NOTE: Ref: https://github.com/sarugaku/resolvelib/issues/69
# NOTE: When updating the upper bound, also update the latest version used
# NOTE: in the ansible-galaxy-collection test suite.
-resolvelib >= 0.5.3, < 1.1.0 # dependency resolver used by ansible-galaxy
+resolvelib >= 0.5.3, < 2.0.0 # dependency resolver used by ansible-galaxy
diff --git a/test/integration/targets/ansible-galaxy-collection/vars/main.yml b/test/integration/targets/ansible-galaxy-collection/vars/main.yml
index 066d2678bca56e..c865871c4fe692 100644
--- a/test/integration/targets/ansible-galaxy-collection/vars/main.yml
+++ b/test/integration/targets/ansible-galaxy-collection/vars/main.yml
@@ -4,13 +4,15 @@ gpg_homedir: "{{ galaxy_dir }}/gpg"
offline_server: https://test-hub.demolab.local/api/galaxy/content/api/
+# Test oldest and most recently supported, and versions with notable changes.
+# The last breaking change for a feature ansible-galaxy uses was in 0.8.0.
+# It would be redundant to test every minor version since 0.8.0, so we just test against the latest minor release.
+# NOTE: If ansible-galaxy incorporates new resolvelib features, this matrix should be updated to verify the features work on all supported versions.
supported_resolvelib_versions:
- - "0.5.3" # Oldest supported
- - "0.6.0"
- - "0.7.0"
- - "0.8.0"
- - "0.9.0"
- - "1.0.1"
+ - "0.5.3" # test CollectionDependencyProvider050
+ - "0.6.0" # test CollectionDependencyProvider060
+ - "0.7.0" # test CollectionDependencyProvider070
+ - "<2.0.0" # test CollectionDependencyProvider080
unsupported_resolvelib_versions:
- "0.2.0" # Fails on import
diff --git a/test/lib/ansible_test/_data/requirements/ansible.txt b/test/lib/ansible_test/_data/requirements/ansible.txt
index 5eaf9f2cbc2911..45c9c01b803647 100644
--- a/test/lib/ansible_test/_data/requirements/ansible.txt
+++ b/test/lib/ansible_test/_data/requirements/ansible.txt
@@ -12,4 +12,4 @@ packaging
# NOTE: Ref: https://github.com/sarugaku/resolvelib/issues/69
# NOTE: When updating the upper bound, also update the latest version used
# NOTE: in the ansible-galaxy-collection test suite.
-resolvelib >= 0.5.3, < 1.1.0 # dependency resolver used by ansible-galaxy
+resolvelib >= 0.5.3, < 2.0.0 # dependency resolver used by ansible-galaxy

BIN
ansible-core-2.15.8.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#
# spec file for package ansible-core
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,20 +16,16 @@
#
%define ansible_core_major_minor_version 2.18
%{?sle15_python_module_pythons}
%if 0%{?suse_version} < 1550
# Leap15, SLES15
%if %pythons == "python310"
%define ansible_python python310
%define ansible_python_version 3.10
%define ansible_python_executable python3.10
%define ansible_python_sitelib %python310_sitelib
%endif
%if %pythons == "python311"
%define ansible_python python311
%define ansible_python_version 3.11
%define ansible_python_executable python3.11
%define ansible_python_sitelib %python311_sitelib
%endif
@ -37,58 +33,40 @@
# Tumbleweed
%define pythons python3
%define ansible_python python3
%define ansible_python_version %python3_version
%define ansible_python_executable python3
%define ansible_python_sitelib %python3_sitelib
%endif
Name: ansible-core
Version: 2.18.3
Version: 2.15.8
Release: 0
Summary: Radically simple IT automation
License: GPL-3.0-or-later
URL: https://ansible.com/
Source0: https://files.pythonhosted.org/packages/source/a/ansible-core/ansible_core-%{version}.tar.gz#/ansible_core-%{version}.tar.gz
Source1: ansible_core-%{version}.tar.gz.sha256
# PATCH-FIX-UPSTREAM fix resolvelib dependency
Patch1: https://github.com/ansible/ansible/commit/771f7ad29ca4d259761eaa88673c2e32f6412bbe.patch
# PATCH-FIX-UPSTREAM unarchive-test-fix.patch -- Clamp zip timestamps on 32-bit time_t
# Upstream commit: d500354798beb9bf8341eb8e84e1e2046bbfd21b
# Reference: https://github.com/ansible/ansible/commit/d500354798beb9bf8341eb8e84e1e2046bbfd21b
Patch2: unarchive-test-fix.patch
Source: https://files.pythonhosted.org/packages/source/a/ansible-core/ansible-core-%{version}.tar.gz
BuildArch: noarch
# cannot be installed with ansible < 3 or ansible-base
Conflicts: ansible < 3
Conflicts: ansible-base
# cannot be installed with a lower or higher 2.X version
Conflicts: ansible-core < %{ansible_core_major_minor_version}
Conflicts: ansible-core > %{ansible_core_major_minor_version}
# https://github.com/ansible/ansible/blob/stable-2.18/pyproject.toml#L6
BuildRequires: %{ansible_python}-base >= 3.11
BuildRequires: %{ansible_python}-pip
# https://github.com/ansible/ansible/blob/devel/setup.cfg#L40
BuildRequires: %{ansible_python}-base >= 3.9
BuildRequires: %{ansible_python}-setuptools
BuildRequires: %{ansible_python}-wheel
# https://github.com/ansible/ansible/blob/stable-2.18/requirements.txt
BuildRequires: fdupes
BuildRequires: python-rpm-macros
# importlib_resources not required, as we are using python 3.10 or higher
# SECTION test requirements
BuildRequires: %{ansible_python}-botocore
BuildRequires: %{ansible_python}-Jinja2 >= 3.0.0
BuildRequires: %{ansible_python}-PyYAML >= 5.1
BuildRequires: %{ansible_python}-cryptography
BuildRequires: %{ansible_python}-packaging
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: (%{ansible_python}-resolvelib >= 0.5.3 with %{ansible_python}-resolvelib < 2.0.0)
# SECTION test requirements
BuildRequires: %{ansible_python}-botocore
BuildRequires: %{ansible_python}-curses
BuildRequires: %{ansible_python}-passlib
BuildRequires: %{ansible_python}-packaging
BuildRequires: %{ansible_python}-pytest
BuildRequires: %{ansible_python}-pytest-mock
BuildRequires: %{ansible_python}-pytest-xdist
BuildRequires: %{ansible_python}-pytz
BuildRequires: git-core
BuildRequires: openssh
# https://github.com/ansible/ansible/blob/devel/requirements.txt
BuildRequires: (%{ansible_python}-resolvelib >= 0.5.3 with %{ansible_python}-resolvelib < 1.1.0)
# /SECTION
# SECTION docs
BuildRequires: %{ansible_python}-docutils
@ -97,26 +75,24 @@ Requires: %{ansible_python}-Jinja2 >= 3.0.0
Requires: %{ansible_python}-PyYAML >= 5.1
Requires: %{ansible_python}-cryptography
Requires: %{ansible_python}-packaging
Requires: (%{ansible_python}-resolvelib >= 0.5.3 with %{ansible_python}-resolvelib < 2.0.0)
# https://github.com/ansible/ansible/blob/devel/requirements.txt
# importlib_resources not required, as we are using python 3.10 or higher
Requires: (%{ansible_python}-resolvelib >= 0.5.3 with %{ansible_python}-resolvelib < 1.1.0)
# ansible-documentation is a separate package since 2.15.3
Recommends: ansible-documentation
%description
Ansible is a radically simple IT automation system. It handles configuration
management, application deployment, cloud provisioning, ad-hoc task execution,
network automation, and multi-node orchestration. Ansible makes complex changes
like zero-downtime rolling updates with load balancers easy. More information
on the Ansible website <https://ansible.com/>.
Ansible is a radically simple IT automation system. It handles
configuration management, application deployment, cloud provisioning,
ad-hoc task execution, network automation, and multi-node orchestration. Ansible makes complex
changes like zero-downtime rolling updates with load balancers easy. More information on the Ansible `website <https://ansible.com/>`_.
%package -n ansible-test
Summary: Tool for testing ansible plugin and module code
Requires: %{name} = %{version}
BuildRequires: %{ansible_python}-virtualenv
Requires: %{ansible_python}-virtualenv
# cannot be installed with a lower or higher 2.X version
Conflicts: ansible-test < %{ansible_core_major_minor_version}
Conflicts: ansible-test > %{ansible_core_major_minor_version}
%description -n ansible-test
This package installs the ansible-test command for testing modules and plugins
@ -129,7 +105,7 @@ modules can be written in any language and are transferred to managed machines
automatically.
%prep
%autosetup -p 1 -n ansible_core-%{version}
%setup -q -n ansible-core-%{version}
for file in .git_keep .travis.yml ; do
find . -name "$file" -delete
@ -143,19 +119,14 @@ find ./ -type f -exec \
find ./ -type f -exec \
sed -i '1s|^#!%{_bindir}/python$|#!%{_bindir}/%{ansible_python_executable}|' {} \;
# fix shebangs in scripts
sed -i "1{/python3/d;}" ./lib/ansible/cli/*.py
sed -i "1{/python3/d;}" ./lib/ansible/cli/scripts/ansible_connection_cli_stub.py
sed -i "1{/python3/d;}" ./lib/ansible/modules/hostname.py
%build
%pyproject_wheel
%python_build
mkdir man1
%{ansible_python_executable} packaging/cli-doc/build.py man --output-dir ./man1
%install
%pyproject_install
%python_install
%fdupes %{buildroot}%{ansible_python_sitelib}
mkdir -p %{buildroot}%{_sysconfdir}/ansible/
@ -202,22 +173,24 @@ mkdir -p %{buildroot}%{_sysconfdir}/ansible/roles/
# resp. https://bugzilla.opensuse.org/show_bug.cgi?id=1137479
mkdir -p %{buildroot}%{ansible_python_sitelib}/ansible/galaxy/data/default/role/{files,templates}
# fix shebangs in scripts
sed -i "1{/python3/d;}" %{buildroot}/%{ansible_python_sitelib}/ansible/cli/*.py
sed -i "1{/python3/d;}" %{buildroot}/%{ansible_python_sitelib}/ansible/cli/scripts/ansible_connection_cli_stub.py
sed -i "1{/python3/d;}" %{buildroot}/%{ansible_python_sitelib}/ansible/modules/hostname.py
mkdir -p %{buildroot}/%{_mandir}/man1/
cp -v ./man1/*.1 %{buildroot}/%{_mandir}/man1/
%check
export PYTHONPATH=%{ansible_python_sitelib}:$PWD
mkdir bin
cd bin
ln -s ../test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py ./ansible-test
cd ..
%{ansible_python_executable} bin/ansible-test units -v --python %{ansible_python_version}
# NEVER ship untested pure python packages. Enable this before the final submit.
#python3 bin/ansible-test units -v --python %%{python3_version}
%files
%doc changelogs/CHANGELOG-v%{ansible_core_major_minor_version}.rst changelogs/changelog.yaml
%doc changelogs/CHANGELOG-v2.15.rst changelogs/changelog.yaml
%license COPYING licenses/Apache-License.txt licenses/MIT-license.txt licenses/PSF-license.txt licenses/simplified_bsd.txt
%{_bindir}/ansible
%{_bindir}/ansible-config
%{_bindir}/ansible-connection
%{_bindir}/ansible-console
%{_bindir}/ansible-doc
%{_bindir}/ansible-galaxy

BIN
ansible_core-2.18.3.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@ -1 +0,0 @@
8c4eaca40845238e2601b9bc9dbfbd4f6ed3502cb8b2632789f75ce478abfdee ansible_core-2.18.3.tar.gz

View File

@ -1,116 +0,0 @@
From c158b3f85126dabb8107260839dbcdb80e356c70 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <github@rivera.za.net>
Date: Thu, 5 Dec 2024 14:26:58 -0800
Subject: [PATCH] unarchive: Clamp zip timestamps on 32-bit time_t (#84409)
Clamp zip timestamps to representible values when unpacking zip files on
platforms that use 32-bit time_t (e.g. Debian i386). This is a
non-issue in practice (in 2024), but should allow the test suite to pass
on Debian i386.
We use a round value of 2038-01-01 00:00:00 for simplicity, and to avoid
running into timezone offsets closer to the actual limit.
MR #81520 introduced sanity-checking tests that used dates not
representable with a 32-bit time_t.
---
.../fragments/unarchive_timestamp_t32.yaml | 3 +++
lib/ansible/modules/unarchive.py | 22 +++++++++++++++++++
test/units/modules/test_unarchive.py | 10 ++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 changelogs/fragments/unarchive_timestamp_t32.yaml
diff --git a/changelogs/fragments/unarchive_timestamp_t32.yaml b/changelogs/fragments/unarchive_timestamp_t32.yaml
new file mode 100644
index 0000000000..969c85de05
--- /dev/null
+++ b/changelogs/fragments/unarchive_timestamp_t32.yaml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+ - unarchive - Clamp timestamps from beyond y2038 to representible values when unpacking zip files on platforms that use 32-bit time_t (e.g. Debian i386).
diff --git a/lib/ansible/modules/unarchive.py b/lib/ansible/modules/unarchive.py
index 0d56da53a4..3663cebcb8 100644
--- a/lib/ansible/modules/unarchive.py
+++ b/lib/ansible/modules/unarchive.py
@@ -241,6 +241,7 @@ uid:
import binascii
import codecs
+import ctypes
import fnmatch
import grp
import os
@@ -262,6 +263,13 @@ from ansible.module_utils.urls import fetch_file
from shlex import quote
from zipfile import BadZipFile
+try:
+ from functools import cache
+except ImportError:
+ # Python < 3.9
+ from functools import lru_cache
+ cache = lru_cache(maxsize=None)
+
# String from tar that shows the tar contents are different from the
# filesystem
OWNER_DIFF_RE = re.compile(r': Uid differs$')
@@ -279,6 +287,18 @@ CONTENT_DIFF_RE = re.compile(r': Contents differ$')
SIZE_DIFF_RE = re.compile(r': Size differs$')
+@cache
+def _y2038_impacted():
+ """Determine if the system has 64-bit time_t."""
+ if hasattr(ctypes, "c_time_t"): # Python >= 3.12
+ return ctypes.sizeof(ctypes.c_time_t) < 8
+ try:
+ time.gmtime(2**31)
+ except OverflowError:
+ return True
+ return False
+
+
def crc32(path, buffer_size):
''' Return a CRC32 checksum of a file '''
@@ -414,6 +434,8 @@ class ZipArchive(object):
try:
if int(match.groups()[0]) < 1980:
date_time = epoch_date_time
+ elif int(match.groups()[0]) >= 2038 and _y2038_impacted():
+ date_time = (2038, 1, 1, 0, 0, 0, 0, 0, 0)
elif int(match.groups()[0]) > 2107:
date_time = (2107, 12, 31, 23, 59, 59, 0, 0, 0)
else:
diff --git a/test/units/modules/test_unarchive.py b/test/units/modules/test_unarchive.py
index 6a2f0d9a67..b1885c2f1c 100644
--- a/test/units/modules/test_unarchive.py
+++ b/test/units/modules/test_unarchive.py
@@ -14,6 +14,14 @@ def fake_ansible_module():
return FakeAnsibleModule()
+def max_zip_timestamp():
+ """Return the max clamp value that will be selected."""
+ try:
+ return time.mktime(time.struct_time((2107, 12, 31, 23, 59, 59, 0, 0, 0)))
+ except OverflowError:
+ return time.mktime(time.struct_time((2038, 1, 1, 0, 0, 0, 0, 0, 0)))
+
+
class FakeAnsibleModule:
def __init__(self):
self.params = {}
@@ -68,7 +76,7 @@ class TestCaseZipArchive:
),
pytest.param(
"21081231.000000",
- time.mktime(time.struct_time((2107, 12, 31, 23, 59, 59, 0, 0, 0))),
+ max_zip_timestamp(),
id="invalid-year-2108",
),
pytest.param(
--
2.48.1