rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.23k stars 409 forks source link

How to install a relocatable package? #2105

Open flixman opened 3 months ago

flixman commented 3 months ago

I have been navigating the man pages and I have not been able to find an answer to: How can I use dnf to install a relocatable package (and its dependencies)? Using plain rpm I would use the --prefix option, but I do not see any equivalent in dnf.

ppisar commented 3 months ago

You can install it the same way as nonrelocatable package. The effect will be the using rpm without --prefix and --relocate options. In other words, you can use DNF to install a relocatable package, but you cannot override the installation prefix.

(For completeness, dnf has "--installroot" option which allows to install packages including their dependencies into a separate directory to build a new and independent file system.)

flixman commented 3 months ago

@ppisar Thank you for your answer, but this is exactly the problem I have :-/ we are producing RPMs for internal company consumption, which have the prefix set for the production location, which we are now using also for dev/test (in that case, we relocate them to other locations). I do not see a straight forward way to do this with dnf, but I might be missing pieces of information.

ppisar commented 3 months ago

There is no support for relocation prefix in DNF.

It's not as easy as requesting librpm for the relocation: DNF resolves dependencies based on repository metadata way before it downloads the packages. Those metadata, I worry, do not support relocatable packages. So this requires enhancing a format of the metadata, implementing it in tools for creating repositories (e.g. createrepo_c), then add a support to a dependency solver (libsolv in case of DNF), libdnf, and finally DNF.

Since you are first one (based in this issue tracker) asking for the support, I worry that such a request won't find high priority in the near feature.

flixman commented 3 months ago

@ppisar I understand what you mean, and indeed: I have no high hopes of this being prioritised, as seems not to be much used. However, I still have the doubt: how can we apply the idea of "promoting" RPM packages without being able to relocate them? I am affraid I might be doing something the wrong way.