homebrew: Support old_tokens and oldnames in homebrew package data (#10805)
* homebrew: Support old_tokens and oldnames in homebrew package data
Fixes#10804
Since brew info will accept old_tokens (for casks) and oldnames (for formulae) when provided by the homebrew module "name" argument, the module also needs to consider thes old names as valid for the given package. This commit updates _extract_package_name to do that.
All existing package name tests, including existing tests for name aliases and tap prefixing, have been consolidated with new name tests into package_names.yml.
* Added changelog fragment.
* homebrew: replace non-py2 compliant f-string usage
* code formatting lint, and py2 compatibility fixes
* homebrew: added licenses to new files, nox lint
* Update plugins/modules/homebrew.py
use str.format() instead of string addition
* Update tests/integration/targets/homebrew/tasks/casks.yml
* Update tests/integration/targets/homebrew/tasks/package_names_item.yml
* Update tests/integration/targets/homebrew/tasks/formulae.yml
* Fixes for performance concerns on new homebrew tests.
1) tests for alternate package names are commented out in main.yml.
2) the "install via alternate name, uninstall via base name" test
case was deemed duplicative, and has been deleted .
3) minor fixes to use jinja2 "~" for string concat instead of "+"
* Fix nox lint
---------
(cherry picked from commit 833e6e36de)
Co-authored-by: brad2014 <brad2014@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* 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
* Add failing test (See commit description)
Second assert returns this:
changed: [localhost] => changed=true
changed_pkgs:
- sqlite3
msg: 'Changed: 1, Unchanged: 1'
unchanged_pkgs:
- sqlite
* Extract proper package_name from brew info using alisases
* Add changelog fragment
* Fix pep8
* Make sure sqlite is uninstalled beforehand
* Use `package_result is (not) changed` syntax in assertions
* Register more explicit names
* Fix handling of casks
* Increase test coverage and assert output more strictly
* Remove unused `_current_package_is_installed_from_head`
* Remove `un/changed_count` and infer from un/changed_pkgs length
* Track `installed` & `outdated` package state once
* Validate package names beforehand
* Install packages in 1 brew call instead of N
This also has the side effect of fixing the check message so that it prints every packages that will be installed instead of only the first one.
* Uninstall packages in 1 brew call instead of N
* Link packages in 1 brew call instead of N
* Unlink packages in 1 brew call instead of N
* Upgrade packages in 1 brew call instead of N
* Remove dangling checks
* Remove `_status` method and directly return the tuple
* Add changelog fragment
* Fix invalid format string (nice catch pylint!)
* Update changelogs/fragments/9181-improve-homebrew-module-performance.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update brew info parsing for casks
* Update changelogs/fragments/9181-improve-homebrew-module-performance.yml
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Instead of checking if there is an error message, which can also be a
warning, we now check the return code.
This commit fixes#8229#7044
Co-authored-by: Strahinja Kustudic <strahinjak@nordeus.com>
* fix: detect already installed cask
Use json output v2 to check if formulae and casks are installed
chore: add changelog fragment
* test: add homebrew cask specific tests
* refactor: change cask used in tests
* chore: apply suggestions to changelog fragment
* Move licenses to LICENSES/, run add-license.py, add LICENSES/MIT.txt.
* Replace 'Copyright:' with 'Copyright'
sed -i 's|Copyright:\(.*\)|Copyright\1|' $(rg -l 'Copyright:')
Co-authored-by: Maxwell G <gotmax@e.email>