teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
From daf5b95c2b2a9c2e869520240651f4b3c673da38 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Fri, 28 Jul 2017 15:21:00 +0200
Subject: [PATCH] exclude respective debug files for files which are excluded

Closes: https://github.com/rpm-software-management/rpm/issues/284
Reviewed-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
(cherry picked from commit 1e7d3c58fc7c55e2dd20b5ca459f36a1cd2a3d8e)
---
 build/files.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/build/files.c b/build/files.c
index b9716b4d8..36e1ed5ea 100644
--- a/build/files.c
+++ b/build/files.c
@@ -2803,6 +2803,21 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg,
 	}
 	path = _free(path);
     }
+    /* Exclude debug files for files which were excluded in respective non-debug package */
+    for (ARGV_const_t excl = pkg->fileExcludeList; excl && *excl; excl++) {
+        const char *name = *excl;
+
+	/* generate path */
+	rasprintf(&path, "%s%s%s%s.debug", buildroot, DEBUG_LIB_DIR, name, uniquearch);
+	/* Exclude only debuginfo files which actually exist */
+	if (access(path, F_OK) == 0) {
+	    char *line = NULL;
+	    rasprintf(&line, "%%exclude %s", path + buildrootlen);
+	    argvAdd(&files, line);
+	    _free(line);
+	}
+	path = _free(path);
+    }
 
     /* add collected directories to file list */
     if (dirs) {