I have to deal with some specific custom in-house repository for yum. I want to be able to install the lastest tagged version of my package. Repo at the same time contains hundreds of different snapshot version of packages and algo tagged, release versions. You can tell the difference by doing yum info on a specifiv version, e.g.

yum info mypkg-0.18.0-1

This returns

Available Packages Name : mypkg Arch : noarch Version : 0.18.0 Release : 1 Size : 25 k Repo : in-house-repo Summary : My package summary URL : http://example.com License : Proprietary Description : sample description

I can tell the difference between tagged and snapshotted version only by looking at the Release field.

  • if Release is 1, then the version is tagged and ready for production
  • if Release is 0.0.x, then this is a snapshot version of the package

What I want to do is to automatically install the latest tagged version of my script, which means the highest version found with the Release field set to 1.

Is there a way to do this without some dirty scripts parsing output with grep?

  • One idea would be to create a separate yum repo containing production rpms, another containing snapshots. Can then do stuff like yum --disablerepo=snapshotrepo install mypkg. You've also the option of not even presenting snapshotrepo to your production estate. – steve Jul 7 '17 at 9:30
  • Yup I agree with this, problem is right now (for at least ~month) I have no way to enforce my company to change their repo handling policy :( – Niemand Jul 7 '17 at 9:47
  • Ouch. Thought about writing a yum plugin, or seeing if the existing 'versionlock' plugin could help ? cyberciti.biz/faq/… – steve Jul 7 '17 at 10:16
  • 1
    Hmm... come to think of it, I can probably make it work with versionlock and proper regexp. Will try later today, thanks for the tip! – Niemand Jul 7 '17 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.