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

