rpm/add-dist-to-release-by-default.patch
2022-10-25 15:33:01 +08:00

38 lines
1.1 KiB
Diff

From 67f2f371822dde322047bcae05c433a91022f334 Mon Sep 17 00:00:00 2001
From: licihua <licihua@huawei.com>
Date: Thu, 20 Oct 2022 20:32:09 +0800
Subject: [PATCH 03/22] 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 bd3da19..722d0ac 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -799,6 +799,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);
@@ -986,6 +991,8 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
}
rc = RPMRC_OK;
exit:
+ if (tag == RPMTAG_RELEASE)
+ free(field);
return rc;
}
--
2.26.2