summaryrefslogtreecommitdiff
path: root/packaging/rpm-4.8.0-tilde.patch
blob: 1132c37fd34e22aa338cdc603c6e0ae625bf17b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Index: rpm-4.8.0-beta1/lib/rpmvercmp.c
===================================================================
--- rpm-4.8.0-beta1.orig/lib/rpmvercmp.c
+++ rpm-4.8.0-beta1/lib/rpmvercmp.c
@@ -33,12 +33,16 @@ int rpmvercmp(const char * a, const char
 
     /* 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 && !risalnum(*one) && *one != '~') one++;
+	while (*two && !risalnum(*two) && *two != '~') two++;
 
 	/* If we ran to the end of either, we are finished with the loop */
 	if (!(*one && *two)) break;
 
+	/* If exactly one side has a tilde, it is decided. */
+	if ((*one == '~') ^ (*two == '~'))
+		break;
+
 	str1 = one;
 	str2 = two;
 
@@ -103,6 +107,11 @@ int rpmvercmp(const char * a, const char
     /* this catches the case where all numeric and alpha segments have */
     /* compared identically but the segment sepparating characters were */
     /* different */
+    if (*two == '~')
+	return 1;
+    else if (*one == '~')
+	return -1;
+
     if ((!*one) && (!*two)) return 0;
 
     /* whichever version still has characters left over wins */
Index: rpm-4.8.0-beta1/build/parsePreamble.c
===================================================================
--- rpm-4.8.0-beta1.orig/build/parsePreamble.c
+++ rpm-4.8.0-beta1/build/parsePreamble.c
@@ -523,7 +523,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:
Index: rpm-4.8.0-beta1/build/parseReqs.c
===================================================================
--- rpm-4.8.0-beta1.orig/build/parseReqs.c
+++ rpm-4.8.0-beta1/build/parseReqs.c
@@ -168,7 +168,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;