15

On a CentOS 7, I've installed foobar version 2, compiled from sources.

How can I make yum aware of that install so it won't install foobar version 1 for dependency?


Installation of foobar

$ git clone https://example.com/foobar.git
[...]
$ cd foobar
$ make && sudo make install
[...]
$ foobar --version
foobar v2

Installation of a package requiring foobar

$ sudo yum install baz
[...]
---> Package baz.x86_64 0:3.14.15-9 will be installed
--> Processing Dependency: foobar >= 1 for package: baz-3.14.15-9.x86_64
[...]
Dependencies Resolved

==============================================================
 Package           Arch      Version      Repository   Size
==============================================================
Installing:                  
 baz               x86_64    3.14.15-9    example      1.1 M
Installing for dependencies: 
 foobar            x86_64    1.0.0-0.el7  example      4.5 M

I'd like yum to know foobar 2 is installed and since baz requires foobar >= 1 or simply foobar, foobar-1.0.0-0.el7.x86_64.rpm should not be installed.

YSC
  • 265

4 Answers4

28

"I've installed foobar version 2, compiled from sources"

Take the extra effort when adding custom software to your system and package your additions in a RPM. See Martin Streicher, 2010-01-12, Building and distributing packages, IBM on how to do that.

Then install that resulting RPM so it can and will play nice with your package manager's conflict and dependency handling, upgrade, downgrade and removal procedures and security reporting.

YSC
  • 265
HBruijn
  • 84,206
  • 24
  • 145
  • 224
11

Another option (albeit definitely not the best answer): make a dummy rpm file with the name in question.

You will need rpmbuild installed, and a dummy tarball.

mkdir ~/rpmbuild/{RPMS,SOURCES}
touch empty.txt
tar -zcf ~/rpmbuild/SOURCES/example.tar.gz empty.txt

Write the dummy spec file. This one works for me on Fedora 29. It should be good on CentOS 7 too.

Name:           example
Version:        0.0.0
Release:        1%{?dist}
Summary:        Dummy package

Group:          Dummy
License:        CC-BY-SA 3.0
URL:            http://example.com
Source0:    example.tar.gz
BuildArch:  noarch

#BuildRequires:
#Requires:

%description
Dummy for example

%prep
:

%build
:

%install
:

%files
%doc

%changelog

Tweak package name and version number as necessary, and then build the package.

rpmbuild -ba example.spec

The output "binary" rpm file will be ~/rpmbuild/RPMS/noarch/example-0.0.0-1.fc29.x86_64.rpm

bgStack15
  • 1,221
7

This is not how rpm works.

rpm uses a db where it stores which rpms are installed on the system. If you install some files manually, rpm does not know about it.

The best way to solve this is to install foobar 2 with an rpm. Other solutions would only be workaround and would not work in the long run.

4

May rpm --nodeps be the answer you're looking for? It was discussed in an older thread here on Serverfault.

(tell yum to ignore a single dependency)

Mikael H
  • 5,179