Reputation: 2629
I'm new to rpmbuild + spec files and I tried the following tutorial to build the "hello world" example.
Manage to get it working, but I wanted to learn how dependencies/requires works. Therefore, I tried to duplicate another "hello world 2" example and link it as a dependency to the first in the spec file below.
However I keep getting the error below. Is there a way that yum install will pick up the helloworld1 and install automatically when i yum install helloworld2 ?
Any example for me learn from?
SPEC FILE
Name: helloworld2
Version: 2.0
Release: 1%{?dist}
Summary: A hello world program
License: GPLv3+
URL: https://blog.packagecloud.io
Source0: helloworld2-2.0.tar.gz
#BuildRequires: helloworld1
Requires(preun): helloworld1
#PreReq: testYW
%description
A helloworld program from the packagecloud.io blog!
%prep
%setup
%build
make PREFIX=/usr %{?_smp_mflags}
%install
make PREFIX=/usr DESTDIR=%{?buildroot} install
echo %{?buildroot}
%clean
rm -rf %{buildroot}
%files
%{_bindir}/helloworld2
ERORR
COMMAND >> yum install RPMS/x86_64/helloworld2-2.0-1.el6.x86_64.rpm
Loaded plugins: product-id, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Examining RPMS/x86_64/helloworld2-2.0-1.el6.x86_64.rpm: helloworld2-2.0-1.el6.x86_64
Marking RPMS/x86_64/helloworld2-2.0-1.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package helloworld2.x86_64 0:2.0-1.el6 will be installed
--> Processing Dependency: helloworld1 for package: helloworld2-2.0-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: helloworld2-2.0-1.el6.x86_64 (/helloworld2-2.0-1.el6.x86_64)
Requires: helloworld1
You could try using --skip-broken to work around the problem
Upvotes: 2
Views: 3180
Reputation: 2629
okay ! i got the answer !
i can either do a yum install *.rpm , which it will do its own dependency
else putting all the new rpm file into the repository and it will pick it up :)
Upvotes: 0
Reputation: 37832
since helloworld2 requires helloworld1; you should either install helloworld1 first; either install both together. Since helloworld2 depends on helloworld1; you cannot install him without installing helloworld1 first (or at the same time).
Upvotes: 2