* Test coverage hardening and parallel-safe refactors
Add focused test coverage for under-tested operational paths, edge branches,
and make key table-driven suites parallel-safe. Also fixed flaky installer
test execution under repeated/parallel runs.
* chore: fix goimports ordering for golangci-lint
* Test(download): expand integration coverage for download paths
Add integration scenarios for force/pull repo updates, repo-only and skip semantics,
and direct AUR download/scanner coverage used by getpkgbuild and package preparation.
* Test(exe): relax systemd-run path assertion
Fix flaky TestBuildGitCmd by accepting an absolute systemd-run path while still
asserting the expected binary is used.
* Test(text): avoid race in color tests
Remove parallel execution from TestColorHash so global UseColor writes do not
overlap with color consumers in parallel tests and trigger race detector
failures.
* fix potential race conditions
Replace vote-only sigmoid with a blended votes+popularity score in
aurSortByMetric. AUR's Popularity field (already stored and populated
from the API) is a time-decayed vote score that better reflects current
relevance than raw NumVotes alone.
Falls back to votes-only when popularity <= 0 (brand-new packages).
Uses the same sigmoid normalization pattern as the existing minVotes
constant (minPopularity = 0.5).
Side effect: AUR packages no longer artificially outscore repo packages
via historical vote counts when separateSources is disabled. Updated
two noseparatesources test expectations accordingly.
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
* 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
* 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>
* Make package names clickable links to their repo pages using OSC 8 sequences (official arch repos and AUR only)
* fmt
* Map "devel" repo to AUR when creating package links
* Revert pkg/upgrade/upgrade.go This wasn't supposed to be here yet.
fix(installer): Fixes the same pkgbase being built multiple times on error
The previous fix commit ec837c8 failed to address the case where the
build fails, as packages are only added to builtPkgDests on a successful
build. This commit addresses this by adding the package to the map earlier.
Fixes#2560.
* refactor(upgrade): reduce code duplication in Print methods and fix typo in Filter documentation
* refactor(upgrade): optimize UserExcludeUpgrades with early return and simplify GraphUpgrades function
* socks5 support
socks5 support via environment variable, e.g. SOCKS5_PROXY=localhost:1080 yay ...
* use default transport and update tests to work on arm
* fix(installer): Fixes the same pkgbase being built multiple times
When building a PKGBUILD pkgbase with multiple pkgnames,
installAURPackages() invokes buildPkg() multiple times for the same
pkgbase. This causes prepare() to be run multiple times for the same
pkgbase, since detection of already built packages happens after
prepare().
Additionally, detection of already built packages can fail if the split
debug packages are enabled and the package does not contain any
binaries, causing no -debug package to be created by makepkg even though
it is listed by makepkg --packagelist.
This commit fixes this by keeping track of the pkgdests built by
buildPkg() and avoiding rebuilds of the same pkgbase in the same yay
invocation.
Fixes#2340.
Signed-off-by: Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>
* fix(installer): Fixes buildPkg() isTarget param being order-dependent
Previously, the buildPkg invocation for a pkgbase only considered
whether the current pkgname is part of installer.origTargets. This made
the decision whether to rebuild the package order-dependent.
This commit fixes this by keeping track of which pkgbases are part of
installer.origTargets and rebuilding the pkgbase if any of its pkgnames
is part of origTargets.
* fix(tests): Test that installing split packages avoids rebuilds
The previous two commits changed how split packages (packages with the same
pkgbase) are built, ensuring that those packages aren't built multiple
times.
This commit updates the lists of commands that the tests expect to be
run so that `makepkg` isn't run multiple times per pkgbase.
---------
Signed-off-by: Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>
* add short option for --repo
* run pre-commit
* update man page
* add fish completion
* add a N options
* add long options
---------
Co-authored-by: jguer <me@jguer.space>
* optimize mutex usage and logging in AURPKGBUILDRepos function
* fix localization script
Fix localization script Makefile by adding missing semicolon and --no-translator flag