Page 1 of 1

[SOLVED] build rpm spec file to install other rpm dependencies

Posted: 2018/01/06 09:02:29
by warron.french
I have successfully created my first two RPMs, using this link (https://www.theurbanpenguin.com/buildin ... entos-6-5/) and referencing others.

I would like, for academic purposes to have my RPM install another RPM as a dependency, but I cannot figure out what Tag to use in my spec file.

Can someone please provide me the appropriate syntax or the website that defines this succinctly? I don't know what search terms to put into Google, nothing has worked for me.

As a pre-empt, I tried both the BuildRequires and also the Requires tags to no avail.

This is the entirety of my SPEC file so far that has worked completely, other than the RPM dependency:

Code: Select all

Name:           wsf
Version:        1.0
Release:        0
Summary:        Another testrun on learning to develop an rpm; named wsf-1.0.x86_64.rpm.

Group:          Applications
License:        GPLv2+
URL:            http://rpm-files.french-family.com/wsf
Source0:        wsf-1.0.tar.gz
BuildArch:      x86_64
BuildRoot:      %{_tmppath}/%{name}-buildroot

%description
A simple RPM Build exercise.


Requires:  procmail


%prep
%setup -q


%install
mkdir -p "$RPM_BUILD_ROOT"
cp -R * "$RPM_BUILD_ROOT"

%clean
rm -rf "$RPM_BUILD_ROOT"


%files
%defattr(-,root,root,-)
/tmp/wsf-tmp.txt
/usr/bin/wsf-bin.tmp


%changelog
* Sat Jan 06 2018 Warron French <warron.french@gmail.com> - 1.0
- Created initial package.
Thank you for any assistance or guidance.

Re: build rpm spec file to install other rpm dependencies

Posted: 2018/01/06 14:28:46
by TrevorH
Move your Requires: line above the %description - I suspect that it's being seen as part of the description now.

Re: build rpm spec file to install other rpm dependencies

Posted: 2018/01/07 04:31:15
by warron.french
Hi TrevorH, that certainly made a difference in the right direction, moving the Requires: tag above the %description tag.

Perhaps you can explain something to me please, is an install using the rpm command only supposed to point out dependencies, but if an RPM is installed using yum, the dependencies are automatically installed?

I ask, because the new RPM generated off the new spec file doesn't auto-install the procmail RPM.

Re: build rpm spec file to install other rpm dependencies

Posted: 2018/01/07 05:46:54
by Whoever
That's right.

rpm will refuse to install a package without the dependencies (they can all the installed in the same rpm command). For example, you could do:

Code: Select all

rpm -ivh <path to>/wsf-1.0.rpm <path to>/procmail-3.22-25.1.el6_5.1.rpm
Note that rpm installs package files, not packages.

yum will install the dependencies if it can.

Re: build rpm spec file to install other rpm dependencies

Posted: 2018/01/07 12:41:56
by TrevorH
The rpm command should refuse to install the package unless the Requires: are already installed or specified on the same rpm --install command. Using yum should do dependency resolution and offer to install the whole lot in one go.

Re: build rpm spec file to install other rpm dependencies

Posted: 2018/01/08 01:14:54
by warron.french
TrevorH wrote:The rpm command should refuse to install the package unless the Requires: are already installed or specified on the same rpm --install command. Using yum should do dependency resolution and offer to install the whole lot in one go.
Ah! Excellent explanation, thank you.