Fixes#2759
The completion cache validation now checks if the file is empty and
automatically regenerates it. This prevents shell completions from
breaking when the cache file exists but is corrupted or empty.
Previously, NeedsUpdate() only checked file existence and age, but
didn't validate file contents. Empty cache files would be used as-is,
causing 'yay -Pc' to return no output and breaking shell completions.
Changes:
- Add file size check in NeedsUpdate() to detect empty cache files
- Add test case for empty file scenario
- Update function documentation
* Add all sortyby options
Previously, only 'name' was a supported sortby option. Now, all sortby
options are supported.
Whenever there is a tie, the metric is used as a tiebreaker (it is also
the default when sortby is not specified). The only behavior that
changed is that packages with the same metric are sorted oppositely when
sorting bottomUp. This was actually a bug in the previous implementation
which inverts the `cmpResult` for bottomUp which returns true if the
metrics are the same. According to the docs for Less
(https://pkg.go.dev/sort#Interface), Less(i, i) should be false (the
same element cannot sort before itself).
I mainly structured the code for efficiency by creating the sortby
function once rather than checking `separateSources` and `bottomUp`
every comparison, but I also think this improves readability compared to
having a switch-case in the comparison function.
* Fix separating sources on ties and improve test coverage
* Remove 'id' and 'baseid' in sortby options
Translate po/en.po in ca
100% translated source file: 'po/en.po'
on 'ca'.
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
Co-authored-by: Jo <git@jguer.space>
* Translate po/en.po in hu
100% translated source file: 'po/en.po'
on 'hu'.
* Translate po/en.po in hu
100% translated source file: 'po/en.po'
on 'hu'.
* Translate po/en.po in hu
100% translated source file: 'po/en.po'
on 'hu'.
---------
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* Translate po/en.po in ko
100% translated source file: 'po/en.po'
on 'ko'.
* Translate po/en.po in ko
100% translated source file: 'po/en.po'
on 'ko'.
* Translate po/en.po in ko
100% translated source file: 'po/en.po'
on 'ko'.
---------
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* ci(yay): update packages on builder before building release
* update go-aur
* dep/topo: clarify graph API, rename methods, add tests
- Rename topo methods for clarity (TopoSortedLayers, AddProvides, HasProvides, GetProviderInfo)
- Add GoDoc describing edge direction and semantics
- Make ForEach safe when node info is missing
- Add unit tests for Dependencies/Dependents behavior
- Update call sites
* Revert "ci(yay): update packages on builder before building release"
This reverts commit bb64208c64.
* ci(yay): update packages on builder before building release
* respect other repos in order
* ensure repo ends on top in case of tie
* revert dockerfile change
* cleanup arch build
* don't doubleptade
* fix pacman-git build
* fix final issues with some sandbox kernels
* use quay because docker is out of steam
* remove docker hub
* -si on testing
* ci(yay): update packages on builder before building release
* attempt to reduce builder size and force update before release build
* use alternative image
* use alternative image
* refactor(completion): separate cache validation from update logic
- Add NeedsUpdate() to check if completion cache is stale
- Rename Update() to UpdateCache() and make it unconditional
- Move caching decision to call sites (Show and sync.Run)
- Improve error handling with proper defer for file close
* increase completion coverage
* launch goroutine if update is needed
* remove user dependent test
* Don't rely on transparent decompression in sync list
The current sync list code relies on the HTTP client library transparently
decompressing the packages.gz file. This only works if the server provides
the 'Content-Encoding: gzip" HTTP header, which has apparently changed
recently.
This patch explicitly decompresses the package list if no encoding
information is provided by the server.
Fixes: https://github.com/Jguer/yay/issues/2709
v2: added gzip closer and added error handling
v3: blindly attempt to decompress, since the content encoding is
stripped by the HTTP client when transparently decompressing.
v4: also fix the fetch in command completion using common interface
Signed-off-by: Edwin Peer <espeer@gmail.com>
* fix failing tests, add fallback logging, add gz testcase
* fix lint
---------
Signed-off-by: Edwin Peer <espeer@gmail.com>
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
* Translate po/en.po in es
100% translated source file: 'po/en.po'
on 'es'.
---------
Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>