11 #define _RPMEVR_INTERNAL
22 const char *script,
const char *
prog)
36 index = last->
index + 1;
41 tfe->
script = (script && *script !=
'\0') ?
xstrdup(script) : NULL;
56 static const char *
name = NULL;
58 static const char *
prog = NULL;
60 static const char *
file = NULL;
63 { NULL,
'p', POPT_ARG_STRING, &
prog,
'p', NULL, NULL},
64 { NULL,
'n', POPT_ARG_STRING, &
name,
'n', NULL, NULL},
65 { NULL,
'f', POPT_ARG_STRING, &
file,
'f', NULL, NULL},
66 { 0, 0, 0, 0, 0, NULL, NULL}
87 const char **progArgv = NULL;
89 char *partname = NULL;
102 const char **argv = NULL;
103 poptContext optCon = NULL;
116 tagflags = RPMSENSE_SCRIPT_PRE;
122 tagflags = RPMSENSE_SCRIPT_POST;
128 tagflags = RPMSENSE_SCRIPT_PREUN;
134 tagflags = RPMSENSE_SCRIPT_POSTUN;
136 partname =
"%postun";
142 partname =
"%pretrans";
148 partname =
"%posttrans";
152 tagflags = RPMSENSE_SCRIPT_VERIFY;
154 partname =
"%verifyscript";
161 partname =
"%triggerprein";
168 partname =
"%triggerin";
175 partname =
"%triggerun";
182 partname =
"%triggerpostun";
187 tagflags = RPMSENSE_SCRIPT_SANITYCHECK;
189 partname =
"%sanitycheck";
195 p = strstr(spec->
line,
"--");
203 strcpy(reqargs, p + 2);
206 if ((rc = poptParseArgvString(spec->
line, &argc, &argv))) {
208 spec->
lineNum, partname, poptStrerror(rc));
212 optCon = poptGetContext(NULL, argc, argv,
optionsTable, 0);
213 while ((arg = poptGetNextOpt(optCon)) > 0) {
216 if (
prog[0] ==
'<') {
217 const char * s =
prog;
218 while (s && s[1] && s[1] !=
'>')
222 _(
"line %d: embedded interpreter token must end "
227 }
else if (
prog[0] ==
'%') {
229 }
else if (
prog[0] !=
'/') {
231 _(
"line %d: script program must begin "
246 poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
252 if (poptPeekArg(optCon)) {
255 name = poptGetArg(optCon);
257 if (poptPeekArg(optCon)) {
282 if ((rc = poptParseArgvString(
prog, &progArgc, &progArgv))) {
284 spec->
lineNum, partname, poptStrerror(rc));
309 #define SO_EXT "()(64bit)"
315 if (!strcmp(progArgv[0],
"<lua>")) {
322 "BuiltinLuaScripts",
"4.2.2-1");
326 if (!strcmp(progArgv[0],
"<augeas>")) {
328 "BuiltinAugeasScripts",
"5.3-1");
332 if (!strcmp(progArgv[0],
"<ficl>")) {
334 "BuiltinFiclScripts",
"5.2-1");
338 if (!strcmp(progArgv[0],
"<js>")) {
340 "BuiltinJavaScript",
"5.2-1");
343 #ifdef WITH_PERLEMBED
344 if (!strcmp(progArgv[0],
"<perl>")) {
346 "BuiltinPerlScripts",
"5.2-1");
350 #ifdef WITH_PYTHONEMBED
351 if (!strcmp(progArgv[0],
"<python>")) {
353 "BuiltinPythonScripts",
"5.2-1");
357 #ifdef WITH_RUBYEMBED
358 if (!strcmp(progArgv[0],
"<ruby>")) {
360 "BuiltinRubyScripts",
"5.2-1");
365 if (!strcmp(progArgv[0],
"<spook>")) {
367 "BuiltinSpookScripts",
"5.3-1");
371 if (!strcmp(progArgv[0],
"<sql>")) {
373 "BuiltinSqlScripts",
"5.3-1");
377 if (!strcmp(progArgv[0],
"<squirrel>")) {
379 "BuiltinSquirrelScripts",
"5.2-1");
384 if (!strcmp(progArgv[0],
"<tcl>")) {
386 "BuiltinTclScripts",
"5.2-1");
390 if (progArgv[0][0] ==
'<') {
392 _(
"line %d: unsupported internal script: %s\n"),
398 && !strcmp(progArgv[0],
"/bin/sh")))
402 progArgv[0], NULL, (tagflags | RPMSENSE_INTERP), 0);
412 if ((rc =
parseRCPOT(spec, pkg, reqargs, reqtag, index, tagflags)))
418 he->
p.
str = *progArgv;
423 "ScriptletInterpreterArgs",
"4.0.3-1");
426 he->
p.
argv = progArgv;
468 rc = (
rpmRC) nextPart;
472 progArgv =
_free(progArgv);
474 optCon = poptFreeContext(optCon);