summaryrefslogtreecommitdiff
path: root/debuginfod/debuginfod.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'debuginfod/debuginfod.cxx')
-rw-r--r--debuginfod/debuginfod.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 6efc4fea..000820fe 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -2572,11 +2572,11 @@ handle_metadata (MHD_Connection* conn,
string sql = string(
// explicit query r_de and f_de once here, rather than the query_d and query_e
// separately, because they scan the same tables, so we'd double the work
- "select d1.executable_p, d1.debuginfo_p, 0 as source_p, b1.hex, f1.name as file "
- "from " BUILDIDS "_r_de d1, " BUILDIDS "_files f1, " BUILDIDS "_buildids b1 "
- "where f1.id = d1.content and d1.buildid = b1.id and f1.name " + op + " ? "
+ "select d1.executable_p, d1.debuginfo_p, 0 as source_p, b1.hex, f1.name as file, a1.name as archive "
+ "from " BUILDIDS "_r_de d1, " BUILDIDS "_files f1, " BUILDIDS "_buildids b1, " BUILDIDS "_files a1 "
+ "where f1.id = d1.content and a1.id = d1.file and d1.buildid = b1.id and f1.name " + op + " ? "
"union all \n"
- "select d2.executable_p, d2.debuginfo_p, 0, b2.hex, f2.name "
+ "select d2.executable_p, d2.debuginfo_p, 0, b2.hex, f2.name, NULL "
"from " BUILDIDS "_f_de d2, " BUILDIDS "_files f2, " BUILDIDS "_buildids b2 "
"where f2.id = d2.file and d2.buildid = b2.id and f2.name " + op + " ? ");
// NB: we could query source file names too, thusly:
@@ -2624,13 +2624,14 @@ handle_metadata (MHD_Connection* conn,
int m_source_p = sqlite3_column_int (*pp, 2);
string m_buildid = (const char*) sqlite3_column_text (*pp, 3) ?: ""; // should always be non-null
string m_file = (const char*) sqlite3_column_text (*pp, 4) ?: "";
+ string m_archive = (const char*) sqlite3_column_text (*pp, 5) ?: "";
// Confirm that m_file matches in the fnmatch(FNM_PATHNAME)
// sense, since sqlite's GLOB operator is a looser filter.
if (key == "glob" && fnmatch(value.c_str(), m_file.c_str(), FNM_PATHNAME) != 0)
continue;
- auto add_metadata = [metadata, m_buildid, m_file](const string& type) {
+ auto add_metadata = [metadata, m_buildid, m_file, m_archive](const string& type) {
json_object* entry = json_object_new_object();
if (NULL == entry) throw libc_exception (ENOMEM, "cannot allocate json");
defer_dtor<json_object*,int> entry_d(entry, json_object_put);
@@ -2647,6 +2648,7 @@ handle_metadata (MHD_Connection* conn,
add_entry_metadata("type", type.c_str());
add_entry_metadata("buildid", m_buildid);
add_entry_metadata("file", m_file);
+ if (m_archive != "") add_entry_metadata("archive", m_archive);
if (verbose > 3)
obatched(clog) << "metadata found local "
<< json_object_to_json_string_ext(entry,