Wednesday, April 20, 2022

[SOLVED] Configure depencencies in RPM spec file

Issue

I'm trying to host a django web application using RPM.

This RPM package, when installed on a bare-metal centos machine, should install all dependencies required and configure httpd server to serve the application.

This is a gist of my RPM spec file.

Requires:       epel-release, python2, python-setuptools, python-pip, python-virtualenv, python-devel, httpd, mod_wsgi, git, sqlite

From what I know, python-pip can be installed on centos 7 after installing epel-release package.

https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F

So basically,

My RPM package --> depends on --> python-pi --> Depends on --> epel-release

That is why I have added epel-release as first dependency in my spec file in Requires tag.

However, when I install my RPM package, I get error and installation fails.

This is how I install my package.

yum localinstallinstall packagename-1-1.0.x86_64.rpm -v

The error I receive is "No package python-pip found"

epel-release is marked for installation. But not yet installed and because python-pip is also not found, it fails.

What I want to achieve is it should install epel-release as well and then install python-pip also.


Solution

RPM tries to resolve all dependencies before installing anything. This prevents you from installing a bunch of packages and then saying "Oops, we can't find python-pip" and rolling back. If the epel-release package isn't already installed, then yum doesn't know where to find python-pip, so it can't configure the dependencies.

The issue is that python-pip doesn't depend on epel-release in the same way; it's not a dependency managed by the RPM system. Instead, installing epel-release will tell yum about a new repository it didn't previously know existed. Once it has that, it can install python-pip just fine.

Instead, you should drop the epel-release dependency and just say in the documentation that your package requires EPEL.



Answered By - Daniel H
Answer Checked By - Willingham (WPSolving Volunteer)