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: 08-Apr-2009 01:11:08 Branch: HEAD Handle: 2009040723110701 Modified files: rpm CHANGES rpm/rpmio macro.c Log: - python: wire-up %{python:...}. the string result is bogus, todo++. Summary: Revision Changes Path 1.2907 +1 -0 rpm/CHANGES 2.218 +34 -0 rpm/rpmio/macro.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2906 -r1.2907 CHANGES --- rpm/CHANGES 7 Apr 2009 22:57:47 -0000 1.2906 +++ rpm/CHANGES 7 Apr 2009 23:11:07 -0000 1.2907 @@ -1,5 +1,6 @@ 5.2a3 -> 5.2a4: + - jbj: python: wire-up %{python:...}. the string result is bogus, todo++. - jbj: python: add --with-pythonembed for embedding python. - jbj: perl: wire-up %post -p <perl>. arg1/arg2, persistent interp, todo++. - jbj: perl: wire-up %{perl:...} with a string result. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/macro.c ============================================================================ $ cvs diff -u -r2.217 -r2.218 macro.c --- rpm/rpmio/macro.c 7 Apr 2009 17:37:01 -0000 2.217 +++ rpm/rpmio/macro.c 7 Apr 2009 23:11:08 -0000 2.218 @@ -74,6 +74,10 @@ #include <rpmperl.h> #endif +#ifdef WITH_PYTHONEMBED +#include <rpmpython.h> +#endif + #ifdef WITH_TCL #include <rpmtcl.h> #endif @@ -1746,6 +1750,36 @@ } #endif +#ifdef WITH_PYTHONEMBED + if (STREQ("python", f, fn)) { + rpmpython python = rpmpythonNew(NULL, 0); + const char *ls = s+sizeof("{python:")-1; + const char *lse = se-sizeof("}")+1; + char *scriptbuf = (char *)xmalloc((lse-ls)+1); + const char * result = NULL; + + memcpy(scriptbuf, ls, lse-ls); + scriptbuf[lse-ls] = '\0'; + if (rpmpythonRun(python, scriptbuf, &result) != RPMRC_OK) + rc = 1; + else { + 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; + } + } + scriptbuf = _free(scriptbuf); + python = rpmpythonFree(python); + s = se; + continue; + } +#endif + #ifdef WITH_TCL if (STREQ("tcl", f, fn)) { rpmtcl tcl = rpmtclNew(NULL, 0); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org