diff options
author | Christiaan Welvaart <cjw@mageia.org> | 2011-07-07 16:29:04 +0000 |
---|---|---|
committer | Christiaan Welvaart <cjw@mageia.org> | 2011-07-07 16:29:04 +0000 |
commit | 2b0222bf310ddfd221e18d0bae46e803c04db1d2 (patch) | |
tree | 31849aab2b50973f490dbbd9471e98a293530cfb | |
parent | 61343fb5caf3dc815a8616cf912af1401ced05ec (diff) | |
download | rpm-setup-2b0222bf310ddfd221e18d0bae46e803c04db1d2.tar rpm-setup-2b0222bf310ddfd221e18d0bae46e803c04db1d2.tar.gz rpm-setup-2b0222bf310ddfd221e18d0bae46e803c04db1d2.tar.bz2 rpm-setup-2b0222bf310ddfd221e18d0bae46e803c04db1d2.tar.xz rpm-setup-2b0222bf310ddfd221e18d0bae46e803c04db1d2.zip |
- extract gobject introspection typelib interdependencies using a helper program1.137
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | g-ir-extract-deps.c | 68 | ||||
-rwxr-xr-x | gi-find-deps.sh.in (renamed from gi-find-deps.sh) | 6 |
5 files changed, 86 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am index aa517c1..73750d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,19 +51,20 @@ pkg_scripts = \ pythoneggs.py \ rubygems.rb \ desktop-file.prov \ - fontconfig.prov \ - gi-find-deps.sh + fontconfig.prov pkg_gscripts = \ find-provides \ find-requires \ - find-provides.perl + find-provides.perl \ + gi-find-deps.sh pkg_scripts_in = $(pkg_gscripts:=.in) BUILT_SOURCES = macros-perarch make_arch_macrosfiles.sh rpmgenplatform pkglibdir = @RPMVENDORDIR@ +pkglibexecdir = @RPMVENDORDIR@ noinst_PROGRAMS = rpmeval @@ -71,6 +72,10 @@ rpmeval_SOURCES = rpmeval.c rpmeval_LDFLAGS = -lrpm +pkglibexec_PROGRAMS = g-ir-extract-deps + +g_ir_extract_deps_SOURCES = g-ir-extract-deps.c + noinst_DATA = $(pkg_gconfig) pkglib_DATA = \ @@ -1,3 +1,6 @@ +Version 1.137 - 7 July 2011, by Christiaan Welvaart +- extract gobject introspection typelib interdependencies using a helper program + Version 1.136 - 6 July 2011, by Nicolas Vigier - fix typo added in find-requires script diff --git a/configure.ac b/configure.ac index 10acd63..c3aef0b 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # $Id: configure.ac 271266 2010-11-04 10:43:28Z fwang $ AC_PREREQ(2.59) -AC_INIT(rpm-mageia-setup, 1.136, boklm@mars-attacks.org) +AC_INIT(rpm-mageia-setup, 1.137, boklm@mars-attacks.org) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 -Wno-portability) AC_CONFIG_SRCDIR diff --git a/g-ir-extract-deps.c b/g-ir-extract-deps.c new file mode 100644 index 0000000..1c1735d --- /dev/null +++ b/g-ir-extract-deps.c @@ -0,0 +1,68 @@ +/* + extract the dependencies string from a GObject Introspection 1.0 typelib file + and print it on stdout +*/ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> + +#define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032" + +int main(int argc, char ** argv) +{ + FILE * typelib; + char * magic; + uint32_t deps_offset; + char * deps; + + if (argc < 2) + { + fprintf(stderr, "too few arguments\n"); + exit(1); + } + + typelib = fopen(argv[1], "r"); + if (typelib == NULL) + { + fprintf(stderr, "failed to open %s\n", argv[1]); + exit(1); + } + magic = malloc(16); + deps = malloc(8192); + if ((magic == NULL) || (deps == NULL)) + { + fprintf(stderr, "failed to allocate memory\n"); + exit(1); + } + if (fread(magic, 16, 1, typelib) < 1) + { + fprintf(stderr, "failed to read magic from typelib\n"); + exit(1); + } + if (strcmp(magic, G_IR_MAGIC)) + { + fprintf(stderr, "magic mismatch, not a typelib?\n"); + exit(1); + } + + fseek(typelib, 36, SEEK_SET); + if (fread(&deps_offset, 4, 1, typelib) < 1) + { + fprintf(stderr, "failed to read deps offset from typelib\n"); + exit(1); + } + fseek(typelib, deps_offset, SEEK_SET); + if (fscanf(typelib, "%8191s", deps) < 1) + { + fprintf(stderr, "failed to read deps from typelib\n"); + exit(1); + } + + free(deps); + free(magic); + fclose(typelib); + + printf("%s\n", deps); + return 0; +} diff --git a/gi-find-deps.sh b/gi-find-deps.sh.in index 5cb3905..0a356c2 100755 --- a/gi-find-deps.sh +++ b/gi-find-deps.sh.in @@ -70,6 +70,12 @@ while read file; do print_req_prov done ;; + *.typelib) + for module in $(@RPMVENDORDIR@/g-ir-extract-deps $file | tr '|' ' '); do + split_name_version $module + print_req_prov + done + ;; esac done } |