From f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 15 Mar 2024 16:41:28 +0200
Subject: [PATCH] Fix some int/enum confusion in the build code

These things are not really returning rpmRC values, especially as they
need to pass around RPMRC_MISSINGBUILDREQUIRES which is not part of the
enum.

For doRmSource(), 0 and 1 aren't any more enums values than 0 and -1 are,
and besides, the sole caller isn't even checking the return code.

Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b

---
 build/build.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/build/build.c b/build/build.c
index 8e6c8f842..69ab69fc9 100644
--- a/build/build.c
+++ b/build/build.c
@@ -78,7 +78,7 @@ static char * buildHost(void)
 
 /**
  */
-static rpmRC doRmSource(rpmSpec spec)
+static int doRmSource(rpmSpec spec)
 {
     struct Source *p;
     Package pkg;
@@ -100,7 +100,7 @@ static rpmRC doRmSource(rpmSpec spec)
 	}
     }
 exit:
-    return !rc ? 0 : 1;
+    return rc;
 }
 
 /*
@@ -290,9 +290,9 @@ static int doBuildRequires(rpmSpec spec, int test)
     return rc;
 }
 
-static rpmRC doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
+static int doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
 {
-    rpmRC rc = RPMRC_OK;
+    int rc = RPMRC_OK;
     rpmps ps = rpmSpecCheckDeps(ts, spec);
 
     if (ps) {
@@ -323,9 +323,9 @@ static rpmRC doBuildDir(rpmSpec spec, int test, StringBuf *sbp)
     return rc;
 }
 
-static rpmRC buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
+static int buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
 {
-    rpmRC rc = RPMRC_OK;
+    int rc = RPMRC_OK;
     int missing_buildreqs = 0;
     int test = (what & RPMBUILD_NOBUILD);
     char *cookie = buildArgs->cookie ? xstrdup(buildArgs->cookie) : NULL;
-- 
2.33.0

