Skip to content

Commit 37c907d

Browse files
committed
Merge branch 'master' into 2.0-dev
2 parents 5e318ce + 7801251 commit 37c907d

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

modulemd/v1/include/modulemd-1.0/private/modulemd-util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ modulemd_error_quark (void);
2525

2626
enum ModulemdError
2727
{
28-
MODULEMD_ERROR_PROGRAMMING
28+
MODULEMD_ERROR_PROGRAMMING,
29+
MODULEMD_ERROR_MISSING_CONTENT
2930
};
3031

3132
GHashTable *

modulemd/v1/modulemd-util.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ module_index_from_data (GPtrArray *data, GError **error)
370370
gsize i = 0;
371371
gsize j = 0;
372372
g_autofree gchar *module_name = NULL;
373+
g_autofree gchar *stream_name = NULL;
373374
g_autoptr (ModulemdImprovedModule) module = NULL;
374375
ModulemdImprovedModule *stored_module = NULL;
375376
ModulemdModuleStream *stream = NULL;
@@ -404,6 +405,18 @@ module_index_from_data (GPtrArray *data, GError **error)
404405
{
405406
stream = MODULEMD_MODULESTREAM (item);
406407
module_name = modulemd_modulestream_get_name (stream);
408+
stream_name = modulemd_modulestream_get_stream (stream);
409+
410+
if (!module_name || !stream_name)
411+
{
412+
g_set_error (error,
413+
MODULEMD_ERROR,
414+
MODULEMD_ERROR_MISSING_CONTENT,
415+
"Module streams without a module name or stream "
416+
"name may not be read into an index.");
417+
return NULL;
418+
}
419+
407420
module = get_or_create_module_from_index (module_index, module_name);
408421

409422
/* Add the stream to this module. Note: if the same stream name
@@ -441,6 +454,7 @@ module_index_from_data (GPtrArray *data, GError **error)
441454

442455
g_clear_pointer (&module, g_object_unref);
443456
g_clear_pointer (&module_name, g_free);
457+
g_clear_pointer (&stream_name, g_free);
444458
}
445459

446460
/* Iterate through the translations and associate them to the appropriate

modulemd/v1/tests/test-modulemd-yaml.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,9 @@ modulemd_yaml_test_index_from_string (YamlFixture *fixture,
492492
ModulemdImprovedModule *module = NULL;
493493

494494
yaml_string =
495-
"document: modulemd\nversion: 2\ndata:\n name: Foo\n summary: Foo\n "
496-
" "
497-
"description: >\n Bar\n license:\n module:\n - "
498-
"MIT";
495+
"document: modulemd\nversion: 2\ndata:\n name: Foo\n stream: Foo\n "
496+
" summary: Foo\n description: >\n Bar\n license:\n "
497+
"module:\n - zMIT";
499498

500499
module_index =
501500
parse_module_index_from_string (yaml_string, &failures, &error);

0 commit comments

Comments
 (0)