Centos – How to add Fedora Repo to a CentOS 7 installation

centosfedorarpmyum

I have a CentOS 7 x86_64 installation onto which I want to install a package called frama-c. This package is not in the repos I have configured so far:

# yum search frama-c
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.datente.com
 * epel: epel.besthosting.ua
 * epel-testing: epel.besthosting.ua
 * extras: centos.mirror.iphh.net
 * updates: artfiles.org
Warning: No matches found for: frama-c
No matches found

I have downloaded the fullfilelist from https://dl.fedoraproject.org/pub/fedora/ and when I grep for frama-c the result looks promising:

$ grep 'development.*x86_64.*frama-c' fullfilelist.txt
./linux/development/26/Everything/x86_64/debug/tree/Packages/f/frama-c-debuginfo-1.14-1.fc26.x86_64.rpm
./linux/development/26/Everything/x86_64/os/Packages/f/frama-c-doc-1.14-1.fc26.noarch.rpm
./linux/development/26/Everything/x86_64/os/Packages/f/frama-c-emacs-1.14-1.fc26.noarch.rpm
./linux/development/26/Everything/x86_64/os/Packages/f/frama-c-xemacs-1.14-1.fc26.noarch.rpm
./linux/development/26/Everything/x86_64/os/Packages/f/frama-c-1.14-1.fc26.x86_64.rpm
./linux/development/rawhide/Everything/x86_64/debug/tree/Packages/f/frama-c-debuginfo-1.14-1.fc27.x86_64.rpm
./linux/development/rawhide/Everything/x86_64/os/Packages/f/frama-c-doc-1.14-1.fc27.noarch.rpm
./linux/development/rawhide/Everything/x86_64/os/Packages/f/frama-c-1.14-1.fc27.x86_64.rpm
./linux/development/rawhide/Everything/x86_64/os/Packages/f/frama-c-emacs-1.14-1.fc27.noarch.rpm
./linux/development/rawhide/Everything/x86_64/os/Packages/f/frama-c-xemacs-1.14-1.fc27.noarch.rpm

What is the proper way to add, say the rawhide repository to my current list of repos so I can install with a single yum install frama-c?

Best Answer

It is never good idea to mix packages for different systems. It might work, but you might encounter hard-to-debug problems. But most probably it will not work.

The best way is to rebuild the package for your system. Either you can ask the current package maintainer to do it for you (add EPEL7 package, which will show up in your EPEL repository) or do it on your own:

  • Download the latest SRPM package from Koji:

    wget https://kojipkgs.fedoraproject.org//packages/frama-c/1.14/1.fc27/src/frama-c-1.14-1.fc27.src.rpm
    
  • Rebuild it for your system (possibly resolve missing dependencies, if they are available):

    rpmbuild --rebuild frama-c-1.14-1.fc27.src.rpm
    
  • Install the package:

    yum install ~/rpmbuild/RPMS/.../path/../to/your.rpms
    
Related Question