RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 14-Sep-2009 23:32:21 Branch: HEAD Handle: 2009091421322001 Modified files: rpm CHANGES rpm/build parseScript.c rpm/lib psm.c rpmds.c rpm/rpmio macro.c Log: - spook: embed the "spook" DSL just like augeas (nee "augtool"). Summary: Revision Changes Path 1.3121 +1 -0 rpm/CHANGES 2.77 +6 -0 rpm/build/parseScript.c 2.379 +15 -1 rpm/lib/psm.c 2.163 +8 -2 rpm/lib/rpmds.c 2.240 +45 -0 rpm/rpmio/macro.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3120 -r1.3121 CHANGES --- rpm/CHANGES 14 Sep 2009 20:16:28 -0000 1.3120 +++ rpm/CHANGES 14 Sep 2009 21:32:20 -0000 1.3121 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: spook: embed the "spook" DSL just like augeas (nee "augtool"). - jbj: augeas: change the DSL embedding syntax from "augtool" to "augeas". - jbj: haul out some trash. - jbj: augtool: morph the rpmioC command table to popt. @@ . patch -p0 <<'@@ .' Index: rpm/build/parseScript.c ============================================================================ $ cvs diff -u -r2.76 -r2.77 parseScript.c --- rpm/build/parseScript.c 14 Sep 2009 20:16:28 -0000 2.76 +++ rpm/build/parseScript.c 14 Sep 2009 21:32:20 -0000 2.77 @@ -349,6 +349,12 @@ "BuiltinRubyScripts", "5.2-1"); } else #endif +#ifdef WITH_SEMANAGE + if (!strcmp(progArgv[0], "<spook>")) { + (void) rpmlibNeedsFeature(pkg->header, + "BuiltinSpookScripts", "5.3-1"); + } else +#endif #ifdef WITH_SQUIRREL if (!strcmp(progArgv[0], "<squirrel>")) { (void) rpmlibNeedsFeature(pkg->header, @@ . patch -p0 <<'@@ .' Index: rpm/lib/psm.c ============================================================================ $ cvs diff -u -r2.378 -r2.379 psm.c --- rpm/lib/psm.c 14 Sep 2009 20:16:28 -0000 2.378 +++ rpm/lib/psm.c 14 Sep 2009 21:32:21 -0000 2.379 @@ -20,6 +20,7 @@ #include <rpmperl.h> #include <rpmpython.h> #include <rpmruby.h> +#include <rpmsm.h> #include <rpmsquirrel.h> #include <rpmtcl.h> @@ -586,7 +587,7 @@ } #endif /* WITH_LUA */ -#if defined(WITH_LUA) || defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SQUIRREL) || defined(WITH_TCL) +#if defined(WITH_LUA) || defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SEMANAGE) || defined(WITH_SQUIRREL) || defined(WITH_TCL) static int enterChroot(rpmpsm psm, int * fdnop) /*...@globals fileSystem, internalState @*/ /*...@modifies *fdnop, fileSystem, internalState @*/ @@ -730,6 +731,19 @@ ruby = rpmrubyFree(ruby); } else #endif +#if defined(WITH_SEMANAGE) + if (!strcmp(Phe->p.argv[0], "<spook>")) { + /* XXX change rpmsmNew() to common embedded interpreter API */ + rpmsm sm = NULL; + /* XXX HACK: use an argv for now. */ + const char * av[2]; + av[0] = script; + av[1] = NULL; + rc = rpmsmRun(sm, av, NULL) == RPMRC_OK + ? RPMRC_OK : RPMRC_FAIL; + sm = rpmsmFree(sm); + } else +#endif #if defined(WITH_SQUIRREL) if (!strcmp(Phe->p.argv[0], "<squirrel>")) { rpmsquirrel squirrel = rpmsquirrelNew((const char **)av, 0); @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmds.c ============================================================================ $ cvs diff -u -r2.162 -r2.163 rpmds.c --- rpm/lib/rpmds.c 23 Aug 2009 01:58:28 -0000 2.162 +++ rpm/lib/rpmds.c 14 Sep 2009 21:32:21 -0000 2.163 @@ -193,7 +193,9 @@ NULL, NULL, rpmdsFini); pool = _rpmdsPool; } - return (rpmds) rpmioGetPool(pool, sizeof(*ds)); + ds = (rpmds) rpmioGetPool(pool, sizeof(*ds)); + memset(((char *)ds)+sizeof(ds->_item), 0, sizeof(*ds)-sizeof(ds->_item)); + return ds; } static /*...@null@*/ @@ -980,7 +982,6 @@ /*...@-compmempass@*/ /* FIX: ds->Flags is kept, not only */ return rpmdsLink(ds, (ds ? ds->Type : NULL)); /*...@=compmempass@*/ - } int rpmdsFind(rpmds ds, const rpmds ods) @@ -1491,6 +1492,11 @@ (RPMSENSE_RPMLIB|RPMSENSE_EQUAL), N_("internal embedded ruby scripts.") }, #endif +#if defined(WITH_SEMANAGE) + { "rpmlib(BuiltinSpookScripts)", "5.3-1", + (RPMSENSE_RPMLIB|RPMSENSE_EQUAL), + N_("internal embedded Spook scripts.") }, +#endif #if defined(WITH_SQUIRREL) { "rpmlib(BuiltinSquirrelScripts)", "5.2-1", (RPMSENSE_RPMLIB|RPMSENSE_EQUAL), @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/macro.c ============================================================================ $ cvs diff -u -r2.239 -r2.240 macro.c --- rpm/rpmio/macro.c 14 Sep 2009 20:16:29 -0000 2.239 +++ rpm/rpmio/macro.c 14 Sep 2009 21:32:21 -0000 2.240 @@ -77,6 +77,7 @@ #include <rpmperl.h> #include <rpmpython.h> #include <rpmruby.h> +#include <rpmsm.h> #include <rpmsquirrel.h> #include <rpmtcl.h> @@ -2067,6 +2068,50 @@ } #endif +#ifdef WITH_SEMANAGE + if (STREQ("spook", f, fn)) { + /* XXX change rpmsmNew() to common embedded interpreter API */ +#ifdef NOTYET + const char ** av = NULL; + char * script = parseEmbedded(s, (size_t)(se-s), &av); +#else + /* XXX use xstrndup (which never returns NULL) instead. */ + char * script = strndup(g, (size_t)(se-g-1)); + const char * av[2]; + /* XXX FIXME */ + static const char * _rpmsmStore = "targeted"; + static unsigned int _rpmsmFlags = 0; +#endif + rpmsm sm = (_globalI ? NULL + : rpmsmNew(_rpmsmStore, _rpmsmFlags)); + const char * result = NULL; + + /* XXX HACK: use an argv for now. */ + av[0] = script; + av[1] = NULL; + if (rpmsmRun(sm, av, &result) != RPMRC_OK) + rc = 1; + else { + if (result == NULL) result = "FIXME"; + if (result != NULL && *result != '\0') { + size_t len = strlen(result); + if (len > mb->nb) + len = mb->nb; + memcpy(mb->t, result, len); + mb->t += len; + mb->nb -= len; + } + } + sm = rpmsmFree(sm); +#ifdef NOTYET + av = _free(av); +#endif + script = _free(script); + s = se; + continue; + } +#endif + #ifdef WITH_SQUIRREL if (STREQ("squirrel", f, fn)) { const char ** av = NULL; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org