compose-tree: Fix location of rpmdb querying for caching

We were just repeatedly hitting the cache...oops.

Also add an assertion that the returned data isn't empty.
This commit is contained in:
Colin Walters 2014-05-29 14:57:55 -04:00
parent bf0f3b3e80
commit 7ba1a9b46f

View File

@ -783,7 +783,7 @@ compute_checksum_for_compose (JsonObject *treefile_rootval,
{ {
int estatus; int estatus;
/* Ugly but it works... */ /* Ugly but it works... */
gs_free char *rpmqa_shell = g_strdup_printf ("rpm --dbpath=%s/usr/share/rpm | sort -u", gs_free char *rpmqa_shell = g_strdup_printf ("rpm --dbpath=%s/var/lib/rpm -qa | sort -u",
gs_file_get_path_cached (yumroot)); gs_file_get_path_cached (yumroot));
const char *rpmqa_argv[] = { "/bin/sh", "-c", rpmqa_shell, NULL }; const char *rpmqa_argv[] = { "/bin/sh", "-c", rpmqa_shell, NULL };
gs_free char *rpmqa_result = NULL; gs_free char *rpmqa_result = NULL;
@ -795,6 +795,13 @@ compute_checksum_for_compose (JsonObject *treefile_rootval,
if (!g_spawn_check_exit_status (estatus, error)) if (!g_spawn_check_exit_status (estatus, error))
goto out; goto out;
if (!*rpmqa_result)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Empty result from %s", rpmqa_shell);
goto out;
}
g_checksum_update (checksum, (guint8*)rpmqa_result, strlen (rpmqa_result)); g_checksum_update (checksum, (guint8*)rpmqa_result, strlen (rpmqa_result));
} }