return rc;
}
+static int depContainsTilde(Header h, rpmTagVal tagEVR)
+{
+ struct rpmtd_s evrs;
+ const char *evr = NULL;
+
+ if (headerGet(h, tagEVR, &evrs, HEADERGET_MINMEM)) {
+ while ((evr = rpmtdNextString(&evrs)) != NULL)
+ if (strchr(evr, '~'))
+ break;
+ rpmtdFreeData(&evrs);
+ }
+ return evr != NULL;
+}
+
+static rpmTagVal depevrtags[] = {
+ RPMTAG_PROVIDEVERSION,
+ RPMTAG_REQUIREVERSION,
+ RPMTAG_OBSOLETEVERSION,
+ RPMTAG_CONFLICTVERSION,
+ RPMTAG_ORDERVERSION,
+ RPMTAG_TRIGGERVERSION,
+ RPMTAG_SUGGESTSVERSION,
+ RPMTAG_ENHANCESVERSION,
+ 0
+};
+
+static int haveTildeDep(Header h)
+{
+ int i;
+
+ for (i = 0; depevrtags[i] != 0; i++)
+ if (depContainsTilde(h, depevrtags[i]))
+ return 1;
+ return 0;
+}
+
static rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
CSA_t csa, char **cookie)
{
free(buf);
}
+ /* check if the package has a dependency with a '~' */
+ if (haveTildeDep(h))
+ (void) rpmlibNeedsFeature(h, "TildeInVersions", "4.10.0-1");
+
/* Create and add the cookie */
if (cookie) {
rasprintf(cookie, "%s %d", buildHost(), (int) (*getBuildTime()));
case RPMTAG_VERSION:
case RPMTAG_RELEASE:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, strlen(field), "._+%{}"))
+ if (rpmCharCheck(spec, field, strlen(field), "._+%{}~"))
goto exit;
headerPutString(pkg->header, tag, field);
break;
}
EVR = xmalloc((ve-v) + 1);
rstrlcpy(EVR, v, (ve-v) + 1);
- if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit;
+ if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}~")) goto exit;
re = ve; /* ==> next token after EVR string starts here */
} else
EVR = NULL;
{ "rpmlib(ScriptletExpansion)", "4.9.0-1",
( RPMSENSE_EQUAL),
N_("package scriptlets can be expanded at install time.") },
+ { "rpmlib(TildeInVersions)", "4.10.0-1",
+ ( RPMSENSE_EQUAL),
+ N_("dependency comparison supports versions with tilde.") },
{ NULL, NULL, 0, NULL }
};
two = str2;
/* loop through each version segment of str1 and str2 and compare them */
- while (*one && *two) {
- while (*one && !risalnum(*one)) one++;
- while (*two && !risalnum(*two)) two++;
+ while (*one || *two) {
+ while (*one && !risalnum(*one) && *one != '~') one++;
+ while (*two && !risalnum(*two) && *two != '~') two++;
+
+ /* handle the tilde separator, it sorts before everthing else */
+ if (*one == '~' || *two == '~') {
+ if (*one != '~') return 1;
+ if (*two != '~') return -1;
+ one++;
+ two++;
+ continue;
+ }
/* If we ran to the end of either, we are finished with the loop */
if (!(*one && *two)) break;