mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Fix detection of installed cargo packages with hyphens in name (#4052)
* Fix detection of installed cargo packages with hyphens in name
* Add changelog fragment
* Fix outdated package detection
* Add changelog fragment for af4fae72
* One more thing
* Add idempotency tests
This commit is contained in:
parent
5540dab382
commit
c18fdb43d7
3 changed files with 28 additions and 4 deletions
|
@ -112,7 +112,7 @@ class Cargo(object):
|
|||
cmd = ["install", "--list"]
|
||||
data, dummy = self._exec(cmd, True, False, False)
|
||||
|
||||
package_regex = re.compile(r"^(\w+) v(.+):$")
|
||||
package_regex = re.compile(r"^([\w\-]+) v(.+):$")
|
||||
installed = {}
|
||||
for line in data.splitlines():
|
||||
package_info = package_regex.match(line)
|
||||
|
@ -136,11 +136,11 @@ class Cargo(object):
|
|||
installed_version = self.get_installed().get(name)
|
||||
|
||||
cmd = ["search", name, "--limit", "1"]
|
||||
data = self._exec(cmd, True, False, False)
|
||||
data, dummy = self._exec(cmd, True, False, False)
|
||||
|
||||
match = re.search(r'"(.+)"', data)
|
||||
if match:
|
||||
latest_version = match[1]
|
||||
latest_version = match.group(1)
|
||||
|
||||
return installed_version != latest_version
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue