SHA256
3
0
forked from pool/rpm
rpm/tilde.diff

117 lines
3.7 KiB
Diff

--- ./build/pack.c.orig 2012-04-20 13:43:49.000000000 +0000
+++ ./build/pack.c 2012-04-20 14:23:57.000000000 +0000
@@ -308,6 +308,44 @@ static rpmRC processScriptFiles(rpmSpec
return RPMRC_OK;
}
+/**
+ */
+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)
{
@@ -382,6 +420,10 @@ static rpmRC writeRPM(Header *hdrp, unsi
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()));
--- ./build/parsePreamble.c.orig 2012-04-20 14:29:26.000000000 +0000
+++ ./build/parsePreamble.c 2012-04-20 14:30:18.000000000 +0000
@@ -671,7 +671,7 @@ static int handlePreambleTag(rpmSpec spe
case RPMTAG_VERSION:
case RPMTAG_RELEASE:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, strlen(field), "._+%{}") != RPMRC_OK) return RPMRC_FAIL;
+ if (rpmCharCheck(spec, field, strlen(field), "._+%{}~") != RPMRC_OK) return RPMRC_FAIL;
headerPutString(pkg->header, tag, field);
break;
case RPMTAG_URL:
--- ./build/parseReqs.c.orig 2012-04-20 14:29:22.000000000 +0000
+++ ./build/parseReqs.c 2012-04-20 14:29:57.000000000 +0000
@@ -170,7 +170,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package p
}
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;
--- ./lib/rpmds.c.orig 2012-04-20 13:44:06.000000000 +0000
+++ ./lib/rpmds.c 2012-04-20 13:44:12.000000000 +0000
@@ -913,6 +913,9 @@ static const struct rpmlibProvides_s rpm
{ "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 }
};
--- ./lib/rpmvercmp.c.orig 2012-04-20 13:44:06.000000000 +0000
+++ ./lib/rpmvercmp.c 2012-04-20 13:44:12.000000000 +0000
@@ -32,9 +32,18 @@ int rpmvercmp(const char * a, const char
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;