Closed JamesMc86 closed 2 years ago
I had a brief look into this, and the upstream implementation is identical. Missing epoch values implicitly set to zero.
int rpmVersionCompare(Header first, Header second)
{
/* Missing epoch becomes zero here, which is what we want */
uint32_t epochOne = headerGetNumber(first, RPMTAG_EPOCH);
uint32_t epochTwo = headerGetNumber(second, RPMTAG_EPOCH);
// snip
}
and
uint64_t headerGetNumber(Header h, rpmTagVal tag
{
uint64_t res = 0;
struct rpmtd_s td;
if (headerGet(h, tag, &td, HEADERGET_EXT)) {
if (rpmtdCount(&td) == 1) {
res = rpmtdGetNumber(&td);
}
rpmtdFreeData(&td);
}
return res;
}
As @drahnr said, this is how it works in the "reference" implementation, so we will keep the default 0 value.
I'm not familiar enough with RPMs to know how important this is but...
In a spec file build with rpmbuild you can omit epoch. With rpm-rs this defaults to zero which seems to be different from omitting it. This causes an inconsistency when migrating here.