[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 16:32:57 Branch: HEAD Handle: 2010091214325700 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.3 +385 -203 rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.2 -r1.3 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 05:59:33 - 1.2 +++ rpm/js/ngsr.c 12 Sep 2010 14:32:57 - 1.3 @@ -37,7 +37,7 @@ * @file gsr.c GPSEE Script Runner (scripting host) * @author Wes Garland * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.2 2010/09/12 05:59:33 jbj Exp $ + * @version $Id: ngsr.c,v 1.3 2010/09/12 14:32:57 jbj Exp $ * * This program is designed to interpret a JavaScript program as much like * a shell script as possible. @@ -55,7 +55,13 @@ */ static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.2 2010/09/12 05:59:33 jbj Exp $; +const char rcsid[] = $Id: ngsr.c,v 1.3 2010/09/12 14:32:57 jbj Exp $; + +#include system.h + +#include rpmiotypes.h +#include rpmio.h +#include poptIO.h #define PRODUCT_VERSION 1.0-pre3 @@ -77,23 +83,60 @@ #include crt_externs.h #endif -#if defined(__SURELYNX__) -# define NO_APR_SURELYNX_NAMESPACE_POISONING -# define NO_SURELYNX_INT_TYPEDEFS/* conflicts with mozilla's NSPR protypes.h */ -#endif +#define xstr(s) str(s) +#define str(s) #s -#if defined(__SURELYNX__) -static apr_pool_t *permanent_pool; -#endif +#include debug.h -#if defined(__SURELYNX__) -# define whenSureLynx(a,b) a -#else -# define whenSureLynx(a,b) b -#endif +/*==*/ -#define xstr(s) str(s) -#define str(s) #s +static int _rpmgsr_debug = 0; + +#define _KFB(n) (1U (n)) +#define _DFB(n) (_KFB(n) | 0x4000) + +#define F_ISSET(_gsr, _FLAG) ((_gsr)-flags ((RPMGSR_FLAGS_##_FLAG) ~0x4000)) + +/** + * Bit field enum for CLI options. + */ +enum gsrFlags_e { +RPMGSR_FLAGS_NONE= 0, +RPMGSR_FLAGS_NOEXEC = _DFB(0), /*! -n */ +RPMGSR_FLAGS_SKIPSHEBANG = _DFB(1), /*! -F */ +}; + +/** + */ +typedef struct rpmgsr_s *rpmgsr; + +/** + */ +struct rpmgsr_s { +enum gsrFlags_e flags; /*! control bits. */ +int options; +int gcZeal; + +gpsee_interpreter_t * I; /* Handle describing JS interpreter */ + +const char * code; /* String with JavaScript program in it */ +const char * fn; /* Filename with JavaScript program in it */ +char *const *argv; /* Becomes arguments array in JS program */ +char *const *environ;/* Environment to pass to script */ + +int verbosity; /* 0 = no debug, bigger = more debug */ +int fiArg; +}; + +/** + */ +static struct rpmgsr_s _gsr = { +.flags = RPMGSR_FLAGS_NONE, +.options = + JSOPTION_ANONFUNFIX | JSOPTION_STRICT | JSOPTION_RELIMIT | JSOPTION_JIT, +}; + +/*==*/ extern rc_list rc; @@ -139,6 +182,198 @@ fatal(message); } +/*==*/ +/** + */ +static void rpmgsrArgCallback(poptContext con, +/*...@unused@*/ enum poptCallbackReason reason, +const struct poptOption * opt, /*...@unused@*/ const char * arg, +/*...@unused@*/ void * data) + /*...@globals fileSystem @*/ + /*...@modifies fileSystem @*/ +{ +rpmgsr gsr = _gsr; + +/* XXX avoid accidental collisions with POPT_BIT_SET for flags */ +if (opt-arg == NULL) +switch (opt-val) { +case 'F': + gsr-flags |= RPMGSR_FLAGS_SKIPSHEBANG; + gsr-fn = xstrdup(arg); + break; +case 'h': + poptPrintHelp(con, stderr, 0); +#ifdef NOTYET +/*...@-exitarg@*/ + exit(0); +/*...@=exitarg@*/ +#endif + break; +case 'a': + break; +case 'C': + break; +case 'd': + break; +case 'e': + break; +case 'J': + break; +case 'S': + break; +case 'R': + break; +case 'U': + break; +case 'W': + break; +case 'x': + break; +case 'z': +
[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 17:23:06 Branch: HEAD Handle: 2010091215230600 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.4 +68 -313rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.3 -r1.4 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 14:32:57 - 1.3 +++ rpm/js/ngsr.c 12 Sep 2010 15:23:06 - 1.4 @@ -37,7 +37,7 @@ * @file gsr.c GPSEE Script Runner (scripting host) * @author Wes Garland * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.3 2010/09/12 14:32:57 jbj Exp $ + * @version $Id: ngsr.c,v 1.4 2010/09/12 15:23:06 jbj Exp $ * * This program is designed to interpret a JavaScript program as much like * a shell script as possible. @@ -55,7 +55,7 @@ */ static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.3 2010/09/12 14:32:57 jbj Exp $; +const char rcsid[] = $Id: ngsr.c,v 1.4 2010/09/12 15:23:06 jbj Exp $; #include system.h @@ -104,6 +104,10 @@ RPMGSR_FLAGS_NONE= 0, RPMGSR_FLAGS_NOEXEC = _DFB(0), /*! -n */ RPMGSR_FLAGS_SKIPSHEBANG = _DFB(1), /*! -F */ +RPMGSR_FLAGS_LOADRC = _DFB(2), /*! -R */ +RPMGSR_FLAGS_NOUTF8 = _DFB(3), /*! -U */ +RPMGSR_FLAGS_NOCACHE = _DFB(4), /*! -C */ +RPMGSR_FLAGS_NOWARN = _DFB(5), /*! -W */ }; /** @@ -121,7 +125,7 @@ const char * code; /* String with JavaScript program in it */ const char * fn; /* Filename with JavaScript program in it */ -char *const *argv; /* Becomes arguments array in JS program */ +ARGV_t argv; /* Becomes arguments array in JS program */ char *const *environ;/* Environment to pass to script */ int verbosity; /* 0 = no debug, bigger = more debug */ @@ -210,24 +214,38 @@ #endif break; case 'a': +#if defined(GPSEE_DARWIN_SYSTEM) + gsr-environ = (char *const *) _NSGetEnviron(); +#else + gsr-environ = (char *const *) environ; +#endif break; case 'C': + gsr-flags |= RPMGSR_FLAGS_NOCACHE; break; case 'd': + gsr-verbosity++; break; case 'e': + gsr-options = ~JSOPTION_RELIMIT; break; case 'J': + gsr-options = ~JSOPTION_JIT; break; case 'S': + gsr-options = ~JSOPTION_STRICT; break; case 'R': + gsr-flags |= RPMGSR_FLAGS_LOADRC; break; case 'U': + gsr-flags |= RPMGSR_FLAGS_NOUTF8; break; case 'W': + gsr-flags |= RPMGSR_FLAGS_NOWARN; break; case 'x': + gsr-options |= JSOPTION_XML; break; case 'z': gsr-gcZeal++; @@ -328,102 +346,16 @@ #ifdef NOTYET { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, N_(Common options for all rpmio executables:), NULL }, +#endif POPT_AUTOALIAS -#endif POPT_AUTOHELP - - { NULL, -1, POPT_ARG_INCLUDE_TABLE, NULL, 0, -N_(\ - PRODUCT_SHORTNAME PRODUCT_VERSION - GPSEE Script Runner for GPSEE GPSEE_CURRENT_VERSION_STRING \n\ -Copyright (c) 2007-2009 PageMail, Inc. All Rights Reserved.\n\ -\n\ -As an interpreter: #! gsr {-/*flags*/}\n\ -As a command: gsr {-r file} [-D file] [-z #] [-n] [-c code]|[-f filename]\n\ - gsr {-/*flags*/} {[--] [arg...]}\n\ -Command Options:\n\ --c code Specifies literal JavaScript code to execute\n\ --f filename Specifies the filename containing code to run\n\ --F filename Like -f, but skip shebang if present.\n\ --h Display this help\n\ --n Engine will load and parse, but not run, the script\n\ --D file Specifies a debug output file\n\ --r file Specifies alternate interpreter RC file\n\ -flags A series of one-character flags which can be used\n\ -in either file interpreter or command mode\n\ --- Arguments after -- are passed to the script\n\ -\n\ -Valid Flags:\n\ -a - Allow (read-only) access to caller's environment\n\ -C - Disables compiler caching via JSScript XDR serialization\n\ -d - Increase verbosity\n\ -e - Do not limit regexps to n^3
[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 21:19:09 Branch: HEAD Handle: 2010091219190900 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.5 +88 -292rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.4 -r1.5 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 15:23:06 - 1.4 +++ rpm/js/ngsr.c 12 Sep 2010 19:19:09 - 1.5 @@ -37,7 +37,7 @@ * @file gsr.c GPSEE Script Runner (scripting host) * @author Wes Garland * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.4 2010/09/12 15:23:06 jbj Exp $ + * @version $Id: ngsr.c,v 1.5 2010/09/12 19:19:09 jbj Exp $ * * This program is designed to interpret a JavaScript program as much like * a shell script as possible. @@ -55,7 +55,7 @@ */ static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.4 2010/09/12 15:23:06 jbj Exp $; +const char rcsid[] = $Id: ngsr.c,v 1.5 2010/09/12 19:19:09 jbj Exp $; #include system.h @@ -63,6 +63,9 @@ #include rpmio.h #include poptIO.h +#define _RPMJS_INTERNAL +#include rpmjs.h + #define PRODUCT_VERSION 1.0-pre3 #if !defined(GPSEE_DEBUGGER) @@ -83,6 +86,8 @@ #include crt_externs.h #endif +extern rc_list rc; /* XXX unfortunate variable name choice */ + #define xstr(s) str(s) #define str(s) #s @@ -90,60 +95,14 @@ /*==*/ -static int _rpmgsr_debug = 0; - -#define _KFB(n) (1U (n)) -#define _DFB(n) (_KFB(n) | 0x4000) - -#define F_ISSET(_gsr, _FLAG) ((_gsr)-flags ((RPMGSR_FLAGS_##_FLAG) ~0x4000)) +#define F_ISSET(_flags, _FLAG) ((_flags) RPMJS_FLAGS_##_FLAG) -/** - * Bit field enum for CLI options. - */ -enum gsrFlags_e { -RPMGSR_FLAGS_NONE= 0, -RPMGSR_FLAGS_NOEXEC = _DFB(0), /*! -n */ -RPMGSR_FLAGS_SKIPSHEBANG = _DFB(1), /*! -F */ -RPMGSR_FLAGS_LOADRC = _DFB(2), /*! -R */ -RPMGSR_FLAGS_NOUTF8 = _DFB(3), /*! -U */ -RPMGSR_FLAGS_NOCACHE = _DFB(4), /*! -C */ -RPMGSR_FLAGS_NOWARN = _DFB(5), /*! -W */ -}; - -/** - */ -typedef struct rpmgsr_s *rpmgsr; - -/** - */ -struct rpmgsr_s { -enum gsrFlags_e flags; /*! control bits. */ -int options; -int gcZeal; - -gpsee_interpreter_t * I; /* Handle describing JS interpreter */ - -const char * code; /* String with JavaScript program in it */ -const char * fn; /* Filename with JavaScript program in it */ -ARGV_t argv; /* Becomes arguments array in JS program */ -char *const *environ;/* Environment to pass to script */ - -int verbosity; /* 0 = no debug, bigger = more debug */ -int fiArg; -}; - -/** - */ -static struct rpmgsr_s _gsr = { -.flags = RPMGSR_FLAGS_NONE, -.options = - JSOPTION_ANONFUNFIX | JSOPTION_STRICT | JSOPTION_RELIMIT | JSOPTION_JIT, -}; +static const char * Icode; /* String with JavaScript program in it */ +static const char * Ifn; /* Filename with JavaScript program in it */ +static int verbosity;/* 0 = no debug, bigger = more debug */ /*==*/ -extern rc_list rc; - /** Handler for fatal errors. Generate a fatal error * message to surelog, stdout, or stderr depending on * whether our controlling terminal is a tty or not. @@ -189,73 +148,32 @@ /*==*/ /** */ -static void rpmgsrArgCallback(poptContext con, +static void rpmjsArgCallback(poptContext con, /*...@unused@*/ enum poptCallbackReason reason, const struct poptOption * opt, /*...@unused@*/ const char * arg, /*...@unused@*/ void * data) /*...@globals fileSystem @*/ /*...@modifies fileSystem @*/ { -rpmgsr gsr = _gsr; +rpmjs js = _rpmjs; /* XXX avoid accidental collisions with POPT_BIT_SET for flags */ if (opt-arg == NULL) switch (opt-val) { case 'F': - gsr-flags |= RPMGSR_FLAGS_SKIPSHEBANG; - gsr-fn = xstrdup(arg); + js-flags |=
[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 21:37:02 Branch: HEAD Handle: 2010091219370100 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.6 +6 -141rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.5 -r1.6 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 19:19:09 - 1.5 +++ rpm/js/ngsr.c 12 Sep 2010 19:37:01 - 1.6 @@ -37,7 +37,7 @@ * @file gsr.c GPSEE Script Runner (scripting host) * @author Wes Garland * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.5 2010/09/12 19:19:09 jbj Exp $ + * @version $Id: ngsr.c,v 1.6 2010/09/12 19:37:01 jbj Exp $ * * This program is designed to interpret a JavaScript program as much like * a shell script as possible. @@ -55,7 +55,7 @@ */ static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.5 2010/09/12 19:19:09 jbj Exp $; +const char rcsid[] = $Id: ngsr.c,v 1.6 2010/09/12 19:37:01 jbj Exp $; #include system.h @@ -164,12 +164,6 @@ js-flags |= RPMJS_FLAGS_SKIPSHEBANG; Ifn = xstrdup(arg); break; -case 'h': - poptPrintHelp(con, stderr, 0); - exit(EXIT_SUCCESS); - /*...@notreached@*/ break; -case 'd':verbosity++;break; -case 'z':_rpmjs_zeal++; break; default: fprintf(stderr, _(%s: Unknown option -%c\n), __progname, opt-val); poptPrintUsage(con, stderr, 0); @@ -207,22 +201,6 @@ }; extern struct poptOption rpmjsIPoptTable[]; /* XXX in rpmjs.h? */ -static struct poptOption _jsOptionsTable[] = { -/*...@-type@*/ /* FIX: cast? */ - { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, -rpmjsArgCallback, 0, NULL, NULL }, -/*...@=type@*/ - - { NULL, 'd', POPT_ARG_NONE, NULL, 'd', -N_(Increase verbosity), NULL }, - { gczeal, 'z', POPT_ARG_NONE,NULL, 'z', -N_(Increase GC Zealousness), NULL }, - - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmjsIPoptTable, 0, -N_(JS shell options), NULL }, - - POPT_TABLEEND -}; static struct poptOption _optionsTable[] = { /*...@-type@*/ /* FIX: cast? */ @@ -231,26 +209,13 @@ /*...@=type@*/ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, _gsrOptionsTable, 0, -N_(\ - PRODUCT_SHORTNAME PRODUCT_VERSION - GPSEE Script Runner for GPSEE GPSEE_CURRENT_VERSION_STRING \n\ -Copyright (c) 2007-2009 PageMail, Inc. All Rights Reserved.\n\ -\n\ -As an interpreter: #! gsr {-/*flags*/}\n\ -As a command: gsr {-r file} [-D file] [-z #] [-n] [-c code]|[-f filename]\n\ - gsr {-/*flags*/} {[--] [arg...]}\n\ -\n\ -Command Options:\ -), NULL }, - - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, _jsOptionsTable, 0, -N_(\ -Valid Flags:\ -), NULL }, +N_(Command options:), NULL }, + + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmjsIPoptTable, 0, +N_(JS interpreter options:), NULL }, -#ifdef NOTYET { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, N_(Common options for all rpmio executables:), NULL }, -#endif POPT_AUTOALIAS POPT_AUTOHELP @@ -260,106 +225,6 @@ static struct poptOption *optionsTable = _optionsTable[0]; /*==*/ - -#ifdef DYING -/** More help text for this program, which doubles as the official - * documentation for the more subtle behaviours of this embedding. - * - * @param argv_zero How this program was invoked. - * - * @noteExits with status 1 - */ -static void __attribute__ ((noreturn)) moreHelp(const char *argv_zero) -{ -char spaces[strlen(argv_zero) + 1]; - -memset(spaces, (int) (' '), sizeof(spaces) - 1); -spaces[sizeof(spaces) - 1] = '\0'; - -printf(\n -PRODUCT_SHORTNAME PRODUCT_VERSION - PRODUCT_SUMMARY -GPSEE_CURRENT_VERSION_STRING \n -Copyright (c) 2007-2010 PageMail, Inc. All Rights Reserved.\n -\n More Help: Additional information beyond basic usage.\n -\n Verbosity\n - Verbosity is a measure of how much output GPSEE and -PRODUCT_SHORTNAME send to stderr.\n - To request verbosity N, specify the d flag N times when invoking -PRODUCT_SHORTNAME .\n -
[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 22:22:46 Branch: HEAD Handle: 2010091220224600 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.7 +41 -71 rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.6 -r1.7 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 19:37:01 - 1.6 +++ rpm/js/ngsr.c 12 Sep 2010 20:22:46 - 1.7 @@ -37,7 +37,7 @@ * @file gsr.c GPSEE Script Runner (scripting host) * @author Wes Garland * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.6 2010/09/12 19:37:01 jbj Exp $ + * @version $Id: ngsr.c,v 1.7 2010/09/12 20:22:46 jbj Exp $ * * This program is designed to interpret a JavaScript program as much like * a shell script as possible. @@ -55,12 +55,13 @@ */ static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.6 2010/09/12 19:37:01 jbj Exp $; +const char rcsid[] = $Id: ngsr.c,v 1.7 2010/09/12 20:22:46 jbj Exp $; #include system.h #include rpmiotypes.h #include rpmio.h +#include rpmlog.h #include poptIO.h #define _RPMJS_INTERNAL @@ -134,7 +135,7 @@ fprintf(stderr, \007Fatal Error in PRODUCT_SHORTNAME : %s\n, message); } else - gpsee_log(NULL, SLOG_EMERG, Fatal Error: %s, message); + rpmlog(RPMLOG_EMERG, Fatal Error: %s\n, message); exit(1); } @@ -230,9 +231,8 @@ poptContext optCon; rpmjs js; char *const * Iargv = NULL; /* Becomes arguments array in JS program */ -char *const * Ienviron = NULL; /* Environment to pass to script */ int ac = 0; -int ec = 1; +int ec = 1; /* assume failure */ void *stackBasePtr = NULL; gpsee_interpreter_t * I = NULL; @@ -246,8 +246,10 @@ gpsee_setVerbosity(isatty(STDERR_FILENO) ? GSR_PREPROGRAM_TTY_VERBOSITY : GSR_PREPROGRAM_NOTTY_VERBOSITY); -gpsee_openlog(gpsee_basename(argv[0])); +#ifdef NOTYET /* XXX original gsr is solaris - *BSDish */ +_rpmio_popt_context_flags = POPT_CONTEXT_POSIXMEHARDER; +#endif optCon = rpmioInit(argc, argv, optionsTable); /* Add files from CLI. */ @@ -303,35 +305,35 @@ if (argv[0][0] == '/' strcmp(argv[0], SYSTEM_GSR) rc_bool_value(rc, no_gsr_preload_script) != rc_true) { - char preloadScriptFilename[FILENAME_MAX]; - char mydir[FILENAME_MAX]; - int i; - - i = snprintf(preloadScriptFilename, sizeof(preloadScriptFilename), - %s/.%s_preload, gpsee_dirname(argv[0], mydir, - sizeof(mydir)), - gpsee_basename(argv[0])); - if (i == 0 || i == (sizeof(preloadScriptFilename) - 1)) - gpsee_log(cx, SLOG_EMERG, + const char * preloadfn = rpmGetPath(dirname(argv[0]), + /., basename(argv[0]), _preload, NULL); + + /* XXX assert? */ + if (!(preloadfn *preloadfn)) { + rpmlog(RPMLOG_EMERG, PRODUCT_SHORTNAME - : Unable to create preload script filename!); - else - errno = 0; + : Unable to create preload script filename!\n); + preloadfn = _free(preloadfn); + goto finish; + } - if (access(preloadScriptFilename, F_OK) == 0) { + errno = 0; + if (Access(preloadfn, F_OK) == 0) { jsval v; JSScript *script; JSObject *scrobj; - if (!gpsee_compileScript(cx, preloadScriptFilename, + if (!gpsee_compileScript(I-cx, preloadfn, NULL, NULL, script, realm-globalObject, scrobj)) { - gpsee_log(cx, SLOG_EMERG, + rpmlog(RPMLOG_EMERG, PRODUCT_SHORTNAME - : Unable to compile preload script '%s', - preloadScriptFilename); + : Unable to compile preload script '%s'\n, + preloadfn); + preloadfn = _free(preloadfn); goto finish; } + preloadfn = _free(preloadfn); if (!script || !scrobj) goto finish; @@ -362,56 +364,24 @@ if (Ifn == NULL) { ec = Icode ? 0 : 1; -
[CVS] RPM: rpm/js/ ngsr.c
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: 12-Sep-2010 23:23:31 Branch: HEAD Handle: 2010091221233000 Modified files: rpm/js ngsr.c Log: - gpsee: WIP. Summary: RevisionChanges Path 1.8 +41 -178rpm/js/ngsr.c patch -p0 '@@ .' Index: rpm/js/ngsr.c $ cvs diff -u -r1.7 -r1.8 ngsr.c --- rpm/js/ngsr.c 12 Sep 2010 20:22:46 - 1.7 +++ rpm/js/ngsr.c 12 Sep 2010 21:23:30 - 1.8 @@ -1,62 +1,3 @@ -/* * BEGIN LICENSE BLOCK * - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the License); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an AS IS basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is PageMail, Inc. - * - * Portions created by the Initial Developer are - * Copyright (c) 2007-2010, PageMail, Inc. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the GPL), - * or the GNU Lesser General Public License Version 2.1 or later (the LGPL), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * * END LICENSE BLOCK * - */ - -/** - * @file gsr.c GPSEE Script Runner (scripting host) - * @author Wes Garland - * @date Aug 27 2007 - * @version $Id: ngsr.c,v 1.7 2010/09/12 20:22:46 jbj Exp $ - * - * This program is designed to interpret a JavaScript program as much like - * a shell script as possible. - * - * @see exec(2) system call - * - * When launching as a file interpreter, a single argument may follow the - * interpreter's filename. This argument starts with a dash and is a series - * of argumentless flags. - * - * All other command line options will be passed along to the JavaScript program. - * - * The official documentation for the prescence and meaning of flags and switch - * is the usage() function. - */ - -static __attribute__ ((unused)) -const char rcsid[] = $Id: ngsr.c,v 1.7 2010/09/12 20:22:46 jbj Exp $; - #include system.h #include rpmiotypes.h @@ -67,33 +8,15 @@ #define _RPMJS_INTERNAL #include rpmjs.h -#define PRODUCT_VERSION 1.0-pre3 - -#if !defined(GPSEE_DEBUGGER) -# define PRODUCT_SUMMARYScript Runner for GPSEE -# define PRODUCT_SHORTNAME gsr -#else -# define PRODUCT_SUMMARYScript Debugger for GPSEE -# define PRODUCT_SHORTNAME gsrdb -#endif - -#if !defined(SYSTEM_GSR) -#define SYSTEM_GSR /usr/bin/ PRODUCT_SHORTNAME -#endif - -#include prinit.h #include gpsee.h -#if defined(GPSEE_DARWIN_SYSTEM) -#include crt_externs.h -#endif - -extern rc_list rc; /* XXX unfortunate variable name choice */ #define xstr(s) str(s) #define str(s) #s #include debug.h +extern const char * __progname; + /*==*/ #define F_ISSET(_flags, _FLAG) ((_flags) RPMJS_FLAGS_##_FLAG) @@ -104,51 +27,14 @@ /*==*/ -/** Handler for fatal errors. Generate a fatal error - * message to surelog, stdout, or stderr depending on - * whether our controlling terminal is a tty or not. - * - * @param message Arbitrary text describing the - * fatal condition - * @noteExits with status 1 - */ -static void
[CVS] RPM: rpm/ CHANGES rpm/rpmio/ rpmjs.c rpmjs.h
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: 12-Sep-2010 23:26:48 Branch: HEAD Handle: 2010091221264701 Modified files: rpm CHANGES rpm/rpmio rpmjs.c rpmjs.h Log: - rpmjs: resecusitate sufficiently to use with jx/ngsr.c. more todo++. Summary: RevisionChanges Path 1.3441 +1 -0 rpm/CHANGES 1.35+137 -63rpm/rpmio/rpmjs.c 1.10+6 -0 rpm/rpmio/rpmjs.h patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.3440 -r1.3441 CHANGES --- rpm/CHANGES 10 Sep 2010 17:39:16 - 1.3440 +++ rpm/CHANGES 12 Sep 2010 21:26:47 - 1.3441 @@ -1,4 +1,5 @@ 5.3.3 - 5.4a1: +- jbj: rpmjs: resecusitate sufficiently to use with jx/ngsr.c. more todo++. - eveith: Fix ruby include paths - rpm.org: git-v1:339f31face44d877c3a6e2fc780e740e7e236eae. - jbj: rpmrepo: refactor the methods that don't need/use a header. @@ . patch -p0 '@@ .' Index: rpm/rpmio/rpmjs.c $ cvs diff -u -r1.34 -r1.35 rpmjs.c --- rpm/rpmio/rpmjs.c 8 Mar 2010 22:24:07 - 1.34 +++ rpm/rpmio/rpmjs.c 12 Sep 2010 21:26:48 - 1.35 @@ -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',
[CVS] RPM: rpm/ CHANGES rpm/build/ parseScript.c rpm/lib/ psm.c rpmds....
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: 13-Sep-2010 00:19:57 Branch: HEAD Handle: 2010091222195502 Modified files: rpm CHANGES rpm/build parseScript.c rpm/lib psm.c rpmds.c rpm/rpmio macro.c rpmjs.c Log: - gpsee: replace WITH_JS everwhere with WITH_GPSEE. GPSEE-JS always. Summary: RevisionChanges Path 1.3442 +1 -0 rpm/CHANGES 2.80+1 -1 rpm/build/parseScript.c 2.398 +2 -2 rpm/lib/psm.c 2.169 +1 -1 rpm/lib/rpmds.c 2.249 +3 -3 rpm/rpmio/macro.c 1.36+3 -14 rpm/rpmio/rpmjs.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.3441 -r1.3442 CHANGES --- rpm/CHANGES 12 Sep 2010 21:26:47 - 1.3441 +++ rpm/CHANGES 12 Sep 2010 22:19:55 - 1.3442 @@ -1,4 +1,5 @@ 5.3.3 - 5.4a1: +- jbj: gpsee: replace WITH_JS everwhere with WITH_GPSEE. GPSEE-JS always. - jbj: rpmjs: resecusitate sufficiently to use with jx/ngsr.c. more todo++. - eveith: Fix ruby include paths - rpm.org: git-v1:339f31face44d877c3a6e2fc780e740e7e236eae. @@ . patch -p0 '@@ .' Index: rpm/build/parseScript.c $ cvs diff -u -r2.79 -r2.80 parseScript.c --- rpm/build/parseScript.c 12 Apr 2010 21:22:24 - 2.79 +++ rpm/build/parseScript.c 12 Sep 2010 22:19:56 - 2.80 @@ -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/lib/psm.c $ cvs diff -u -r2.397 -r2.398 psm.c --- rpm/lib/psm.c 8 May 2010 14:58:22 - 2.397 +++ rpm/lib/psm.c 12 Sep 2010 22:19:56 - 2.398 @@ -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.168 -r2.169 rpmds.c --- rpm/lib/rpmds.c 11 Apr 2010 17:47:30 - 2.168 +++ rpm/lib/rpmds.c 12 Sep 2010 22:19:56 - 2.169 @@ -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.248 -r2.249 macro.c --- rpm/rpmio/macro.c 20 Apr 2010 13:22:27 - 2.248 +++ rpm/rpmio/macro.c 12 Sep 2010 22:19:57 - 2.249 @@ -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
[CVS] RPM: rpm/build/ build.c
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: 13-Sep-2010 00:21:06 Branch: HEAD Handle: 201009110600 Modified files: rpm/build build.c Log: - rpmbc: define _RPMBC_INTERNAL before rpmio_internal.h Summary: RevisionChanges Path 2.144 +1 -1 rpm/build/build.c patch -p0 '@@ .' Index: rpm/build/build.c $ cvs diff -u -r2.143 -r2.144 build.c --- rpm/build/build.c 25 Jun 2010 18:39:44 - 2.143 +++ rpm/build/build.c 12 Sep 2010 22:21:06 - 2.144 @@ -5,11 +5,11 @@ #include system.h +#define _RPMBC_INTERNAL #include rpmio_internal.h /* XXX fdGetFp */ #include rpmcb.h #include rpmsq.h -#define _RPMBC_INTERNAL #include rpmbc.h #include rpmhkp.h /* XXX _rpmhkp_debug */ @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/rpmdb/ db3.c
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: 13-Sep-2010 00:23:56 Branch: HEAD Handle: 201009135600 Modified files: rpm/rpmdb db3.c Log: - isolate sunrpc code w test for DB_RPCCLIENT. Summary: RevisionChanges Path 1.154 +11 -8 rpm/rpmdb/db3.c patch -p0 '@@ .' Index: rpm/rpmdb/db3.c $ cvs diff -u -r1.153 -r1.154 db3.c --- rpm/rpmdb/db3.c 17 Jul 2010 19:56:48 - 1.153 +++ rpm/rpmdb/db3.c 12 Sep 2010 22:23:56 - 1.154 @@ -32,10 +32,6 @@ extern int logio_dispatch(DB_ENV * dbenv, DBT * dbt, DB_LSN * lsn, db_recops op) /*...@*/; -#if !defined(DB_CLIENT) /* XXX db-4.2.42 retrofit */ -#define DB_CLIENT DB_RPCCLIENT -#endif - #define DBIDEBUG(_dbi, _list) if ((_dbi)-dbi_debug) fprintf _list /*...@access rpmdb @*/ @@ -780,8 +776,10 @@ dbhome, dbfile, prDbiOpenFlags(eflags, 1)); /* XXX Can't do RPC w/o host. */ +#if defined(DB_RPCCLIENT) if (dbi-dbi_host == NULL) - dbi-dbi_ecflags = ~DB_CLIENT; + dbi-dbi_ecflags = ~DB_RPCCLIENT; +#endif rc = db_env_create(dbenv, dbi-dbi_ecflags); rc = cvtdberr(dbi, db_env_create, rc, _debug); @@ -809,7 +807,8 @@ /* dbenv-set_paniccall(???) */ -if ((dbi-dbi_ecflags DB_CLIENT) dbi-dbi_host) { +#if defined(DB_RPCCLIENT) +if ((dbi-dbi_ecflags DB_RPCCLIENT) dbi-dbi_host) { const char * home; int retry = 0; @@ -825,7 +824,9 @@ break; (void) sleep(15); } -} else { +} else +#endif +{ { size_t _lo = 16 * 1024 * 1024; size_t _hi = 512 * 1024 * 1024; @@ -2475,7 +2476,9 @@ * glibc/kernel combinations. */ if (rc == 0 dbi-dbi_lockdbfd - !((dbi-dbi_ecflags DB_CLIENT) dbi-dbi_host) +#if defined(DB_RPCCLIENT) + !((dbi-dbi_ecflags DB_RPCCLIENT) dbi-dbi_host) +#endif (!dbi-dbi_use_dbenv || _lockdbfd++ == 0)) { int fdno = -1; @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org
[CVS] RPM: rpm/ devtool.conf
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: 13-Sep-2010 00:26:21 Branch: HEAD Handle: 201009162100 Modified files: rpm devtool.conf Log: - devtool: system: reenable --with-gpsee=/usr/lib/rpm. Summary: RevisionChanges Path 2.346 +3 -1 rpm/devtool.conf patch -p0 '@@ .' Index: rpm/devtool.conf $ cvs diff -u -r2.345 -r2.346 devtool.conf --- rpm/devtool.conf 1 Sep 2010 09:01:47 - 2.345 +++ rpm/devtool.conf 12 Sep 2010 22:26:21 - 2.346 @@ -15,6 +15,8 @@ MODULE_TAG_FICL= MODULE_TAG_RC= MODULE_TAG_BASH= # XXX bash is GPLv2 and cannot be bundled w RPM +MODULE_TAG_BEECRYPT= +MODULE_TAG_NEON= %checkout for name in $MODULE_NAMES $@; do @@ -113,7 +115,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 \ @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-cvs@rpm5.org