teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0005-reference-proper-debug-files-whenever-RemovePathPost.patch

Igor Gnatenko 53960f
From d145899932ed040cdaaed70a7ce2ea0f11757ab6 Mon Sep 17 00:00:00 2001
Igor Gnatenko 53960f
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Igor Gnatenko 53960f
Date: Fri, 28 Jul 2017 18:32:06 +0200
Igor Gnatenko 53960f
Subject: [PATCH] reference proper debug files whenever RemovePathPostfixes is
Igor Gnatenko 53960f
 used
Igor Gnatenko 53960f
Igor Gnatenko 53960f
Closes: https://github.com/rpm-software-management/rpm/issues/280
Igor Gnatenko 53960f
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Igor Gnatenko 53960f
---
Igor Gnatenko 53960f
 build/files.c | 13 +++++++++++++
Igor Gnatenko 53960f
 1 file changed, 13 insertions(+)
Igor Gnatenko 53960f
Igor Gnatenko 53960f
diff --git a/build/files.c b/build/files.c
Igor Gnatenko 53960f
index 2387a2e5b..a4b5cd6e8 100644
Igor Gnatenko 53960f
--- a/build/files.c
Igor Gnatenko 53960f
+++ b/build/files.c
Igor Gnatenko 53960f
@@ -2788,6 +2788,19 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg,
Igor Gnatenko 53960f
 	/* strip trailing .debug like in find-debuginfo.sh */
Igor Gnatenko 53960f
 	if (namel > 6 && !strcmp(name + namel - 6, ".debug"))
Igor Gnatenko 53960f
 	    namel -= 6;
Igor Gnatenko 53960f
+
Igor Gnatenko 53960f
+	/* fileRenameMap doesn't necessarily have to be initialized */
Igor Gnatenko 53960f
+	if (pkg->fileRenameMap) {
Igor Gnatenko 53960f
+	    char **names = NULL;
Igor Gnatenko 53960f
+	    int namec = 0;
Igor Gnatenko 53960f
+	    fileRenameHashGetEntry(pkg->fileRenameMap, name, &names, &namec, NULL);
Igor Gnatenko 53960f
+	    if (namec) {
Igor Gnatenko 53960f
+		if (namec > 1)
Igor Gnatenko 53960f
+		    rpmlog(RPMLOG_WARNING, _("%s was mapped to multiple filenames"), name);
Igor Gnatenko 53960f
+		name = *names;
Igor Gnatenko 53960f
+		namel = strlen(name);
Igor Gnatenko 53960f
+	    }
Igor Gnatenko 53960f
+	}
Igor Gnatenko 53960f
 	
Igor Gnatenko 53960f
 	/* generate path */
Igor Gnatenko 53960f
 	rasprintf(&path, "%s%s%.*s%s.debug", buildroot, DEBUG_LIB_DIR, namel, name, uniquearch);