yum 如何比较版本?

发布于 2024-09-04 21:32:29 字数 467 浏览 3 评论 0原文

我们有一个 Web 应用程序,我们将其打包到 RPM 中。 我们的 RPM 版本字段有问题。

假设我们已经安装了 rpm:foo-2.1.0.007

007 是我们的内部版本号。

现在,当我们尝试安装较新的 rpm foo-2.1.0.010 时,yum 会显示“没有任何内容需要更新”。

当我重新制作 RPM,但删除了前导零时,问题就解决了:

foo-2.1.0.7

foo-2.1.0.10

根据 此链接 版本的每个段都作为整数进行比较,但实践表明并非如此。

所以我的问题是: RPM 的版本比较算法是什么以及为什么前导零会干扰?

We have a web app we package into an RPM.
We have a problem with the version field of the RPM.

Let's say we have installed our rpm: foo-2.1.0.007

007 is our build number.

Now when we try to install a newer rpm, foo-2.1.0.010, yum says "There's nothing to update".

When I've remade the RPMs, but removed the leading zeroes, the problem was solved:

foo-2.1.0.7

foo-2.1.0.10

According to this link each segment of the version is compared as an integer, but practice shows otherwise.

So my question is: What is the version comparison algorithm for RPM and why leading zeroes interfere?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

末が日狂欢 2024-09-11 21:32:29

Yum 只是要求 rpm 来比较它们。您可以安装 rpmdevtools,然后使用:

% rpmdev-vercmp foo-2.1.0.010 foo-2.1.0.007
0:foo-2.1.0.010 is newer

...这就是您所期望的。除非你在 007 包中有一个纪元,否则我不确定为什么你会得到不同的答案。你有什么版本的rpm? vercmp 对你说了什么?

Yum just asks rpm to compare them. You can install rpmdevtools, and you then use:

% rpmdev-vercmp foo-2.1.0.010 foo-2.1.0.007
0:foo-2.1.0.010 is newer

...which is what you'd expect. Unless you have an epoch in the 007 package, I'm not sure why you are getting a different answer. What version of rpm do you have? What does vercmp say for you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文