[PR #9665/75ffae43 backport][stable-10] More resilient brew formulae name handling (#9714)

More resilient brew formulae name handling (#9665)

* Remove update_homebrew=False (it's the default)

* Fix handling of irregular cases (brew does lowercase normalization)

* Fix handling of tap with no public fallback

* Add changelog fragment

* Add missing cleanup step

* Fix typo

* Check re-install and re-uninstall too

(cherry picked from commit 75ffae43e6)

Co-authored-by: Thibaut Decombe <68703331+UnknownPlatypus@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-02-10 19:18:00 +01:00 committed by GitHub
parent e49775765d
commit 33e980039b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 125 additions and 29 deletions

View file

@ -385,9 +385,11 @@ class Homebrew(object):
self.outdated_packages.add(package_name)
def _extract_package_name(self, package_detail, is_cask):
canonical_name = package_detail["full_token"] if is_cask else package_detail["full_name"] # For ex: 'sqlite'
canonical_name = package_detail["full_token"] if is_cask else package_detail["full_name"] # For ex: 'sqlite', might contain a tap prefix.
name = package_detail["token"] if is_cask else package_detail["name"] # For ex: 'sqlite'
all_valid_names = set(package_detail.get("aliases", [])) # For ex: {'sqlite3'}
all_valid_names.add(canonical_name)
all_valid_names.update((canonical_name, name))
# Then make sure the user provided name resurface.
return (all_valid_names & set(self.packages)).pop()
@ -831,7 +833,7 @@ def main():
p = module.params
if p['name']:
packages = p['name']
packages = [package_name.lower() for package_name in p['name']]
else:
packages = None