Is there a tool that allows to install the dependecies of an RPM .spec into an isolated environment? I won’t install such dependencies globally on the system and I am not able to do so since I have not root privileges.
I want to build a package A which depends on a newer version of B (which cannot be installed globally on the system).
I like to build the newer version of B and let the build tool install B‘s
-devel it into an isolated environment to provide all necessary files for the build of A.
- Are there any tools to do this?
- If not, what should I take care of when trying to do this with say
- Would this be a bad practice?
Yes, the tool is called
mock and it’s in EPEL.
rpmbuild -bs mypackage.spec mock -r epel-6-x86_64 mypackage-0.1-1.src.rpm
This is actually the preferred way to build RPMs, precisely because it isolates the process from the system so that unexpected dependencies don’t get pulled in.
You can modify the files in
/etc/mock to have it pull in your own packages, private repo, etc., or check the docs for info on how to add packages to the
mock chroot environment manually.
Note that users should be added to the
mock group to be allowed to use
Not coincidentally, the
koji build server that Red Hat uses calls
mock to build each individual package. If you have to build a lot of packages all the time, it may be worth looking into setting up a
koji build server.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.