pacman: implement change detection for update_cache=true; add cache_updated return value (#4337)

* Implement change detection for update_cache=true. Add cache_updated return value.

* ...

* Make sure pacman --sync --list is called only as often as necessary.
This commit is contained in:
Felix Fontein 2022-03-15 05:38:59 +01:00 committed by GitHub
parent ca2c64b5ca
commit cf4d68ac50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 13 deletions

View file

@ -10,3 +10,4 @@
- include: 'basic.yml'
- include: 'package_urls.yml'
- include: 'remove_nosave.yml'
- include: 'update_cache.yml'

View file

@ -0,0 +1,23 @@
---
- name: Make sure package cache is updated
pacman:
update_cache: true
- name: Update package cache again (should not be changed)
pacman:
update_cache: true
register: update_cache_idem
- name: Update package cache again with force=true (should be changed)
pacman:
update_cache: true
force: true
register: update_cache_force
- name: Check conditions
assert:
that:
- update_cache_idem is not changed
- update_cache_idem.cache_updated == false
- update_cache_force is changed
- update_cache_force.cache_updated == true