Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sgallagher committed Jul 17, 2017
1 parent 8fe4676 commit e99a7e9
Show file tree
Hide file tree
Showing 9 changed files with 1,689 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
/*~
/.*.sw[nop]
/.dirstamp
/ABOUT-NLS
/.gitignore
/ChangeLog
/GPATH
/GRTAGS
/GSYMS
/GTAGS
/ID
/INSTALL
/m4
/Makefile
/Makefile.in
/TAGS
Expand All @@ -41,7 +42,6 @@
/intltool-merge.in
/intltool-update.in
/libtool
/m4
/po/*.gmo
/po/*.header
/po/*.mo
Expand Down
1,410 changes: 1,410 additions & 0 deletions ABOUT-NLS

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
SUBDIRS = data src po

EXTRA_DIST = AUTHORS
EXTRA_DIST = AUTHORS m4/introspection.m4

DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

AUTHORS:
$(AM_V_GEN)if test -d "$(srcdir)/.git"; \
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ AX_CHECK_COMPILE_FLAG([-std=gnu11],
dnl ***********************************************************************
dnl Check for required packages
dnl ***********************************************************************
PKG_CHECK_MODULES(MODULEMD, [gio-2.0 >= 2.42])

PKG_CHECK_MODULES(YAML, [yaml-0.1])
PKG_CHECK_MODULES(GOBJECT, [gio-2.0 >= 2.42 glib-2.0 >= 2.42 gobject-introspection-1.0])

dnl ***********************************************************************
dnl Initialize Libtool
Expand Down
36 changes: 34 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,51 @@ lib_LTLIBRARIES = libmodulemd-@[email protected]
libmodulemd_@API_VERSION@_la_SOURCES = \
modulemd-version.h \
modulemd.h \
modulemd.c \
modulemd-modulemetadata.h \
modulemd-modulemetadata.c \
$(NULL)

libmodulemd_@API_VERSION@_la_CFLAGS = \
$(MODULEMD_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)

libmodulemd_@API_VERSION@_la_LIBADD = \
$(MODULEMD_LIBS) \
$(GOBJECT_LIBS) \
$(NULL)

libmodulemd_@API_VERSION@_la_LDFLAGS = \
$(WARN_LDFLAGS) \
$(NULL)

-include $(top_srcdir)/git.mk

CLEANFILES =

-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)

if HAVE_INTROSPECTION
introspection_sources = modulemd.h \
modulemd.c \
modulemd-modulemetadata.h \
modulemd-modulemetadata.c

modulemd-@[email protected]: libmodulemd-@[email protected]
modulemd_@API_VERSION@_gir_INCLUDES = GObject-2.0
modulemd_@API_VERSION@_gir_CFLAGS = $(INCLUDES)
modulemd_@API_VERSION@_gir_LIBS = libmodulemd-@[email protected]
modulemd_@API_VERSION@_gir_FILES = $(introspection_sources)
INTROSPECTION_GIRS += modulemd-@[email protected]

girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)

typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)

CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
169 changes: 169 additions & 0 deletions src/modulemd-modulemetadata.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/* modulemd-modulemetadata.c
*
* Copyright (C) 2017 Stephen Gallagher
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "modulemd-modulemetadata.h"
#include <glib.h>
#include <yaml.h>

enum
{
MD_PROP_0,

MD_PROP_NAME,

MD_N_PROPERTIES
};

static GParamSpec *md_properties[MD_N_PROPERTIES] = { NULL, };

struct module_dep_ref {
char *name;
char *ref; /* the stream, git tag or other commit-ish */
};

struct modulemd_component {
gchar *rationale;
gchar *repository;
gchar *cache;
gchar *ref;
gchar **arches;
gchar **multilib;
guint buildorder;

};

struct _ModuleMetadata
{
GObject parent_instance;

gchar *name;
gchar *stream;
gchar *version;
gchar *summary;
gchar *description;
gchar *community;
gchar *documentation;
gchar *tracker;
gchar **module_licenses;
gchar **content_licenses;
GHashTable *xmd;
struct module_dep_ref **build_deps;
struct module_dep_ref **runtime_deps;
GHashTable *profiles;
GHashTable *api;
GHashTable *filter;
GHashTable *buildopts;
GHashTable *components;
};

G_DEFINE_TYPE (ModuleMetadata, modulemd_modulemetadata, G_TYPE_OBJECT)

static void
modulemd_modulemetadata_set_property (GObject *gobject,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
ModuleMetadata *self = MODULEMD_MODULEMETADATA(gobject);

switch (property_id) {
case MD_PROP_NAME:
g_clear_pointer (&self->name, g_free);
self->name = g_value_dup_string (value);
break;

default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
}
}

static void
modulemd_modulemetadata_get_property (GObject *gobject,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
}

static void
modulemd_modulemetadata_dispose (GObject *gobject)
{
G_OBJECT_CLASS (modulemd_modulemetadata_parent_class)->dispose (gobject);
}

static void
modulemd_modulemetadata_finalize (GObject *gobject)
{
ModuleMetadata *self = MODULEMD_MODULEMETADATA(gobject);
g_clear_pointer (&self->name, g_free);

G_OBJECT_CLASS (modulemd_modulemetadata_parent_class)->finalize (gobject);
}

static void
modulemd_modulemetadata_class_init (ModuleMetadataClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

object_class->set_property = modulemd_modulemetadata_set_property;
object_class->get_property = modulemd_modulemetadata_get_property;

object_class->dispose = modulemd_modulemetadata_dispose;
object_class->finalize = modulemd_modulemetadata_finalize;

md_properties[MD_PROP_NAME] =
g_param_spec_string ("name",
"Module Name",
"A string property representing the name of "
"the module.",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);

g_object_class_install_properties (
object_class,
MD_N_PROPERTIES,
md_properties);
}

static void
modulemd_modulemetadata_init (ModuleMetadata *self)
{
}

/**
* modulemd_modulemetadata_new:
*
* Allocates a new #ModuleMetadata.
*
* Return value: a new #ModuleMetadata.
*/
ModuleMetadata *
modulemd_modulemetadata_new (void)
{
ModuleMetadata *md;

md = g_object_new (modulemd_modulemetadata_get_type(), NULL);
return md;
}
39 changes: 39 additions & 0 deletions src/modulemd-modulemetadata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* modulemd-modulemetadata.h
*
* Copyright (C) 2017 Stephen Gallagher
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef MODULEMD_MODULEMETADATA_H
#define MODULEMD_MODULEMETADATA_H

#include <glib-object.h>

G_BEGIN_DECLS

#define MODULEMD_TYPE_MODULEMETADATA modulemd_modulemetadata_get_type ()
G_DECLARE_FINAL_TYPE (ModuleMetadata, modulemd_modulemetadata, MODULEMD, MODULEMETADATA, GObject)

ModuleMetadata *modulemd_modulemetadata_new (void);

G_END_DECLS

#endif /* MODULEMD_MODULEMETADATA_H */
27 changes: 27 additions & 0 deletions src/modulemd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* modulemd.c
*
* Copyright (C) 2017 Stephen Gallagher
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "modulemd.h"


2 changes: 2 additions & 0 deletions src/modulemd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ G_BEGIN_DECLS
# include "modulemd-version.h"
#undef MODULEMD_INSIDE



G_END_DECLS

#endif /* MODULEMD_H */

0 comments on commit e99a7e9

Please sign in to comment.