--- rpm-4.2.1/build.c 2004-07-16 14:21:10.000000000 +0900 +++ rpm-4.2.1.ruby-embed/build.c 2004-07-16 00:06:55.000000000 +0900 @@ -26,6 +26,7 @@ { rpmps ps; int rc; + rpmMessage(RPMMESS_NORMAL, _("enter checkSpec...:\n")); if (!headerIsEntry(h, RPMTAG_REQUIRENAME) && !headerIsEntry(h, RPMTAG_CONFLICTNAME)) @@ -46,6 +47,7 @@ /* XXX nuke the added package. */ rpmtsClean(ts); + rpmMessage(RPMMESS_NORMAL, _("leave checkSpec...:\n")); return rc; } --- rpm-4.2.1/rpmqv.c 2004-07-16 14:21:10.000000000 +0900 +++ rpm-4.2.1.ruby-embed/rpmqv.c 2004-07-15 23:47:09.000000000 +0900 @@ -17,6 +17,8 @@ #include "rpmps.h" #include "rpmts.h" +#include "rpmds.h" + #ifdef IAM_RPMBT #include "build.h" #define GETOPT_REBUILD 1003 @@ -151,6 +153,18 @@ poptPrintUsage(con, fp, flags); } +#include "rb_solve.h" + +static int +solve(rpmts ts, rpmds key, const void * data) +{ + VALUE args; +rb_p(rb_str_new2("hello")); + rb_funcall(rb_solve, id_solve, 1, rb_str_new2(rpmdsN(key)) ); +rb_p(rb_str_new2("world")); + return 0; +} + /*@-bounds@*/ /* LCL: segfault */ /*@-mods@*/ /* FIX: shrug */ #if !defined(__GLIBC__) && !defined(__LCLINT__) @@ -610,7 +624,13 @@ (void) close(p[1]); } +ruby_init(); +ruby_exec(); +id_solve = rb_intern("solve"); +rb_define_variable("$solve", &rb_solve); +rb_load(rb_str_new2("~/rpmb-callback.rb"), 1); ts = rpmtsCreate(); +rpmtsSetSolveCallback(ts, solve, NULL); (void) rpmtsSetRootDir(ts, rpmcliRootDir); switch (bigMode) { #ifdef IAM_RPMDB @@ -859,6 +879,7 @@ #endif /* IAM_RPMBT || IAM_RPMK */ ts = rpmtsFree(ts); +ruby_finalize(); optCon = poptFreeContext(optCon); rpmFreeMacros(NULL); --- rpm-4.2.1/rpmio/macro.c 2003-05-15 22:42:01.000000000 +0900 +++ rpm-4.2.1.ruby-embed/rpmio/macro.c 2004-07-16 00:00:41.000000000 +0900 @@ -1683,6 +1683,8 @@ } /*@=globstate@*/ +#include "rb_solve.h" + /* =============================================================== */ int isCompressed(const char * file, rpmCompressedMagic * compressed) { @@ -1690,6 +1692,8 @@ ssize_t nb; int rc = -1; unsigned char magic[4]; +rpmMessage(RPMMESS_NORMAL, "enter isCompressed...\n"); + rb_funcall(rb_solve, id_solve, 1, rb_str_new2(file) ); *compressed = COMPRESSED_NOT; @@ -1729,6 +1733,7 @@ *compressed = COMPRESSED_OTHER; } +rpmMessage(RPMMESS_NORMAL, "leave isCompressed...\n"); return rc; } --- rpm-4.2.1/rpmio/Makefile 2004-07-16 14:27:55.000000000 +0900 +++ rpm-4.2.1.ruby-embed/rpmio/Makefile 2004-07-16 00:00:16.000000000 +0900 @@ -265,6 +269,7 @@ -I$(top_srcdir) \ -I/usr/include/beecrypt \ -I$(top_srcdir)/popt \ + -I/usr/lib/ruby/1.8/i586-linux-gnu \ -I${top_srcdir}/zlib @@ -289,7 +294,7 @@ -lbeecrypt \ $(top_builddir)/file/libfmagic.la \ ${top_builddir}/zlib/libz.la \ - -lrt -lpthread + -lrt -lpthread -lruby librpmio_la_LIBADD = $(BEECRYPTLOBJS) librpmio_la_DEPENDENCIES = .created --- rpm-4.2.1/build/parsePrep.c 2004-07-16 14:21:10.000000000 +0900 +++ rpm-4.2.1.ruby-embed/build/parsePrep.c 2004-07-16 00:36:57.000000000 +0900 @@ -54,6 +54,8 @@ return 0; } +#include "rb_solve.h" + /** * Expand %patchN macro into %prep scriptlet. * @param spec build info @@ -76,6 +78,7 @@ struct Source *sp; rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; +rpmMessage(RPMMESS_NORMAL, "enter doPatch...\n"); for (sp = spec->sources; sp != NULL; sp = sp->next) { if ((sp->flags & RPMBUILD_ISPATCH) && (sp->num == c)) { @@ -103,6 +106,7 @@ if (removeEmpties) { strcat(args, " -E"); } + rb_funcall(rb_solve, id_solve, 1, rb_str_new2(sp->fullSource) ); /* XXX On non-build parse's, file cannot be stat'd or read */ if (!spec->force && (isCompressed(urlfn, &compressed) || checkOwners(urlfn))) { @@ -148,6 +152,7 @@ } urlfn = _free(urlfn); +rpmMessage(RPMMESS_NORMAL, "leave doPatch...\n"); return buf; } /*@=boundswrite@*/ @@ -171,6 +176,7 @@ struct Source *sp; rpmCompressedMagic compressed = COMPRESSED_NOT; int urltype; +rpmMessage(RPMMESS_NORMAL, "enter doUntar...\n"); for (sp = spec->sources; sp != NULL; sp = sp->next) { if ((sp->flags & RPMBUILD_ISSOURCE) && (sp->num == c)) { @@ -207,6 +213,7 @@ } } #endif + rb_funcall(rb_solve, id_solve, 1, rb_str_new2(sp->fullSource) ); /* XXX On non-build parse's, file cannot be stat'd or read */ if (!spec->force && (isCompressed(urlfn, &compressed) || checkOwners(urlfn))) { @@ -270,6 +277,7 @@ } urlfn = _free(urlfn); +rpmMessage(RPMMESS_NORMAL, "leave doUntar...\n"); return buf; } /*@=boundswrite@*/ --- rpm-4.2.1/build/Makefile 2004-07-16 14:27:59.000000000 +0900 +++ rpm-4.2.1.ruby-embed/build/Makefile 2004-07-16 00:32:38.000000000 +0900 @@ -265,6 +269,7 @@ -I$(top_srcdir)/rpmio \ -I/usr/include/beecrypt \ -I$(top_srcdir)/popt \ + -I/usr/lib/ruby/1.8/i586-linux-gnu \ \ -I${top_srcdir}/zlib --- rpm-4.2.1/Makefile 2004-07-16 14:27:51.000000000 +0900 +++ rpm-4.2.1.ruby-embed/Makefile 2004-07-16 00:03:26.000000000 +0900 @@ -96,7 +99,8 @@ INTL_LIBTOOL_SUFFIX_PREFIX = LDFLAGS = LDFLAGS_NPTL = -LDFLAGS_STATIC = -all-static +LDFLAGS_STATIC = +# -all-static LIBDIR = ${exec_prefix}/%{_lib} LIBICONV = LIBINTL = @@ -277,11 +282,13 @@ -I$(top_srcdir)/rpmio \ -I/usr/include/beecrypt \ -I$(top_srcdir)/popt \ + -I/usr/lib/ruby/1.8/i586-linux-gnu \ \ -I${top_srcdir}/zlib -staticLDFLAGS = -all-static +staticLDFLAGS = +# -all-static myLDFLAGS = -lelf -lbeecrypt @@ -314,7 +321,7 @@ rpmb_SOURCES = build.c rpmb_LDFLAGS = $(myLDFLAGS) -rpmb_LDADD = rpmb.o $(top_builddir)/build/librpmbuild.la $(myLDADD) +rpmb_LDADD = rpmb.o $(top_builddir)/build/librpmbuild.la $(myLDADD) -lruby rpmd_SOURCES = rpmd_LDFLAGS = $(myLDFLAGS)