Repository navigation
feat: support an ordered list of AUR-compatible sources - #1623
m3talsmith wants to merge 4 commits into
Conversation
Add `AurSource = <name> <url> [rpcurl]` to paru.conf's [options] (repeat for several; order is priority) and a repeatable `--aururls <url,...>` flag for a single run, so alternative aurweb instances can be used alongside the official AUR without swapping AurUrl or passing a URL every time. - Every source is queried (search, info, dependency resolution, upgrade checks) and the results are merged; the earliest source wins on package name conflicts and the source of each package is remembered (src/aursource.rs, MultiRaur). A failing source is warned about and skipped; paru only errors when every source fails. - PKGBUILDs (-G, builds, upgrades) are cloned from <url>/<pkgbase>.git of the package's own source, falling back to the other sources. -Gp and -Gc use the package's source too. --ssh only applies to the AUR host. - Packages from non-default sources are labelled with the source name (e.g. mirror/foo) in search, -Si, -Sl, the upgrade menu and the install summary; the default source keeps showing aur/. They are still AUR packages everywhere else, and `mirror/foo` is accepted as a target. - -Sl, -Sl <source>, regex search and the completion cache merge the package lists of all sources. - New `paru --aursource list|add|edit|delete|move` manages the AurSource lines of the user config ($PARU_CONF or ~/.config/paru/paru.conf). Only those lines are rewritten, comments and other settings are kept, the result is validated and written atomically, and nothing changes on error. A new user config includes /etc/paru.conf. Adding the first source keeps the current AurUrl as the first entry, named "aur". - Backward compatible: without AurSource lines AurUrl/AurRpcUrl remain the single source and behave as before. An explicit --aururl selects that single source. - async-trait is now a regular dependency (used by MultiRaur). - Update help, paru(8), paru.conf(5), the sample paru.conf and the bash, zsh and fish completions.
A `<source>/<pkg>` target naming a non-default AUR source now makes paru resolve and download that package from that source even when a higher-priority source provides a package with the same name, matching yay. - Config::pin_aur_target records the pin (Config::aur_pins, shared with MultiRaur). It is applied for -S (and the interactive/default op) in split_repo_aur_targets, for -G/-Gp in split_target_pkgbuilds, and for -Gc, which now also accepts aur/<pkg> and <source>/<pkg>. - MultiRaur::merge takes a pinned package from its pinned source first and records that source for the package and its package base, so dependency resolution, labels, clone URLs, -Gp and -Gc all use it. - If the pinned source does not have the package (or is down), paru warns "package 'x' was not found in AUR source 'mirror', using 'aur' instead" and falls back; if no source has it, it warns and reports the package as missing as before. - If a cached clone of a pinned package was cloned from a different source, paru stops with an error naming both URLs instead of silently fetching from the old source. - Unit tests for pinning, fallback, base pinning and pin_aur_target; a mock-feature test resolving `mirror/shared` through split_repo_aur_targets and aur-depends; the provider test checks the pin. paru.conf(5) documents the behavior.
Packages installed from a non-default AUR source (a mirror/pkg target, or a package only that source has) are recorded in $XDG_STATE_HOME/paru/aursources.toml. Upgrades, -Qua, devel checks and plain re-installs look the package up on the recorded source first; if the source is gone or no longer has the package paru warns and falls back to the normal source order. Installing aur/pkg (or from another source) updates the record, uninstalled packages are pruned lazily. --aursource gains 'pins' and 'unpin <pkg>'; renaming a source updates its pins and deleting one drops them with a notice.
With two or more AUR sources, an existing clone (the clone dir for -S, -Sua/-Syu and devel upgrade builds, or the current directory for -G) whose origin is not the source the package is now fetched from (recorded source, <source>/pkg target, fallback or normal priority) is no longer fetched or built: paru stops with an error naming both URLs and the folder to remove. The check runs before the 'PKGBUILD up to date' shortcut. Trailing slashes, .git suffixes and the --ssh form of the source URL are accepted; unreadable remotes are left alone and a single source keeps the old behaviour.
|
What is the use case for this? Are there alternative sources available today? |
@dalto8 yes. I'm also the creator of taur. I got tired of testing using a flag and was just going to hack around it, but though it would be nice to contribute something lasting back. With the way that aur has been locked down registration wise, I think we might be seeing more alternatives come out. This addresses that. |
|
I think this is too much code for something nobody asked for to be sustainably maintainable. lmk if you disagree |
@pfeifferj I hear you. Would you like me to break it up into distinct smaller changes? I kind of forgot about that in my haze of just getting it to work the way I wanted it to. |
paru currently has a single
AurUrl/AurRpcUrl. To use another aurweb-compatible source you have to change that default or pass a URL every time. This adds an ordered list of AUR-compatible sources so lookups can go to more than one place without replacing the official AUR.This is only for aurweb-style sources (an RPC endpoint, defaulting to
<url>/rpc, and git clones at<url>/<pkgbase>.git). Prebuilt pacman repositories still belong inpacman.conf. It does not add a fallback to the GitHub AUR monorepo (see #1403); that is a different protocol.Behavior
URL/<pkgbase>.gitof the source the package was found in, falling back to the other sources if that clone fails.aur/pkg; packages from other sources use the source name, e.g.mirror/pkg. They are AUR packages in every other respect.<source>/<pkg>target (with-S,-G,-Gp, and-Gc) is resolved and downloaded from that source even when a higher-priority source has a package with the same name. If that source does not have it, paru warns and falls back to the other sources.$XDG_STATE_HOME/paru/aursources.toml(usually~/.local/state/paru). Later upgrades (-Syu,-Sua,-Qua, devel checks) and reinstalls look it up on that source first. If the source is no longer configured or no longer has the package, paru warns and uses the normal source order. Installingsource/pkgoraur/pkgupdates the record; records for packages that are no longer installed are dropped the next time the file is written.paru --aursource deleteunpins packages from the deleted source with a notice./and.git, and also accepts the--sshURL form of the same source.When any
AurSourceis set it replacesAurUrlandAurRpcUrl; to keep the official AUR, list it as well. An explicit--aururlselects that single source instead. A laterAurSourceline with the same name replaces an earlier one. Source names may not contain/or shadow official repositories (core,extra,multilib, the testing repos),local, ordevel.Config
In the
[options]section ofparu.conf:Commands
These edit
$PARU_CONFif set, otherwise~/.config/paru/paru.conf. OnlyAurSourcelines are rewritten; comments and other settings are kept, and the file is replaced atomically so it is left untouched on error. If the user file does not exist it is created withInclude = /etc/paru.conf.addkeeps the currentAurUrlas the first source, namedaur, if no sources are configured yet.moveuses a 1-based position.editwith an emptyrpcurl=resets it to<url>/rpc; renaming a source updates packages pinned to it.--aururls url1,url2sets the list for a single run (each source is named after its host,aurfor aur.archlinux.org). Completions and the man pages are updated.Testing
cargo fmt -- --checkis clean.cargo test --features mockand end-to-end checks in Arch containers for source labels,<source>/<pkg>pinning, per-package source records, and the cached-clone origin mismatch.Limitations
--aursource delete), its records stay untilunpinand only produce a warning.man/paru.conf.5mentions the cached-clone stop, but not the URL normalization (trailing/,.git, SSH form). paru also has no-G --force, so a mismatched clone has to be removed by hand.