summaryrefslogtreecommitdiff
path: root/add-dist-to-release-by-default.patch
blob: 374a5d536e34bfa6fc916274fc40ef22d3ce30f0 (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
From af9a2347cd725a8dbb6045d7d3e9661d524af110 Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Wed, 4 Mar 2020 16:12:58 +0800
Subject: [PATCH] add dist to release by default

---
 build/parsePreamble.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index b0a17c8..cac899a 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -808,6 +808,11 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
     case RPMTAG_VERSION:
     case RPMTAG_RELEASE:
 	SINGLE_TOKEN_ONLY;
+        if (tag == RPMTAG_RELEASE) {
+            char *dist = rpmExpand("%{?dist}",NULL);
+            rasprintf(&field,"%s%s",field,dist);
+            free(dist);
+        }
 	if (rpmCharCheck(spec, field, ALLOWED_CHARS_VERREL, NULL))
 	   goto exit;
 	headerPutString(pkg->header, tag, field);
@@ -987,6 +992,8 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
     }
     rc = RPMRC_OK;
 exit:
+    if (tag == RPMTAG_RELEASE)
+        free(field);
     return rc;	
 }
 
-- 
1.8.3.1