Mark Wielaard b70aa8
diff --git a/build/files.c b/build/files.c
Mark Wielaard b70aa8
index 26f53bd..8b516c6 100644
Mark Wielaard b70aa8
--- a/build/files.c
Mark Wielaard b70aa8
+++ b/build/files.c
Mark Wielaard b70aa8
@@ -1699,7 +1699,11 @@ static int generateBuildIDs(FileList fl)
Mark Wielaard b70aa8
     if (build_id_links == BUILD_IDS_NONE || rc != 0)
Mark Wielaard b70aa8
 	return rc;
Mark Wielaard b70aa8
 
Mark Wielaard b70aa8
-    int terminate = rpmExpandNumeric("%{?_missing_build_ids_terminate_build}");
Mark Wielaard b70aa8
+    /* Historically we have only checked build_ids when __debug_package
Mark Wielaard b70aa8
+       was defined. So don't terminate the build if __debug_package is
Mark Wielaard b70aa8
+       unset, even when _missing_build_ids_terminate_build is. */
Mark Wielaard b70aa8
+    int terminate = (rpmExpandNumeric("%{?_missing_build_ids_terminate_build}")
Mark Wielaard b70aa8
+		     && rpmExpandNumeric("%{?__debug_package}"));
Mark Wielaard b70aa8
 
Mark Wielaard b70aa8
     /* Collect and check all build-ids for ELF files in this package.  */
Mark Wielaard b70aa8
     int needMain = 0;