metov / installcmd

Print correct command for installing a package.
1 stars 1 forks source link

Handle AUR (and other non-standard package managers) #16

Closed metov closed 2 years ago

metov commented 2 years ago

Currently, this package is based on the assumption that there is one "correct" package manager command for each OS. This is generally true, but there are some exceptions:

  1. Some systems don't have an established package manager, such as Windows
  2. Some package managers have an unstable interface, such as brew (the cask commands changed slightly over the recent years)
  3. Some users may prefer to use wrappers around their package manager, such as AUR helpers that wrap pacman

In these situations, hardcoding a command for a given OS does not work well. For example, on Arch Linux, installcmd is only able to support pacman repositories, not AUR. This doesn't make much sense, because AUR has a substantial set of Arch software, and also sometimes packages may be available for Ubuntu as a package but for Arch as only an AUR script. Clearly, we should support tweaking the command somehow.

metov commented 2 years ago

I think the solution here would be to support user-configurable overrides for the command database. There are potentially 3 ways to do it:

  1. Read a YAML file from somewhere like ~/.local/installcmd/overrides.yaml and apply it on top of the one in the package.
  2. Same idea as 1, but take the path from a CLI arg like --config overrides.yaml
  3. Redesign pkgspec so that they define the entire install command, not just the package name.

1 is my preferred option because it is the most practical way of accounting for a per-system situation, which is the most relevant one for installcmd's design. 2 would be less useful, because if the system has a non standard package manager, you would have to pass the config all the time, and it would get quite tedious. It's a nice option for some future enhancement, but for now I'll just go with 1. I don't really like 3 because it breaks the interface (not a big deal this early in development, but still...). It would require people to specify each command repeatedly for each package, making the pkgspec tedious. Also you would have to redo the work for each pkgspec you have, which doesn't seem very convenient.