title: rpmbuild install dependency
body: <p>I'm new to rpmbuild + spec files and I tried the following <a href="https://blog.packagecloud.io/rpm/rpmbuild/packaging/2015/06/29/building-rpm-packages-with-rpmbuild/" rel="nofollow noreferrer">tutorial</a> to build the "hello world" example.</p>
  
  <p>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. </p>
  
  <p>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 ?</p>
  
  <p>Any example for me learn from? </p>
  
  <p><strong>SPEC FILE</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>ERORR</strong></p>
  
  <p>COMMAND >> yum install RPMS/x86_64/helloworld2-2.0-1.el6.x86_64.rpm</p>
  
  <pre><code>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
  --&gt; Running transaction check
  ---&gt; Package helloworld2.x86_64 0:2.0-1.el6 will be installed
  --&gt; Processing Dependency: helloworld1 for package: helloworld2-2.0-1.el6.x86_64
  --&gt; 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
  </code></pre>