Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
gobject-introspection
g-ir-dep-tool.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File g-ir-dep-tool.patch of Package gobject-introspection
From ed8a690dbe738b3096f8d43bdbc627eb3f951523 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger <dimstar@opensuse.org> Date: Tue, 6 Dec 2011 16:23:59 +0100 Subject: [PATCH] Bug 655672: g-ir-dep-scanner: Scan dependencies of a typelib and give information. This allows distributions to create automatic dependency tracking coming from .typelib files. The dependencies identified at this time are: typelib - based dependencies shared library - dependencies --- Makefile-tools.am | 10 +++++- tools/g-ir-dep-tool.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletions(-) create mode 100644 tools/g-ir-dep-tool.c diff --git a/Makefile-tools.am b/Makefile-tools.am index f84de99..6bc4da4 100644 --- a/Makefile-tools.am +++ b/Makefile-tools.am @@ -1,5 +1,6 @@ bin_PROGRAMS += g-ir-compiler g-ir-generate bin_SCRIPTS += g-ir-scanner g-ir-annotation-tool +bin_PROGRAMS += g-ir-dep-tool if BUILD_DOCTOOL bin_SCRIPTS += g-ir-doc-tool @@ -38,8 +39,15 @@ g_ir_generate_LDADD = \ libgirepository-1.0.la \ $(GIREPO_LIBS) +g_ir_dep_tool_SOURCES = tools/g-ir-dep-tool.c +g_ir_dep_tool_CFLAGS = $(GIO_CFLAGS) -I$(top_srcdir)/girepository +g_ir_dep_tool_LDADD = \ + libgirepository-internals.la \ + libgirepository-1.0.la \ + $(GIREPO_LIBS) + GCOVSOURCES = \ $(g_ir_compiler_SOURCES) \ $(g_ir_generate_SOURCES) -CLEANFILES += g-ir-scanner g-ir-annotation-tool g-ir-doc-tool +CLEANFILES += g-ir-scanner g-ir-annotation-tool g-ir-doc-tool g-ir-dep-tool diff --git a/tools/g-ir-dep-tool.c b/tools/g-ir-dep-tool.c new file mode 100644 index 0000000..800779b --- /dev/null +++ b/tools/g-ir-dep-tool.c @@ -0,0 +1,78 @@ + +/* -*- Mode: C; c-file-style: "gnu"; -*- */ +/* GObject introspection: typelib dependency scanner + * + * Copyright (C) 2011 Dominique Leuenberger + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include <glib.h> +#include <girepository.h> + +int main(int argc, char *argv[]) { + GError *err = NULL; + GITypelib *typelib; + gchar **deps; + const gchar *shlibs; + int i; + const char *namespace = argv[1]; + const char *version = argv[2]; + + g_type_init(); + + if (argc < 2 || argc > 3) { + g_print ("Usage: %s <typelib> [<version>]\n\n", argv[0]); + g_print (" typelib: The namespace of the typelib to inspect\n"); + g_print (" version: The version of the typelib to inspect\n"); + return 1; + } + + /* Try to load the typelib specified as parameter */ + typelib = g_irepository_require (NULL, namespace, version, 0, &err); + + if (!typelib) { + g_printerr ("ERROR: Failed to load typelib '%s'\n", namespace); + return 2; + } + + /* Finding all the typelib based Requires */ + deps = g_irepository_get_dependencies (NULL, namespace); + if (deps) { + for (i=0; deps[i]; i++) { + g_print ("typelib: %s\n", deps[i]); + } + g_strfreev (deps); + } + + /* Finding the shared library we depend on (if any) */ + shlibs = g_irepository_get_shared_library (NULL, namespace); + + if (shlibs != NULL && shlibs[0] != '\0') + { + /* libs is a comma-separated list of libraries */ + gchar **libs = g_strsplit (shlibs, ",", 0); + + for (i = 0; libs[i]; i++) + { + g_print ("shlib: %s\n", libs[i]); + } + } + + g_typelib_free (typelib); + + return 0; +} -- 1.7.7.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor