Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check full stream equality when deduplicating #304

Merged
merged 2 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modulemd/v2/modulemd-module-stream-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ modulemd_module_stream_v1_equals (ModulemdModuleStream *self_1,
if (v1_self_1->xmd == NULL || v1_self_2->xmd == NULL)
return FALSE;

if (g_variant_equal (v1_self_1->xmd, v1_self_2->xmd) != 0)
if (!g_variant_equal (v1_self_1->xmd, v1_self_2->xmd))
return FALSE;

return TRUE;
Expand Down
2 changes: 1 addition & 1 deletion modulemd/v2/modulemd-module-stream-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ modulemd_module_stream_v2_equals (ModulemdModuleStream *self_1,
if (v2_self_1->xmd == NULL || v2_self_2->xmd == NULL)
return FALSE;

if (g_variant_equal (v2_self_1->xmd, v2_self_2->xmd) != 0)
if (!g_variant_equal (v2_self_1->xmd, v2_self_2->xmd))
return FALSE;

return TRUE;
Expand Down
15 changes: 11 additions & 4 deletions modulemd/v2/modulemd-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,17 @@ modulemd_module_add_stream (ModulemdModule *self,
* favor of the new one.
*/

/* TODO: Do a full equality check on the two ModuleStreams once
* https://github.com/fedora-modularity/libmodulemd/issues/186 is
* fixed.
*/
if (!modulemd_module_stream_equals (old, stream))
{
/* The two streams have matching NSVCA, but differ in content */
g_set_error (error,
MODULEMD_ERROR,
MODULEMD_ERROR_VALIDATE,
"Encountered two streams with matching NSVCA %s but "
"differing content",
modulemd_module_stream_get_NSVCA_as_string (stream));
return MD_MODULESTREAM_VERSION_ERROR;
}

/* First, drop the existing stream */
g_ptr_array_remove (self->streams, old);
Expand Down
2 changes: 1 addition & 1 deletion modulemd/v2/tests/test-modulemd-merger.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ merger_test_deduplicate (CommonMmdTestFixture *fixture,

/* Resolve the merge, which should deduplicate all entries */
merged_index = modulemd_module_index_merger_resolve (merger, &error);
g_assert_no_error (error);
g_assert_nonnull (merged_index);
g_assert_null (error);

deduplicated = modulemd_module_index_dump_to_string (merged_index, &error);
g_assert_nonnull (deduplicated);
Expand Down