aura icon indicating copy to clipboard operation
aura copied to clipboard

Force package to be used from a specific repo?

Open GrabbenD opened this issue 2 years ago • 5 comments

Is there any way to add rules which specifies which repository a package should be installed from? For instance, with Pacfree it's possible to do:

sudo pacfree add-rule <repo_name>/<pkg_name> <repo_name>/<pkg_name> <repo_name>/<pkg_name> 
sudo pacfree update
sudo pacfree upgrade

GrabbenD avatar Jul 29 '23 09:07 GrabbenD

Unfortunately we don't have specific functionality for that. Which package are you trying to specify?

fosskers avatar Jul 31 '23 02:07 fosskers

@fosskers I was hoping to address a wider issue with this rule based package installation. Users which prefer different init systems in Arch Linux like OpenRC or dinit (which is ridiculously fast) have to use non-systemd packages. When you use repos like ALHP or CachyOS at the top of Pacman config, it tries to pull in a couple of incompatible packages which depends on systemd. This can be solved making rules to only pull specific packages from a different repository which has non systemd equivalents (like Artix). Unfortunately Artix repos can't be placed on top in Pacman if you want to have x86_64-v3 optimized binaries from ALHP/CachyOS.

To be honest, manually cherrypicking incompatible packages isn't the cleanest solution in the long run. The proper way would be to determinate package's dependencies and automatically choose a different repository group/file

GrabbenD avatar Jul 31 '23 06:07 GrabbenD

Thanks for the clarification. Can you show me what your pacfree example would look like for a specific package you're trying to redirect?

fosskers avatar Jul 31 '23 09:07 fosskers

@fosskers Here's a example of how I can use CachyOS repositories for almost all of my packages with a system using Dinit instead of SystemD. I'm just cherrypicking non-systemd equivalents from Artix repository for packages which are causing issues this way:

sudo pacfree add-rule system/dbus system/device-mapper system/p11-kit world/pcsclite world/polkit system/procps-ng system/util-linux system/libp11-kit system/mkinitcpio
sudo pacfree update
sudo pacfree upgrade

For reference, here's how Pacman config looks:

/etc/pacman.conf
[options]
Architecture = x86_64 x86_64_v3

# Main
[cachyos-v3]
Include = /etc/pacman.d/cachyos-v3-mirrorlist
[cachyos-core-v3]
Include = /etc/pacman.d/cachyos-v3-mirrorlist
[cachyos-extra-v3]
Include = /etc/pacman.d/cachyos-v3-mirrorlist
[cachyos]
Include = /etc/pacman.d/cachyos-mirrorlist

# Fallback
#[system-gremlins]
#Include = /etc/pacman.d/mirrorlist
[system]
Include = /etc/pacman.d/mirrorlist
#[world-gremlins]
#Include = /etc/pacman.d/mirrorlist
[world]
Include = /etc/pacman.d/mirrorlist
#[galaxy-gremlins]
#Include = /etc/pacman.d/mirrorlist
[galaxy]
Include = /etc/pacman.d/mirrorlist

Probably a more robust way would be to check the package's dependencies (e.g. pactree -u -s) and automatically use Artix if something depends on SystemD to avoid cherrypicking

GrabbenD avatar Aug 02 '23 09:08 GrabbenD

I will do some experimentation to see how this might be added.

fosskers avatar Sep 26 '23 01:09 fosskers