commit: 0d6349df53d62dbd4f96032e1b85a02bb7561008 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org> AuthorDate: Fri Jan 16 05:15:37 2026 +0000 Commit: Matthew Thode <prometheanfire <AT> gentoo <DOT> org> CommitDate: Fri Jan 16 05:16:24 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d6349df
app-admin/ansible-core: backport os-release patch Fixes: https://bugs.gentoo.org/968497 Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org> ...2.20.0.ebuild => ansible-core-2.20.0-r1.ebuild} | 6 +- app-admin/ansible-core/files/os-release-fix.patch | 148 +++++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) diff --git a/app-admin/ansible-core/ansible-core-2.20.0.ebuild b/app-admin/ansible-core/ansible-core-2.20.0-r1.ebuild similarity index 93% rename from app-admin/ansible-core/ansible-core-2.20.0.ebuild rename to app-admin/ansible-core/ansible-core-2.20.0-r1.ebuild index 92dfff5860c5..305d97667ad1 100644 --- a/app-admin/ansible-core/ansible-core-2.20.0.ebuild +++ b/app-admin/ansible-core/ansible-core-2.20.0-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -45,6 +45,10 @@ BDEPEND=" dev-python/pytz[${PYTHON_USEDEP}] )" +PATCHES=( + "${FILESDIR}/os-release-fix.patch" +) + distutils_enable_tests pytest python_compile() { diff --git a/app-admin/ansible-core/files/os-release-fix.patch b/app-admin/ansible-core/files/os-release-fix.patch new file mode 100644 index 000000000000..704924bead97 --- /dev/null +++ b/app-admin/ansible-core/files/os-release-fix.patch @@ -0,0 +1,148 @@ +From 8db282ed927a1bce6283c3a398a0718ab380bb3c Mon Sep 17 00:00:00 2001 +From: Tetja Rediske <[email protected]> +Date: Wed, 7 Jan 2026 17:41:43 +0100 +Subject: [PATCH 1/3] Fixes Parsing for ClearLinux exposed by Gentoo changing + os-release Quoting from " to ', also fixes NA parsing to strip booth kind of + quotes + +--- + lib/ansible/module_utils/facts/system/distribution.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py +index aeb78d789bff5c..68ffae2a6bd963 100644 +--- a/lib/ansible/module_utils/facts/system/distribution.py ++++ b/lib/ansible/module_utils/facts/system/distribution.py +@@ -438,10 +438,10 @@ def parse_distribution_file_NA(self, name, data, path, collected_facts): + for line in data.splitlines(): + distribution = re.search("^NAME=(.*)", line) + if distribution and name == 'NA': +- na_facts['distribution'] = distribution.group(1).strip('"') ++ na_facts['distribution'] = distribution.group(1).strip('"').strip("'") + version = re.search("^VERSION=(.*)", line) + if version and collected_facts['distribution_version'] == 'NA': +- na_facts['distribution_version'] = version.group(1).strip('"') ++ na_facts['distribution_version'] = version.group(1).strip('"').strip("'") + return True, na_facts + + def parse_distribution_file_Coreos(self, name, data, path, collected_facts): +@@ -489,6 +489,8 @@ def parse_distribution_file_ClearLinux(self, name, data, path, collected_facts): + if 'Clear Linux' not in pname.groups()[0]: + return False, clear_facts + clear_facts['distribution'] = pname.groups()[0] ++ else: ++ return False, clear_facts + version = re.search('VERSION_ID=(.*)', data) + if version: + clear_facts['distribution_major_version'] = version.groups()[0] + +From 7ff5b15eddfecf4f47878a09c183af9964028689 Mon Sep 17 00:00:00 2001 +From: Tetja Rediske <[email protected]> +Date: Fri, 9 Jan 2026 22:53:44 +0100 +Subject: [PATCH 2/3] Added Gentoo Test Information Added Changelog Fragment + +--- + .../fragments/clearlinux-gentoo-parsing.yml | 3 ++ + .../module_utils/facts/system/distribution.py | 4 +- + .../system/distribution/fixtures/gentoo.json | 47 +++++++++++++++++++ + 3 files changed, 52 insertions(+), 2 deletions(-) + create mode 100644 changelogs/fragments/clearlinux-gentoo-parsing.yml + create mode 100644 test/units/module_utils/facts/system/distribution/fixtures/gentoo.json + +diff --git a/changelogs/fragments/clearlinux-gentoo-parsing.yml b/changelogs/fragments/clearlinux-gentoo-parsing.yml +new file mode 100644 +index 00000000000000..7cf73a94e8210f +--- /dev/null ++++ b/changelogs/fragments/clearlinux-gentoo-parsing.yml +@@ -0,0 +1,3 @@ ++bugfixes: ++ - 'ansible_facts[os_*] - Contained wrong information, if ClearLinux parsing was tried before falling back to general os-release parsing' ++ +diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py +index 68ffae2a6bd963..ee32605e4291e5 100644 +--- a/lib/ansible/module_utils/facts/system/distribution.py ++++ b/lib/ansible/module_utils/facts/system/distribution.py +@@ -438,10 +438,10 @@ def parse_distribution_file_NA(self, name, data, path, collected_facts): + for line in data.splitlines(): + distribution = re.search("^NAME=(.*)", line) + if distribution and name == 'NA': +- na_facts['distribution'] = distribution.group(1).strip('"').strip("'") ++ na_facts['distribution'] = distribution.group(1).strip(DistributionFiles.STRIP_QUOTES) + version = re.search("^VERSION=(.*)", line) + if version and collected_facts['distribution_version'] == 'NA': +- na_facts['distribution_version'] = version.group(1).strip('"').strip("'") ++ na_facts['distribution_version'] = version.group(1).strip(DistributionFiles.STRIP_QUOTES) + return True, na_facts + + def parse_distribution_file_Coreos(self, name, data, path, collected_facts): +diff --git a/test/units/module_utils/facts/system/distribution/fixtures/gentoo.json b/test/units/module_utils/facts/system/distribution/fixtures/gentoo.json +new file mode 100644 +index 00000000000000..759e8651f89e26 +--- /dev/null ++++ b/test/units/module_utils/facts/system/distribution/fixtures/gentoo.json +@@ -0,0 +1,47 @@ ++{ ++ "name": "Gentoo 2.18", ++ "distro": { ++ "codename": "n/a", ++ "id": "gentoo", ++ "name": "Gentoo", ++ "version": "2.18", ++ "version_best": "2.18", ++ "lsb_release_info": { ++ "lsb_version": "n/a", ++ "distributor_id": "Gentoo", ++ "description": "Gentoo Linux", ++ "release": "2.18", ++ "codename": "n/a" ++ }, ++ "os_release_info": { ++ "name": "Gentoo", ++ "id": "gentoo", ++ "pretty_name": "Gentoo Linux", ++ "version": "2.18", ++ "version_id": "2.18", ++ "home_url": "https://www.gentoo.org/", ++ "support_url": "https://www.gentoo.org/support/", ++ "bug_report_url": "https://bugs.gentoo.org/", ++ "ansi_color": "1;32" ++ } ++ }, ++ "input": { ++ "/etc/os-release": "NAME='Gentoo'\nID='gentoo'\nPRETTY_NAME='Gentoo Linux'\nVERSION='2.18'\nVERSION_ID='2.18'\nHOME_URL='https://www.gentoo.org/'\nSUPPORT_URL='https://www.gentoo.org/support/'\nBUG_REPORT_URL='https://bugs.gentoo.org/'\nANSI_COLOR='1;32'\n", ++ "/etc/gentoo-release": "Gentoo Base System release 2.18\n", ++ "/etc/lsb-release": "DISTRIB_ID=\"Gentoo\"\n", ++ "/usr/lib/os-release": "NAME='Gentoo'\nID='gentoo'\nPRETTY_NAME='Gentoo Linux'\nVERSION='2.18'\nVERSION_ID='2.18'\nHOME_URL='https://www.gentoo.org/'\nSUPPORT_URL='https://www.gentoo.org/support/'\nBUG_REPORT_URL='https://bugs.gentoo.org/'\nANSI_COLOR='1;32'\n" ++ }, ++ "platform.dist": [ ++ "gentoo", ++ "2.18", ++ "n/a" ++ ], ++ "result": { ++ "distribution": "Gentoo", ++ "distribution_version": "2.18", ++ "distribution_release": "n/a", ++ "distribution_major_version": "2", ++ "os_family": "Gentoo" ++ }, ++ "platform.release": "6.18.2-p1-gentoo-dist" ++} + +From 8100c7719251c431c87ab94b3945f5fa6b8ff03f Mon Sep 17 00:00:00 2001 +From: Tetja Rediske <[email protected]> +Date: Fri, 9 Jan 2026 23:38:33 +0100 +Subject: [PATCH 3/3] removed empty line + +--- + changelogs/fragments/clearlinux-gentoo-parsing.yml | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/changelogs/fragments/clearlinux-gentoo-parsing.yml b/changelogs/fragments/clearlinux-gentoo-parsing.yml +index 7cf73a94e8210f..3216991aa59012 100644 +--- a/changelogs/fragments/clearlinux-gentoo-parsing.yml ++++ b/changelogs/fragments/clearlinux-gentoo-parsing.yml +@@ -1,3 +1,2 @@ + bugfixes: + - 'ansible_facts[os_*] - Contained wrong information, if ClearLinux parsing was tried before falling back to general os-release parsing' +-
