rpm/SOURCES/0001-Fix-Treat-x86_64_v2-as-x86_64-in-architecture-checks.patch

59 lines
1.8 KiB
Diff

From 834feed695b5cb5ea27aaa23936eaeda2372b56b Mon Sep 17 00:00:00 2001
From: eabdullin <ed.abdullin.1@gmail.com>
Date: Tue, 9 Jul 2024 17:03:27 +0300
Subject: [PATCH] Fix: Treat x86_64_v2 as x86_64 in architecture checks
This change allows spec files to use x86_64_v2 as an alias for x86_64, ensuring compatibility with packages and build scripts expecting x86_64.
---
build/parsePreamble.c | 4 ++++
build/parseSpec.c | 17 +++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index de205d5..a8f3b47 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -425,6 +425,10 @@ static int isMemberInEntry(Header h, const char *name, rpmTagVal tag)
return -1;
while ((str = rpmtdNextString(&td))) {
+ if (!rstrcasecmp(str, "x86_64") && !rstrcasecmp(name, "x86_64_v2")) {
+ found = 1;
+ break;
+ }
if (!rstrcasecmp(str, name)) {
found = 1;
break;
diff --git a/build/parseSpec.c b/build/parseSpec.c
index d6e998a..102ce5b 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -425,7 +425,24 @@ do { \
return PART_ERROR; \
} \
match = matchTok(exp, s); \
+ /* Additional check for x86_64_v2 */ \
+ char *s_copy = strdup(s); \
+ if (s_copy == NULL) { \
+ rpmlog(RPMLOG_ERR, _("Memory allocation error\n")); \
+ return PART_ERROR; \
+ } \
+ char *newline = strchr(s_copy, '\n'); \
+ if (newline) *newline = '\0'; \
+ char *token_ptr = strtok(s_copy, " "); \
+ while (token_ptr != NULL) { \
+ if (!match && strcmp(token_ptr, "x86_64") == 0 && strcmp(exp, "x86_64_v2") == 0) { \
+ match = 1; \
+ break; \
+ } \
+ token_ptr = strtok(NULL, " "); \
+ } \
free(exp); \
+ free(s_copy); \
} while (0)
--
2.39.3 (Apple Git-146)