RPM Package Manager, CVS Repository
/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 18-Sep-2010 21:47:30
Branch: rpm-5_3 Handle: 2010091819472802
Modified files: (Branch: rpm-5_3)
rpm CHANGES devtool.conf
rpm/build parseScript.c
rpm/js Makefile.am
rpm/lib psm.c rpmds.c
rpm/rpmio macro.c rpmjs.c rpmjs.h
Log:
- gpsee: replace WITH_JS everwhere with WITH_GPSEE. GPSEE->JS always.
Summary:
Revision Changes Path
1.3296.2.73 +1 -0 rpm/CHANGES
2.77.2.2 +1 -1 rpm/build/parseScript.c
2.333.2.20 +3 -3 rpm/devtool.conf
1.43.2.1 +5 -5 rpm/js/Makefile.am
2.394.2.3 +2 -2 rpm/lib/psm.c
2.167.2.2 +1 -1 rpm/lib/rpmds.c
2.246.2.2 +3 -3 rpm/rpmio/macro.c
1.34.2.1 +138 -75 rpm/rpmio/rpmjs.c
1.8.2.2 +6 -0 rpm/rpmio/rpmjs.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.3296.2.72 -r1.3296.2.73 CHANGES
--- rpm/CHANGES 18 Sep 2010 18:25:03 -0000 1.3296.2.72
+++ rpm/CHANGES 18 Sep 2010 19:47:28 -0000 1.3296.2.73
@@ -4,6 +4,7 @@
- jbj: mongo: replace internal md5 digest with rpmDigestInit().
- jbj: mongo: refactor to export from -lrpmio (with no AutoFu!).
- jbj: mongo: stub-in a mongo spewage alias as --wdj:srpm.mongo.
+ - jbj: gpsee: replace WITH_JS everwhere with WITH_GPSEE. GPSEE->JS always.
- jbj: update api-sanity-autotest.pl to 1.10.
- jbj: permit building --without-sqlite again.
- bero: Support building with Python 2.7.x
@@ .
patch -p0 <<'@@ .'
Index: rpm/build/parseScript.c
============================================================================
$ cvs diff -u -r2.77.2.1 -r2.77.2.2 parseScript.c
--- rpm/build/parseScript.c 25 Apr 2010 14:21:17 -0000 2.77.2.1
+++ rpm/build/parseScript.c 18 Sep 2010 19:47:29 -0000 2.77.2.2
@@ -328,7 +328,7 @@
"BuiltinFiclScripts", "5.2-1");
} else
#endif
-#ifdef WITH_JS
+#ifdef WITH_GPSEE
if (!strcmp(progArgv[0], "<js>")) {
(void) rpmlibNeedsFeature(pkg->header,
"BuiltinJavaScript", "5.2-1");
@@ .
patch -p0 <<'@@ .'
Index: rpm/devtool.conf
============================================================================
$ cvs diff -u -r2.333.2.19 -r2.333.2.20 devtool.conf
--- rpm/devtool.conf 18 Sep 2010 18:25:04 -0000 2.333.2.19
+++ rpm/devtool.conf 18 Sep 2010 19:47:28 -0000 2.333.2.20
@@ -5,13 +5,13 @@
%common
MODULE_NAMES="db lua pcre syck neon beecrypt" # bash file rc xar xz
MODULE_TAG_BASH="rpm-5_3" # XXX bash is GPLv2 and cannot be bundled w RPM
- MODULE_TAG_BEECRYPT=""
+ MODULE_TAG_BEECRYPT="rpm-5_3"
MODULE_TAG_DB="rpm-5_3"
MODULE_TAG_FICL="rpm-5_3"
MODULE_TAG_FILE="rpm-5_3"
MODULE_TAG_JS_SRC="rpm-5_3"
MODULE_TAG_LUA="rpm-5_3"
- MODULE_TAG_NEON=""
+ MODULE_TAG_NEON="rpm-5_3"
MODULE_TAG_PCRE="rpm-5_3"
MODULE_TAG_RC="rpm-5_3"
MODULE_TAG_SYCK="rpm-5_3"
@@ -118,7 +118,7 @@
--without-bash \
--without-rc \
--without-js \
- --without-gpsee \
+ --with-gpsee=/usr/lib/rpm \
--with-python \
--with-pythonembed=/usr/lib:/usr/include/python2.6 \
--with-perl \
@@ .
patch -p0 <<'@@ .'
Index: rpm/js/Makefile.am
============================================================================
$ cvs diff -u -r1.43 -r1.43.2.1 Makefile.am
--- rpm/js/Makefile.am 20 Jan 2010 01:39:20 -0000 1.43
+++ rpm/js/Makefile.am 18 Sep 2010 19:47:29 -0000 1.43.2.1
@@ -4,7 +4,7 @@
LINT = splint
-EXTRA_DIST = gsr.c minimal.c \
+EXTRA_DIST = ngsr.c minimal.c \
src \
tscripts \
words \
@@ -55,7 +55,7 @@
pkgbindir = @USRLIBRPM@/bin
moduledir = @GPSEE_MODULES_PATH@
-pkgbin_PROGRAMS = gsr
+pkgbin_PROGRAMS = ngsr
noinst_LTLIBRARIES = librpmjsm.la
module_LTLIBRARIES = \
@@ -302,14 +302,14 @@
rpmsx-js.c rpmsys-js.c rpmte-js.c rpmts-js.c rpmtxn-js.c rpmxar-js.c \
syck-js.c uuid-js.c
-gsr_SOURCES = gsr.c
-gsr_LDADD = $(RPM_LDADD_COMMON)
+ngsr_SOURCES = ngsr.c
+ngsr_LDADD = $(RPM_LDADD_COMMON)
.PHONY: lint
lint:
$(LINT) $(DEFS) $(INCLUDES) $(librpmjs_la_sources)
-check-local: gsr
+check-local: ngsr
.PHONY: lcov-reset # run lcov from scratch, always
lcov-reset:
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/psm.c
============================================================================
$ cvs diff -u -r2.394.2.2 -r2.394.2.3 psm.c
--- rpm/lib/psm.c 8 May 2010 15:01:42 -0000 2.394.2.2
+++ rpm/lib/psm.c 18 Sep 2010 19:47:29 -0000 2.394.2.3
@@ -25,7 +25,7 @@
#include <rpmsquirrel.h>
#include <rpmtcl.h>
-#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_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
+#if defined(WITH_LUA) || defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_GPSEE) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SEMANAGE) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
#define _WITH_EMBEDDED
#else
#undef _WITH_ENBEDDED
@@ -641,7 +641,7 @@
ficl = rpmficlFree(ficl);
} else
#endif
-#if defined(WITH_JS)
+#if defined(WITH_GPSEE)
if (!strcmp(Phe->p.argv[0], "<js>")) {
rpmjs js = rpmjsNew((char **)av, 0);
rc = rpmjsRun(js, script, NULL) == RPMRC_OK
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmds.c
============================================================================
$ cvs diff -u -r2.167.2.1 -r2.167.2.2 rpmds.c
--- rpm/lib/rpmds.c 25 Apr 2010 14:21:17 -0000 2.167.2.1
+++ rpm/lib/rpmds.c 18 Sep 2010 19:47:29 -0000 2.167.2.2
@@ -1476,7 +1476,7 @@
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
N_("internal embedded FICL.") },
#endif
-#if defined(WITH_JS)
+#if defined(WITH_GPSEE)
{ "rpmlib(BuiltinJavaScript)", "5.2-1",
(RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
N_("internal embedded JavaScript.") },
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/macro.c
============================================================================
$ cvs diff -u -r2.246.2.1 -r2.246.2.2 macro.c
--- rpm/rpmio/macro.c 25 Apr 2010 14:21:18 -0000 2.246.2.1
+++ rpm/rpmio/macro.c 18 Sep 2010 19:47:30 -0000 2.246.2.2
@@ -99,7 +99,7 @@
#include "debug.h"
/*@unchecked@*/
-#if defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_NIX) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
+#if defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_GPSEE) || defined(WITH_NIX) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
static int _globalI = 0x80000000;
#endif
@@ -1587,7 +1587,7 @@
* @retval *avp invocation args
* @return script string
*/
-#if defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
+#if defined(WITH_AUGEAS) || defined(WITH_FICL) || defined(WITH_GPSEE) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_SQLITE) || defined(WITH_SQUIRREL) || defined(WITH_TCL)
static char * parseEmbedded(const char * s, size_t nb, char *** avp)
/*@*/
{
@@ -1964,7 +1964,7 @@
}
#endif
-#ifdef WITH_JS
+#ifdef WITH_GPSEE
if (STREQ("js", f, fn)) {
char ** av = NULL;
char * script = parseEmbedded(s, (size_t)(se-s), &av);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmjs.c
============================================================================
$ cvs diff -u -r1.34 -r1.34.2.1 rpmjs.c
--- rpm/rpmio/rpmjs.c 8 Mar 2010 22:24:07 -0000 1.34
+++ rpm/rpmio/rpmjs.c 18 Sep 2010 19:47:30 -0000 1.34.2.1
@@ -45,23 +45,19 @@
extern char ** environ;
#endif
-#ifdef WITH_JS
-
+#if defined(WITH_GPSEE)
#define XP_UNIX 1
#include "jsprf.h"
#include "jsapi.h"
-#if defined(WITH_GPSEE)
#include <gpsee.h>
typedef gpsee_interpreter_t * JSI_t;
-#endif
-
#define _RPMJS_OPTIONS \
(JSOPTION_STRICT | JSOPTION_RELIMIT | JSOPTION_ANONFUNFIX | JSOPTION_JIT)
-#else
+#else /* WITH_GPSEE */
typedef void * JSI_t;
#define _RPMJS_OPTIONS 0
-#endif
+#endif /* WITH_GPSEE */
#define _RPMJS_INTERNAL
#include "rpmjs.h"
@@ -82,34 +78,34 @@
/*@unchecked@*/
int _rpmjs_zeal = 2;
-struct rpmjs_s _rpmgsr;
+struct rpmjs_s _rpmjs;
struct poptOption rpmjsIPoptTable[] = {
- { "allow", 'a', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_ALLOW,
+ { "allow", 'a', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_ALLOW,
N_("Allow (read-only) access to caller's environmen"), NULL },
- { "nocache", 'C', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_NOCACHE,
+ { "nocache", 'C', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOCACHE,
N_("Disables compiler caching via JSScript XDR serialization"), NULL },
- { "loadrc", 'R', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_LOADRC,
+ { "loadrc", 'R', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_LOADRC,
N_("Load RC file for interpreter based on script filename."), NULL },
- { "nowarn", 'W', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_NOWARN,
+ { "nowarn", 'W', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOWARN,
N_("Do not report warnings"), NULL },
- { "norelimit", 'e', POPT_BIT_CLR, &_rpmgsr.flags, RPMJS_FLAGS_RELIMIT,
+ { "norelimit", 'e', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_RELIMIT,
N_("Do not limit regexps to n^3 levels of backtracking"), NULL },
- { "nojit", 'J', POPT_BIT_CLR, &_rpmgsr.flags, RPMJS_FLAGS_JIT,
+ { "nojit", 'J', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_JIT,
N_("Disable nanojit"), NULL },
- { "nostrict", 'S', POPT_BIT_CLR, &_rpmgsr.flags, RPMJS_FLAGS_STRICT,
+ { "nostrict", 'S', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_STRICT,
N_("Disable Strict mode"), NULL },
- { "noutf8", 'U', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_NOUTF8,
+ { "noutf8", 'U', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOUTF8,
N_("Disable UTF-8 C string processing"), NULL },
- { "xml", 'x', POPT_BIT_SET, &_rpmgsr.flags, RPMJS_FLAGS_XML,
+ { "xml", 'x', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_XML,
N_("Parse <!-- comments --> as E4X tokens"), NULL },
- { "anonfunfix", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmgsr.flags, RPMJS_FLAGS_ANONFUNFIX,
+ { "anonfunfix", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_ANONFUNFIX,
N_("Parse //@line number [\"filename\"] for XUL"), NULL },
- { "atline", 'A', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmgsr.flags, RPMJS_FLAGS_ATLINE,
+ { "atline", 'A', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_ATLINE,
N_("Parse //@line number [\"filename\"] for XUL"), NULL },
- { "werror", 'w', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmgsr.flags, RPMJS_FLAGS_WERROR,
+ { "werror", 'w', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_WERROR,
N_("Convert warnings to errors"), NULL },
POPT_TABLEEND
@@ -162,6 +158,7 @@
return _rpmjsI;
}
+/* XXX FIXME: Iargv/Ienviron are now associated with running. */
rpmjs rpmjsNew(char ** av, uint32_t flags)
{
rpmjs js =
@@ -172,9 +169,6 @@
JSI_t I = NULL;
#if defined(WITH_GPSEE)
- static char *const _empty[] = { NULL };
- char *const * Iargv = (av ? (char *const *)av : _empty);
- char *const * Ienviron = NULL;
if (flags == 0)
flags = _rpmjs_options;
@@ -183,26 +177,22 @@
putenv((char *) "GPSEE_NO_UTF8_C_STRINGS=1");
}
- if (F_ISSET(flags, ALLOW)) {
-#if defined(__APPLE__)
- Ienviron = (char *const *) _NSGetEnviron();
-#else
- Ienviron = environ;
-#endif
- }
-
- I = gpsee_createInterpreter(Iargv, Ienviron);
-
+ /* XXX FIXME: js->Iargv/js->Ienviron for use by rpmjsRunFile() */
+ I = gpsee_createInterpreter();
+#ifdef NOTYET /* FIXME: dig out where NOCACHE has moved. */
if (F_ISSET(flags, NOCACHE))
I->useCompilerCache = 0;
- if (F_ISSET(flags, NOWARN))
- I->errorReport = er_noWarnings;
+#endif
+ if (F_ISSET(flags, NOWARN)) {
+ gpsee_runtime_t * grt = JS_GetRuntimePrivate(JS_GetRuntime(I->cx));
+ grt->errorReport |= er_noWarnings;
+ }
JS_SetOptions(I->cx, (flags & 0xffff));
#if defined(JS_GC_ZEAL)
JS_SetGCZeal(I->cx, _rpmjs_zeal);
#endif
-#endif
+#endif /* WITH_GPSEE */
js->flags = flags;
js->I = I;
@@ -210,13 +200,11 @@
return rpmjsLink(js);
}
-#if defined(WITH_JS)
#if defined(WITH_GPSEE)
static FILE * rpmjsOpenFile(rpmjs js, const char * fn, const char ** msgp)
/*@modifies js @*/
{
FILE * fp = NULL;
- gpsee_interpreter_t * I = js->I;
fp = fopen(fn, "r");
if (fp == NULL || ferror(fp)) {
@@ -239,15 +227,24 @@
if (fgets(buf, sizeof(buf), fp)) {
if (!(buf[0] == '#' && buf[1] == '!')) {
+ /* XXX FIXME: return through *msgp */
rpmlog(RPMLOG_WARNING, "%s: %s: no \'#!\' on 1st line\n",
__FUNCTION__, fn);
rewind(fp);
} else {
+#ifdef NOTYET /* XXX FIXME */
+gpsee_interpreter_t * I = js->I;
I->linenoOffset += 1;
+#endif /* NOTYET */
do { /* consume entire first line, regardless of length */
if (strchr(buf, '\n'))
break;
} while (fgets(buf, sizeof(buf), fp));
+ /*
+ * Make spidermonkey think the script starts with a blank line,
+ * to keep line numbers in sync.
+ */
+ ungetc('\n', fp);
}
}
}
@@ -259,56 +256,123 @@
return fp;
}
+
+#ifdef NOTYET /* XXX FIXME */
+static void processInlineFlags(rpmjs js, FILE * fp, signed int *verbosity_p)
+{
+ char buf[256];
+ off_t offset;
+
+ offset = ftello(fp);
+
+ while (fgets(buf, sizeof(buf), fp)) {
+ char *s, *e;
+
+ if ((buf[0] != '/') || (buf[1] != '/'))
+ break;
+
+ for (s = buf + 2; *s == ' ' || *s == '\t'; s++);
+ if (strncmp(s, "gpsee:", 6) != 0)
+ continue;
+
+ for (s = s + 6; *s == ' ' || *s == '\t'; s++);
+
+ for (e = s; *e; e++) {
+ switch (*e) {
+ case '\r':
+ case '\n':
+ case '\t':
+ case ' ':
+ *e = '\0';
+ break;
+ }
+ }
+
+ if (s[0])
+ processFlags(gsr, s, verbosity_p);
+ }
+
+ fseeko(fp, offset, SEEK_SET);
+}
+#endif /* NOTYET */
#endif /* WITH_GPSEE */
-#endif /* WITH_JS */
-rpmRC rpmjsRunFile(rpmjs js, const char * fn, const char ** resultp)
+rpmRC rpmjsRunFile(rpmjs js, const char * fn,
+ char *const * Iargv,
+ const char ** resultp)
{
rpmRC rc = RPMRC_FAIL;
if (js == NULL) js = rpmjsI();
if (fn != NULL) {
-#if defined(WITH_JS)
#if defined(WITH_GPSEE)
gpsee_interpreter_t * I = js->I;
- FILE * fp;
+ FILE * fp = rpmjsOpenFile(js, fn, resultp);
- fp = rpmjsOpenFile(js, fn, resultp);
- if (fp == NULL)
+ if (fp == NULL) {
+ /* XXX FIXME: strerror in *reultp */
goto exit;
+ }
- gpsee_runProgramModule(I->cx, fn, fp);
- (void) fclose(fp);
- /* XXX hack tp get I->exitCode into rc -> ec by negating */
- rc = ((I->exitType & et_successMask) == I->exitType)
- ? -I->exitCode : RPMRC_FAIL;
-#else
- JSI_t I = js->I;
- JSContext *cx = I->cx;
- JSObject *glob = I->globalObj;
- JSScript *script = JS_CompileFile(cx, glob, fn);
- jsval rval;
+#ifdef NOTYET /* XXX FIXME */
+ processInlineFlags(js, fp, &verbosity);
+ gpsee_setVerbosity(verbosity);
+#endif
- if (script) {
- if (JS_ExecuteScript(cx, glob, script, &rval)) {
+ /* Just compile and exit? */
+ if (F_ISSET(js->flags, NOEXEC)) {
+ JSScript *script = NULL;
+ JSObject *scrobj = NULL;
+
+ if (!gpsee_compileScript(I->cx, fn,
+ fp, NULL, &script, I->realm->globalObject, &scrobj))
+ {
+ /* XXX FIXME: isatty(3) */
+ gpsee_reportUncaughtException(I->cx, JSVAL_NULL,
+ (gpsee_verbosity(0) >= GSR_FORCE_STACK_DUMP_VERBOSITY)
+ ||
+ ((gpsee_verbosity(0) >= GPSEE_ERROR_OUTPUT_VERBOSITY)
+ && isatty(STDERR_FILENO)));
+ } else
rc = RPMRC_OK;
- if (resultp) {
- JSString *rstr = JS_ValueToString(cx, rval);
- *resultp = JS_GetStringBytes(rstr);
- }
+ } else {
+ char *const * Ienviron = NULL;
+
+ if (F_ISSET(js->flags, ALLOW)) {
+#if defined(__APPLE__)
+ Ienviron = (char *const *) _NSGetEnviron();
+#else
+ Ienviron = environ;
+#endif
}
- JS_DestroyScript(cx, script);
+
+ if (!gpsee_runProgramModule(I->cx, fn,
+ NULL, fp, Iargv, Ienviron))
+ {
+ int code = gpsee_getExceptionExitCode(I->cx);
+ if (code >= 0) {
+ /* XXX FIXME: format and return code in *resultp. */
+ /* XXX hack tp get code into rc -> ec by negating */
+ rc = -code;
+ } else {
+ gpsee_reportUncaughtException(I->cx, JSVAL_NULL,
+ (gpsee_verbosity(0) >= GSR_FORCE_STACK_DUMP_VERBOSITY)
+ ||
+ ((gpsee_verbosity(0) >= GPSEE_ERROR_OUTPUT_VERBOSITY)
+ && isatty(STDERR_FILENO)));
+ }
+ } else
+ rc = RPMRC_OK;
}
+ fclose(fp);
+ fp = NULL;
#endif /* WITH_GPSEE */
-#endif /* WITH_JS */
}
-#if defined(WITH_JS)
#if defined(WITH_GPSEE)
exit:
#endif /* WITH_GPSEE */
-#endif /* WITH_JS */
if (_rpmjs_debug)
fprintf(stderr, "<== %s(%p,%s) rc %d\n", __FUNCTION__, js, fn, rc);
@@ -323,23 +387,22 @@
if (js == NULL) js = rpmjsI();
if (str != NULL) {
-#if defined(WITH_JS)
- JSI_t I = js->I;
- JSContext *cx = I->cx;
- JSObject *glob = I->globalObj;
- jsval rval = JSVAL_VOID;
+#if defined(WITH_GPSEE)
+ gpsee_interpreter_t * I = js->I;
+ jsval v = JSVAL_VOID;
JSBool ok;
- ok = JS_EvaluateScript(cx, glob, str, strlen(str),
- __FILE__, __LINE__, &rval);
- if (ok && !JS_IsExceptionPending(I->cx)) {
+ ok = JS_EvaluateScript(I->cx, I->realm->globalObject, str, strlen(str),
+ __FILE__, __LINE__, &v);
+ if (ok) {
rc = RPMRC_OK;
if (resultp) {
- JSString *rstr = JS_ValueToString(cx, rval);
+ JSString *rstr = JS_ValueToString(I->cx, v);
*resultp = JS_GetStringBytes(rstr);
}
}
-#endif
+ v = JSVAL_NULL;
+#endif /* WITH_GPSEE */
}
if (_rpmjs_debug)
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmjs.h
============================================================================
$ cvs diff -u -r1.8.2.1 -r1.8.2.2 rpmjs.h
--- rpm/rpmio/rpmjs.h 25 Apr 2010 14:21:18 -0000 1.8.2.1
+++ rpm/rpmio/rpmjs.h 18 Sep 2010 19:47:30 -0000 1.8.2.2
@@ -63,6 +63,10 @@
int nrefs; /*!< (unused) keep splint happy */
#endif
};
+
+/*@unchecked@*/
+struct rpmjs_s _rpmjs;
+
#endif /* _RPMJS_INTERNAL */
#ifdef __cplusplus
@@ -118,10 +122,12 @@
* Execute js from a file.
* @param js js interpreter (NULL uses global interpreter)
* @param fn js file to run (NULL returns RPMRC_FAIL)
+ * @param Iargv js script argv
* @param *resultp js exec result
* @return RPMRC_OK on success
*/
rpmRC rpmjsRunFile(rpmjs js, /*@null@*/ const char * fn,
+ /*@null@*/ char *const * Iargv,
/*@null@*/ const char ** resultp)
/*@globals fileSystem, internalState @*/
/*@modifies js, fileSystem, internalState @*/;
@@ .
Received on Sat Sep 18 21:47:30 2010