RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 07-Apr-2009 19:57:05 Branch: HEAD Handle: 2009040717570401 Modified files: rpm CHANGES rpm/build parseScript.c rpm/lib psm.c rpmds.c Log: - perl: wire-up %post -p <perl>. arg1/arg2, persistent interp, todo++. Summary: Revision Changes Path 1.2905 +1 -0 rpm/CHANGES 2.68 +6 -0 rpm/build/parseScript.c 2.356 +19 -4 rpm/lib/psm.c 2.145 +5 -0 rpm/lib/rpmds.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2904 -r1.2905 CHANGES --- rpm/CHANGES 7 Apr 2009 17:37:01 -0000 1.2904 +++ rpm/CHANGES 7 Apr 2009 17:57:04 -0000 1.2905 @@ -1,5 +1,6 @@ 5.2a3 -> 5.2a4: + - jbj: perl: wire-up %post -p <perl>. arg1/arg2, persistent interp, todo++. - jbj: perl: wire-up %{perl:...} with a string result. - jbj: perl: add --with-perlembed for embedding perl. - jbj: tcl: wire-up %post -p <tcl>. arg1/arg2, persistent interp, todo++. @@ . patch -p0 <<'@@ .' Index: rpm/build/parseScript.c ============================================================================ $ cvs diff -u -r2.67 -r2.68 parseScript.c --- rpm/build/parseScript.c 6 Apr 2009 23:43:17 -0000 2.67 +++ rpm/build/parseScript.c 7 Apr 2009 17:57:04 -0000 2.68 @@ -313,6 +313,12 @@ "BuiltinLuaScripts", "4.2.2-1"); } else #endif +#ifdef WITH_PERLEMBED + if (!strcmp(progArgv[0], "<perl>")) { + (void) rpmlibNeedsFeature(pkg->header, + "BuiltinPerlScripts", "5.2-1"); + } else +#endif #ifdef WITH_TCL if (!strcmp(progArgv[0], "<tcl>")) { (void) rpmlibNeedsFeature(pkg->header, @@ . patch -p0 <<'@@ .' Index: rpm/lib/psm.c ============================================================================ $ cvs diff -u -r2.355 -r2.356 psm.c --- rpm/lib/psm.c 6 Apr 2009 23:43:18 -0000 2.355 +++ rpm/lib/psm.c 7 Apr 2009 17:57:05 -0000 2.356 @@ -12,6 +12,7 @@ #include <rpmmacro.h> #include <rpmurl.h> #include <rpmlua.h> +#include <rpmperl.h> #include <rpmtcl.h> #include <rpmtag.h> #include <rpmtypes.h> @@ -555,7 +556,7 @@ } #endif /* WITH_LUA */ -#if defined(WITH_LUA) || defined(WITH_TCL) +#if defined(WITH_LUA) || defined(WITH_TCL) || defined(WITH_PERL) static int enterChroot(rpmpsm psm, int * fdnop) /*...@globals fileSystem, internalState @*/ /*...@modifies *fdnop, fileSystem, internalState @*/ @@ -581,7 +582,7 @@ } else inChroot = 1; - /* All lua scripts run with CWD == "/". */ + /* All embedded scriptlets run with CWD == "/". */ xx = Chdir("/"); return inChroot; @@ -643,6 +644,17 @@ rc = runLuaScript(psm, sln, Phe, script, arg1, arg2); } else #endif +#if defined(WITH_PERLEMBED) + if (!strcmp(Phe->p.argv[0], "<perl>")) { + rpmperl perl = rpmperlNew(NULL, 0); + /* XXX TODO: wire up arg1 and arg2, handle other args too. */ + if (rpmperlRun(perl, script, NULL) == RPMRC_OK) + rc = RPMRC_OK; + else + rc = RPMRC_FAIL; + perl = rpmperlFree(perl); + } else +#endif #if defined(WITH_TCL) if (!strcmp(Phe->p.argv[0], "<tcl>")) { rpmtcl tcl = rpmtclNew(NULL, 0); @@ -740,8 +752,11 @@ } if (Phe->p.argv && Phe->p.argv[0]) - if (!strcmp(Phe->p.argv[0], "<lua>") || !strcmp(Phe->p.argv[0], "<tcl>")) { -#if defined(WITH_LUA) || defined(WITH_TCL) + if (!strcmp(Phe->p.argv[0], "<lua>") + || !strcmp(Phe->p.argv[0], "<perl>") + || !strcmp(Phe->p.argv[0], "<tcl>")) + { +#if defined(WITH_LUA) || defined(WITH_TCL) || defined(WITH_PERLEMBED) rpmlog(RPMLOG_DEBUG, D_("%s: %s(%s) running %s scriptlet.\n"), psm->stepName, tag2sln(psm->scriptTag), NVRA, Phe->p.argv[0]); @@ . patch -p0 <<'@@ .' Index: rpm/lib/rpmds.c ============================================================================ $ cvs diff -u -r2.144 -r2.145 rpmds.c --- rpm/lib/rpmds.c 6 Apr 2009 23:43:18 -0000 2.144 +++ rpm/lib/rpmds.c 7 Apr 2009 17:57:05 -0000 2.145 @@ -1474,6 +1474,11 @@ ( RPMSENSE_EQUAL), N_("internal embedded lua scripts.") }, #endif +#if defined(WITH_PERLEMBED) + { "rpmlib(BuiltinPerlScripts)", "5.2-1", + ( RPMSENSE_EQUAL), + N_("internal embedded perl scripts.") }, +#endif #if defined(WITH_TCL) { "rpmlib(BuiltinTclScripts)", "5.2-1", ( RPMSENSE_EQUAL), @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
