14

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
  • 255
  • 1
  • 10
  • 1
    Possible duplicate of [make rpm find dependencies in a specific location](https://serverfault.com/questions/829747/make-rpm-find-dependencies-in-a-specific-location) – Chris Maes Jun 28 '19 at 08:37

4 Answers4

27

"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
  • 255
  • 1
  • 10
HBruijn
  • 72,524
  • 21
  • 127
  • 192
10

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
  • 911
  • 1
  • 9
  • 23
6

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.

Chris Maes
  • 570
  • 2
  • 9
  • 5
    You can't manually override a dependency check? Because it reads like that's what it boils down to, what OP wants. – Mast Jun 28 '19 at 19:35
  • Yes you can, but then you override all dependency checks... And you will have trouble updating afterwards – Chris Maes Jun 28 '19 at 19:36
3

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
  • 4,868
  • 2
  • 8
  • 15
  • 5
    This may lead to problems down the road and basically just postpones the problem. When updating the system or installing another package later on, it can happen that some package will want to pull foobar 1 as a dependency, possibly overwriting the manually built&installed foobar 2 and causing compatibility issues. – Jiri Valenta Jun 28 '19 at 14:08