mirror of
https://github.com/ansible/ansible.git
synced 2026-06-03 22:05:30 -04:00
Merge 0a9feef7b9 into ba21909655
This commit is contained in:
commit
5face4e766
3 changed files with 12 additions and 2 deletions
|
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- apt - add support for apt-patterns (https://github.com/ansible/ansible/pull/83070)
|
||||
|
|
@ -641,8 +641,11 @@ def expand_pkgspec_from_fnmatches(m, pkgspec, cache):
|
|||
|
||||
pkgname_pattern, version_cmp, version = package_split(pkgspec_pattern)
|
||||
|
||||
if pkgname_pattern.startswith(('?', '~', '(?', '(~')):
|
||||
# this is an apt-pattern (https://manpages.debian.org/bookworm/apt/apt-patterns.7.en.html)
|
||||
new_pkgspec.append(pkgspec_pattern)
|
||||
# note that none of these chars is allowed in a (debian) pkgname
|
||||
if frozenset('*?[]!').intersection(pkgname_pattern):
|
||||
elif frozenset('*?[]!').intersection(pkgname_pattern):
|
||||
# handle multiarch pkgnames, the idea is that "apt*" should
|
||||
# only select native packages. But "apt*:i386" should still work
|
||||
if ":" not in pkgname_pattern:
|
||||
|
|
@ -995,7 +998,7 @@ def remove(m, pkgspec, cache, purge=False, force=False,
|
|||
for package in pkgspec:
|
||||
name, version_cmp, version = package_split(package)
|
||||
installed, installed_version, upgradable, has_files = package_status(m, name, version_cmp, version, None, cache, state='remove')
|
||||
if installed_version or (has_files and purge):
|
||||
if installed_version or (has_files and purge) or package.startswith(('?', '~', '(?', '(~')):
|
||||
pkg_list.append("'%s'" % package)
|
||||
packages = ' '.join(pkg_list)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ fake_cache = [
|
|||
["apt", "apt-utils"],
|
||||
id="pkgname-expands",
|
||||
),
|
||||
pytest.param(
|
||||
["?config-files"],
|
||||
["?config-files"],
|
||||
id="apt-pattern",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_expand_pkgspec_from_fnmatches(test_input, expected):
|
||||
|
|
|
|||
Loading…
Reference in a new issue