Accepting request 96150 from home:dimstar:branches:GNOME:Factory

Push typelib change branch

OBS-URL: https://build.opensuse.org/request/show/96150
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gobject-introspection?expand=0&rev=78
This commit is contained in:
Vincent Untz 2011-12-12 15:44:10 +00:00 committed by Git OBS Bridge
parent ccd71cea6f
commit 1482df9d22
6 changed files with 194 additions and 8 deletions

133
g-ir-dep-tool.patch Normal file
View File

@ -0,0 +1,133 @@
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 g-ir-doc-tool
+bin_PROGRAMS += g-ir-dep-tool
EXTRA_DIST += \
tools/g-ir-scanner.in \
@@ -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

View File

@ -70,10 +70,33 @@ while read file; do
print_req_prov
done
;;
*.typelib)
split_name_version $(basename $file | sed 's,.typelib$,,')
oldIFS=$IFS
IFS=$'\n'
for req in $(g-ir-dep-tool $symbol $version); do
case $req in
typelib:*)
module=${req#typelib: }
split_name_version $module
print_req_prov
;;
shlib:*)
echo "${req#shlib: }${shlib_64}"
;;
esac
done
IFS=$oldIFS
;;
esac
done
}
export GI_TYPELIB_PATH="${RPM_BUILD_ROOT}/usr/lib/girepository-1.0:${RPM_BUILD_ROOT}/usr/lib64/girepository-1.0"
if [ "${HOSTTYPE}" == "x86_64" ]; then
shlib_64="()(64bit)"
fi
case $1 in
-P)
find_provides

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:399ed663c6f081c11227710e40db38469fbe6013080b48e8fc794fc65fce1dae
size 1283295

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aa8cf5035e4773d81d3b910e7fb3b09f759c64e594b941962859fa7d5646439d
size 1091184

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Tue Dec 6 16:20:59 UTC 2011 - dimstar@opensuse.org
- Add g-ir-dep-tool.patch: Inspect .typelib files and find their
dependencies to be added to the rpm packages.
- Add libtool BuildRequires and call to autoreconf, as the the
patch above touches the build system.
- Extend gi-find-deps.sh to use the new g-ir-dep-tool and add
Requires coming from the .typelib files.
-------------------------------------------------------------------
Mon Dec 5 19:46:16 UTC 2011 - dimstar@opensuse.org
- Update to version 1.31.1:
+ Scanner:
- Split CC environment variable
- Allow GObject.Object as a supercall return type
- Support --header-only flag
- Also add an rpath for library paths specified
- Only add rpaths for absolute directories
- Out the -l library name after the .o
+ Minor bug fixes
+ Bugs fixed: bgo#660338.
- Change license to spdx identifier (LGPL-2.1+).
-------------------------------------------------------------------
Thu Oct 27 13:03:29 UTC 2011 - dimstar@opensuse.org

View File

@ -18,25 +18,29 @@
Name: gobject-introspection
Version: 1.31.0
Version: 1.31.1
Release: 1
# FIXME: when bgo#629930 gets fixed, move the appropriate pkg-config files to the main package and rename the devel package to libgirepository-devel
License: LGPLv2.1+
License: LGPL-2.1+
Summary: GObject Introspection Tools
Url: http://live.gnome.org/GObjectIntrospection
Group: Development/Libraries/GNOME
Source0: http://download.gnome.org/sources/gobject-introspection/1.31/%{name}-%{version}.tar.bz2
Source0: http://download.gnome.org/sources/gobject-introspection/1.31/%{name}-%{version}.tar.xz
# gi-find-deps.sh is a rpm helper for Provides and Requires. Script creates typelib()-style Provides/Requires.
Source1: gi-find-deps.sh
Source2: gobjectintrospection.attr
Source3: gobject-introspection-typelib.template
Source99: %{name}-rpmlintrc
# PATCH-FIX-UPSTREAM g-ir-dep-tool.patch bgo#665672 dimstar@opensuse.org -- Add g-ir-dep-tool to get further automatic dependencies.
Patch0: g-ir-dep-tool.patch
BuildRequires: bison
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: libffi-devel
BuildRequires: libtool
BuildRequires: python-devel
BuildRequires: python-xml
BuildRequires: xz
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(gobject-2.0)
%if 0%{?BUILD_FROM_VCS}
@ -52,7 +56,6 @@ The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%package -n libgirepository-1_0-1
License: LGPLv2.1+
Summary: GObject Introspection Library
Group: Development/Libraries/GNOME
# Provide typelib() symbols based on gobject-introspection-typelib.template
@ -64,7 +67,6 @@ The goal of the project is to describe the APIs and collect them in
a uniform, machine readable format.
%package devel
License: LGPLv2.1+
Summary: GObject Introspection Development Files
Group: Development/Libraries/GNOME
# Note: the devel package requires the binaries, not just the library
@ -77,12 +79,14 @@ a uniform, machine readable format.
%prep
%setup -q
%patch0 -p1
%if 0%{?BUILD_FROM_VCS}
[ -x ./autogen.sh ] && NOCONFIGURE=1 ./autogen.sh
%endif
%build
autoreconf -fi
%configure \
%if 0%{?BUILD_FROM_VCS}
--enable-gtk-doc \
@ -112,6 +116,7 @@ rm -rf %{buildroot}
%doc AUTHORS CONTRIBUTORS COPYING COPYING.GPL NEWS README TODO
%{_bindir}/g-ir-annotation-tool
%{_bindir}/g-ir-compiler
%{_bindir}/g-ir-dep-tool
%{_bindir}/g-ir-doc-tool
%{_bindir}/g-ir-generate
%{_bindir}/g-ir-scanner