Skip to content

feat: support an ordered list of AUR-compatible sources - #1623

Open
m3talsmith wants to merge 4 commits into
Morganamilo:masterfrom
m3talsmith:multi-aur-urls
Open

m3talsmith wants to merge 4 commits into
Morganamilo:masterfrom
m3talsmith:multi-aur-urls

Conversation

@m3talsmith

Copy link
Copy Markdown

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 in pacman.conf. It does not add a fallback to the GitHub AUR monorepo (see #1403); that is a different protocol.

Behavior

  • Every configured source is queried and the results are merged. The earlier source wins when two provide the same package name. A source that fails is warned about and skipped; paru only errors if all of them fail.
  • PKGBUILDs are cloned from URL/<pkgbase>.git of the source the package was found in, falling back to the other sources if that clone fails.
  • Packages from the first source are shown as aur/pkg; packages from other sources use the source name, e.g. mirror/pkg. They are AUR packages in every other respect.
  • A <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.
  • When a package is installed from a source other than the first one, paru records that source in $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. Installing source/pkg or aur/pkg updates the record; records for packages that are no longer installed are dropped the next time the file is written. paru --aursource delete unpins packages from the deleted source with a notice.
  • If a cached clone of the package came from a different source, paru stops and asks for it to be removed. The comparison ignores trailing / and .git, and also accepts the --ssh URL form of the same source.

When any AurSource is set it replaces AurUrl and AurRpcUrl; to keep the official AUR, list it as well. An explicit --aururl selects that single source instead. A later AurSource line with the same name replaces an earlier one. Source names may not contain / or shadow official repositories (core, extra, multilib, the testing repos), local, or devel.

Config

In the [options] section of paru.conf:

AurSource = aur https://aur.archlinux.org
AurSource = mirror https://aur.example.org
AurSource = custom https://m.example https://m.example/rpc

Commands

paru --aursource list
paru --aursource add <name> <url> [rpcurl]
paru --aursource edit <name> [name=] [url=] [rpcurl=]
paru --aursource delete <name>
paru --aursource move <name> <position>
paru --aursource pins
paru --aursource unpin <pkg>...

These edit $PARU_CONF if set, otherwise ~/.config/paru/paru.conf. Only AurSource lines 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 with Include = /etc/paru.conf. add keeps the current AurUrl as the first source, named aur, if no sources are configured yet. move uses a 1-based position. edit with an empty rpcurl= resets it to <url>/rpc; renaming a source updates packages pinned to it.

--aururls url1,url2 sets the list for a single run (each source is named after its host, aur for aur.archlinux.org). Completions and the man pages are updated.

Testing

  • cargo fmt -- --check is clean.
  • cargo test --features mock and end-to-end checks in Arch containers for source labels, <source>/<pkg> pinning, per-package source records, and the cached-clone origin mismatch.

Limitations

  • Source records are keyed by package name, not pkgbase.
  • A record names the source where the package was found, even if cloning later fell back to another source.
  • If a source is removed from the config by hand (rather than with --aursource delete), its records stay until unpin and only produce a warning.
  • Voting still only goes to the official AUR.
  • New strings are not yet in the translation catalogs.
  • man/paru.conf.5 mentions 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.

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.
@dalto8

dalto8 commented Nov 15, 2026

Copy link
Copy Markdown

What is the use case for this? Are there alternative sources available today?

@m3talsmith

Copy link
Copy Markdown
Author

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.

@pfeifferj

Copy link
Copy Markdown
Collaborator

I think this is too much code for something nobody asked for to be sustainably maintainable. lmk if you disagree

@m3talsmith

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants