Commit Graph
372 Commits
Author SHA1 Message Date
Jo Garnier f8c37c0c16 add lua testing 2026-06-04 09:47:16 +00:00
Jo 3b79933638 test: harden coverage and make tests parallel-safe (#2797)
* 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
2026-03-25 00:51:34 +01:00
Jo 90ae08862a Remove timeupdate option (#2796)
* disable provides by default

* remove time update due to low usage
2026-03-18 23:01:14 +01:00
TurtleRuss 412c145eb4 fix(query): incorporate AUR popularity into search metric (#2789)
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.
2026-03-15 23:14:54 +01:00
b09f3de913 ci: update golangci-lint to v2.10.1 and bump Go to 1.26 (#2791)
* Initial plan

* ci: update golangci-lint to v2.10.1 and use go 1.26

Co-authored-by: Jguer <8071073+Jguer@users.noreply.github.com>

* fix false report lints

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Jguer <8071073+Jguer@users.noreply.github.com>
Co-authored-by: Jo Garnier <git@jguer.space>
2026-03-08 23:33:23 +01:00
JoandCopilot 3e3d5aa111 feat(ini): support ini config (#2774)
* support ini config

* support user ini config

* Update pkg/settings/ini.go

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-30 16:07:24 +01:00
Jo 3d7701fa35 fix: automatically regenerate empty completion cache (#2773)
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
2026-01-30 10:33:43 +01:00
Jo 0a928ba9f4 feat(yay): use dyalpm for alpm usage (#2769)
* squash: dyalpm integration

* fix vercmp

* fix linting
2026-01-22 16:46:55 +01:00
Jo b2dfa0c56f chore(migration): default to "" as sortBy to keep existing behavior (#2768)
* bump builtin version

* add sortby migration to keep current user behavior
2026-01-22 10:28:47 +01:00
Michele PalazziandJo Garnier 398005c7cd fix: Ensure --asexplicit applies to explicitly targeted packages (#2766)
* fix: Ensure --asexplicit applies to explicitly targeted packages and add a regression test.

Signed-off-by: Michele Palazzi <sysdadmin@m1k.cloud>

* lint

---------

Signed-off-by: Michele Palazzi <sysdadmin@m1k.cloud>
Co-authored-by: Jo Garnier <git@jguer.space>
2026-01-22 09:42:36 +01:00
Joey Holtzman 733e6a6b17 Add support for all sortyby options (#2747)
* 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
2026-01-22 09:26:35 +01:00
Jo abe346b2ec Fix flaky test (#2757)
fix flaky test
2025-12-25 14:40:18 +01:00
Jo 15c0597562 Build: Build without install with -B . (#2684)
* remove deprecated --tar flag and add --gitflags

Built without installing with -B

fix git tests gitBin

align with next

* fix order of ops
2025-12-22 15:22:10 +01:00
LordBeerus c466b96b94 fix: Correctly return exit status 1 when no packages are found (#2705)
* fix: Correctly return exit status 1 when no packages are found

* add testing for targets not found
2025-12-21 15:54:23 +01:00
Camilo SantanaandJo Garnier dd0f44c78d feat: add source of dependency error (#2720)
* feat: add source of dependency error

* add test for deps

* present the chain upwards

---------

Co-authored-by: Jo Garnier <git@jguer.space>
2025-12-21 14:38:15 +01:00
Joey Holtzman 5cdb61fa05 Fix building packages with incompatible architectures in makepkg 7.1.0+ (#2741) 2025-12-21 14:35:18 +01:00
Jo d52526284e dep/topo: clarify graph API, rename methods, add tests (#2744)
* 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.
2025-12-21 14:27:55 +01:00
Jo df80f397af feat(repo): Sort repository results by pacman.conf repo order (#2740)
* 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
2025-12-19 21:13:47 +01:00
Jo bcadb73755 Use custom http client in runtime, loosen timeouts (#2723)
* use custom http client in runtime, loosen timeouts

* Update pkg/runtime/runtime.go
---------
2025-12-06 13:38:06 +01:00
Jo aecd78040c chore(completion): refactor and increase coverage (#2722)
* 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
2025-12-06 13:20:13 +01:00
Jo 99770dec04 Fix pacman-git builds (#2712)
* fix pacman-git ABI change

* add guard for ABI stability

* bump alpm for ABI fix

* normalize strings for comparison
2025-11-28 21:20:27 +01:00
Edwin Peer 3629c0a1ff Don't rely on transparent decompression in sync list (#2710)
* 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>
2025-11-28 18:00:03 +01:00
Joey Holtzman 38397d1609 Don't use OSC 8 links when output is not a terminal (#2689)
* Don't use OSC 8 links when output is not a terminal

* Use `UseColor` for disabling OSC 8 links

* Add tests for `CreateRepoLink`
2025-10-17 14:18:03 +02:00
Jo 81440e54a4 chore(go): modernize syntax (#2672)
* modernize go syntax

* fix lint
2025-09-18 18:05:58 +02:00
dependabot[bot]andJo Garnier 122c221d02 chore(deps): bump the go-all group across 1 directory with 3 updates (#2669)
* chore(deps): bump the go-all group across 1 directory with 3 updates

Bumps the go-all group with 3 updates in the / directory: [github.com/stretchr/testify](https://github.com/stretchr/testify), [golang.org/x/sys](https://github.com/golang/sys) and [golang.org/x/term](https://github.com/golang/term).


Updates `github.com/stretchr/testify` from 1.10.0 to 1.11.1
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.10.0...v1.11.1)

Updates `golang.org/x/sys` from 0.35.0 to 0.36.0
- [Commits](https://github.com/golang/sys/compare/v0.35.0...v0.36.0)

Updates `golang.org/x/term` from 0.34.0 to 0.35.0
- [Commits](https://github.com/golang/term/compare/v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-version: 1.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
- dependency-name: golang.org/x/sys
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
- dependency-name: golang.org/x/term
  dependency-version: 0.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-all
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix lint error

* update golangci

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jo Garnier <git@jguer.space>
2025-09-16 09:29:46 +02:00
Tamim Baschour 570b524f88 Turn search results into clickable links to their repo pages (#2653)
* 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.
2025-08-13 15:16:26 +01:00
Jo ea3fceb7b4 fix(srcinfo): avoid panic on srcinfo failed parse (#2645)
avoid panic on srcinfo failed parse. fixes #2640
2025-07-19 10:46:16 +02:00
given fd62f7f4c8 catch incompatible --clean flag when no operation is specified with better error message (#2644)
* improve error messaging when running yay -c

* use correct method in parsing -c flag

* better express prefixes in --help
2025-07-18 14:04:28 +02:00
Eisuke KawashimaandEisuke Kawashima f1391b3e03 feat: add run0 for privilege elevator (#2637)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-07-08 15:08:55 +02:00
Jo b745f87210 chore(ci): update golangci lint v2.1.5 (#2615)
* chore(ci): update golangci-lint to v2.1.5 in ci.Dockerfile

* add golangci

* fix lint

* fix lint pkg/upgrade

* reenable lint
2025-05-01 10:00:10 +02:00
Jo 2dcf94544c refactor(build): optimize allocations and add tests (#2601)
* perf(build): optimize map/slice allocations and use strings.Builder

* test(build): add tests for parsePackageList
2025-04-29 22:45:24 +02:00
Ferdinand Bachmann 95fc0938fd fix(installer): Fix the same pkgbase being built multiple times on error (#2561)
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.
2025-04-29 22:45:10 +02:00
Jo bf315041b1 refactor(upgrade): optimize code and improve maintainability (#2600)
* 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
2025-04-24 12:06:27 +02:00
Jo d2c67ae0a4 fix(yay): fix minor performance and safety issue (#2581) 2025-02-25 17:15:34 +01:00
dmitrodem 3f2f6eae31 socks5 support (#2543)
* socks5 support

socks5 support via environment variable, e.g. SOCKS5_PROXY=localhost:1080 yay ...

* use default transport and update tests to work on arm
2024-12-20 16:49:05 +00:00
scarf da53d3855f fix: use positional argument for "providers available" translation (#2537) 2024-12-20 16:43:28 +00:00
Matthias Kurz f23fe98a66 Fix comments: AUR_SEEN is the correct name (#2535)
Fix comments: AUR_SEEN is the correct name
2024-11-21 12:00:11 +01:00
Ferdinand Bachmann ec837c831d fix(installer): Fixes the same pkgbase being built multiple times (#2534)
* 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>
2024-11-19 11:08:28 +01:00
Jo 89b32ee9ce fix(parser): allow disable-sandbox option. fixes #2509 (#2511) 2024-09-24 08:12:41 +00:00
Absobel bea53a4a09 fix: added missing spaces (#2386) 2024-09-19 14:15:44 +02:00
iTrooz 1b8f823f7c Refactor part of UserExcludeUpgrades() (#2450) 2024-07-29 09:15:20 +02:00
Daniel Ohandjguer 836fc5922a add short option for --repo (#2380)
* 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>
2024-06-28 16:40:35 +02:00
eveneast 61dd708a4a chore: fix function name in comment (#2430)
Signed-off-by: eveneast <qcqs@foxmail.com>
2024-05-02 10:54:16 +00:00
James Raspass 6c2330528f Use Go 1.21's min/max built-ins (#2405)
This simplifies the code compared to either rolling our own or awkwardly
using math's float functions with integers.
2024-03-23 23:27:30 +01:00
James Raspass 5d887cbd41 Replace github.com/pkg/errors with stdlib errors/fmt (#2400) 2024-03-16 09:10:49 +01:00
Jo e8080f87c2 chore(yay): fix breaking -git ci test (#2373)
* chore(yay): fix breaking test

* chore(yay): fix breaking test

* chore(yay): fix breaking test

* update gomod

* remove debug commands
2024-02-19 17:04:06 +01:00
Jo 26aa171b2b fix(query): remove -debug packages from missing list if base package is installed (#2372)
* chore(yay): fix pre-commit

* chore(yay): fix git ignore
2024-02-19 10:29:47 +00:00
Joey Holtzman d02c45e5b6 Remove deprecated flags in favor of boolean flags (#2350) 2024-01-25 16:03:47 +01:00
Eng Zer Jun d23e8925fa fix(dep_graph): fix panic on selecting AUR providers (#2333)
This commit fixes https://github.com/Jguer/yay/issues/2289 by making
`provideMenu` returns the first option when it receives an error input
from the user (e.g. user sends EOF).

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-11 17:45:54 +01:00
Kirill Motkov 0771ded99b Refactor AURPKGBUILDRepos and Fix Localization Command in Makefile (#2313)
* optimize mutex usage and logging in AURPKGBUILDRepos function

* fix localization script

Fix localization script Makefile by adding missing semicolon and --no-translator flag
2023-11-20 16:58:20 +01:00