Skip to content

Commit

Permalink
Check full stream equality when deduplicating
Browse files Browse the repository at this point in the history
Previously, we assumed that any two streams having the same NSVCA
were identical. Now we can actually test for full equality before
dropping one while deduplicating. Note that this will result in a
hard failure if they aren't identical, because this means that the
enabled repositories are providing conflicting data.

Fixes: fedora-modularity#188

Signed-off-by: Stephen Gallagher <[email protected]>
  • Loading branch information
sgallagher committed May 22, 2019
1 parent 359747e commit 10e0db0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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

0 comments on commit 10e0db0

Please sign in to comment.