codeMonkey
codeMonkey

Reputation: 145

Yum trying to install .el7 release on CentOS 6

I have generated two RPMs. One for CentOS 6 and one for CentOS 7.

my-package-0.0.1-1.el6.x86_64

my-package-0.0.1-1.el7.x86_64

When I do a yum info my-package on a CentOS 6 machine, it gives me the el7 information. When I do yum install my-package it does the same, gets the el7 version. Why is it doing this? I'm trying to avoid installing a el7 version on a el6 machine.

Upvotes: 3

Views: 3473

Answers (2)

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6758

It sounds like you have them in the same yum repository. You shouldn't. You should be posting one to a CentOS6 repo and the other to a CentOS7 repo. Otherwise, yum is comparing them and deciding that 7 > 6 when comparing the release tags, so therefore that's the newest package available.

The el6 (AKA "dist tag") is a convenience to the user as a suffix to the release, and is not something that RPM can select on directly.

Upvotes: 5

Thomas Dickey
Thomas Dickey

Reputation: 54583

Agreeing that apparently OP put both RPMs in the same repository, there are some details overlooked by @aaron-d-marasco:

  • the el6 tag is not a "convenience to the user" but rather a workaround by packagers.
  • if you check the meta information for the packages, you may notice that the .el6 (or .el7) in the packages provided are appended to the release tag, e.g., for zip-3.0-10.el7.x86_64, you might see something like this:

    Name : zip
    Version : 3.0
    Release : 10.el7
    Architecture: x86_64

  • the RPM selection rules use the whole tags for version and release for each name specified.

  • the dist tag mentioned is sorted along with the rest of the release tag
  • the workaround is because there is no separate meta information for distribution in the schema, but packagers want to keep track of this.
  • because the release tag is "owned" by the packager (and version by the upstream development), then the packagers get to decide how it is used for organizing packages — subject to the built-in rules for RPM selection by yum.

Further reading:

Upvotes: 4

Related Questions