How to make linux dowload dependencies mentioned in the requires tag in rpm spec

I have created an rpm spec file which has two require tags like :

Requires: maven >= 3.0.5
Requires: java >= 1:1.8

Open in new window

Although if any of maven or java is of lesser version the installation fails.
But how can i make it automatically download or upgrade also ?

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel McAllisterPresident, IT4SOHO, LLCCommented:
The YUM tool will do this automatically.

Rohit BajajAuthor Commented:
so just mentioning the require field in spec file is enough ?
Daniel McAllisterPresident, IT4SOHO, LLCCommented:
Yes -- and your RPM doesn't even have to be in a repository -- you can tell YUM to install the RPM from the local disk, and when it sees the dependencies, it will try to satisfy them using the repositories that it has configured.

Of course, you have to have the package names specified properly, and they have to exist in a configured repository -- but that only makes sense.

Rohit BajajAuthor Commented:
so yum will automatically look for the dependencies in its configured repositories and if it finds,
It will either update it or install it.
Also one more thing i want to know is , how to see what rpms are in the yum repositories so as to specify the correct name in the require fields.
Daniel McAllisterPresident, IT4SOHO, LLCCommented:
yum repositories are located in /etc/yum.repos.d (all files that end in .repo are scanned for entries that say "enabled=1" -- NOTE: Each file CAN contain more than 1 repo definitiion.

listing available packages is directly via yum:
   yum list


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.