rpmEVRcmp(A,B) made asymmetric wrt underspecified release

(Analoguous to the change in rpm-4.13-alt6
cfa573f99fbabf7610cec1fb0ee1993f9640b090,
made with help of Vladimir D. Seleznev <vseleznv@altlinux.org>.)

Unchanged (wanted) behavior: On the side of Requires (B), a missing
("underspecified") release means that the relative order of A and B
(result of comparison) is determined only by the speicified components
(epoch, version):

  such B is equal to any A with an equal epoch and version (and any release);
  such B is greater than A if B's epoch-version is greater than A's;
  etc.

A similar treatment of an underspecified release on the side of
Provides (A) was unwanted and it has been changed now:

  a B with a non-empty release can't be equal to such A (with a
  missing release);
  namely, a B with a non-empty release is greater than an A with equal
  epoch-version and no release.

Example of a satisfied dependency (worked before and works now):

  Provides: N = V-R
  Requires: N = V

Example of an unsatisfied dependency (previously, this satisfied the Requires):

  Provides: N = V
  Requires: N = V-R

We don't want this Requires to be satisfied in this case.
This commit is contained in:
Ivan Zakharyaschev 2019-02-12 15:19:45 +03:00
parent 6162356696
commit e9f11c0720

View File

@ -177,8 +177,16 @@ rpmEVRcmp(const char * const aE, const char * const aV, const char * const aR,
if (sense == 0) {
sense = rpmvercmp(aV, bV);
if (sense == 0 && aR && *aR && bR && *bR) {
sense = rpmvercmp(aR, bR);
if (sense == 0) {
if (aR && *aR && bR && *bR)
sense = rpmvercmp(aR, bR);
else if (aR && *aR) {
/* Support for underspecification on the side of Requires/Conflicts */
rpmMessage(RPMMESS_DEBUG, _("the \"B\" dependency doesn't specify a release, letting it match any in \"A\"\n\tA %s\tB %s\n"),
aDepend, bDepend);
sense = 0;
} else if (bR && *bR)
sense = -1;
}
}