summaryrefslogtreecommitdiff
path: root/build/parseScript.c
diff options
context:
space:
mode:
authorniemeyer <devnull@localhost>2004-03-16 21:58:25 +0000
committerniemeyer <devnull@localhost>2004-03-16 21:58:25 +0000
commit73260d956c54a3d95aa7d367c09ed3e2cb2a2a00 (patch)
tree420516b3d6568f1e09364f6fd59c6c1849da0b43 /build/parseScript.c
parent55f77d61d72a3993436db9a8eefec9eaa7fb61ae (diff)
downloadlibrpm-tizen-73260d956c54a3d95aa7d367c09ed3e2cb2a2a00.tar.gz
librpm-tizen-73260d956c54a3d95aa7d367c09ed3e2cb2a2a00.tar.bz2
librpm-tizen-73260d956c54a3d95aa7d367c09ed3e2cb2a2a00.zip
- Implemented support for internal Lua scripts.
- Implemented %pretrans and %posttrans script slots. Changed files: Makefile.am configure.ac build/pack.c build/parseScript.c build/parseSpec.c build/rpmbuild.h build/rpmspec.h lib/Makefile.am lib/psm.c lib/rpmlib.h lib/rpmlibprov.c lib/rpmts.c lib/rpmts.h lib/transaction.c Added files: lib/rpmlua.c lib/rpmlua.h lua/* CVS patchset: 7175 CVS date: 2004/03/16 21:58:25
Diffstat (limited to 'build/parseScript.c')
-rw-r--r--build/parseScript.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/build/parseScript.c b/build/parseScript.c
index 4e30f1382..03634c0bd 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -8,6 +8,8 @@
#include "rpmbuild.h"
#include "debug.h"
+#include <rpmlua.h>
+
/*@access StringBuf@*/ /* XXX compared with NULL */
/*@access poptContext @*/ /* compared with NULL */
@@ -129,6 +131,18 @@ int parseScript(Spec spec, int parsePart)
progtag = RPMTAG_POSTUNPROG;
partname = "%postun";
break;
+ case PART_PRETRANS:
+ tag = RPMTAG_PRETRANS;
+ tagflags = 0;
+ progtag = RPMTAG_PRETRANSPROG;
+ partname = "%pretrans";
+ break;
+ case PART_POSTTRANS:
+ tag = RPMTAG_POSTTRANS;
+ tagflags = 0;
+ progtag = RPMTAG_POSTTRANSPROG;
+ partname = "%posttrans";
+ break;
case PART_VERIFYSCRIPT:
tag = RPMTAG_VERIFYSCRIPT;
tagflags = RPMSENSE_SCRIPT_VERIFY;
@@ -182,7 +196,15 @@ int parseScript(Spec spec, int parsePart)
while ((arg = poptGetNextOpt(optCon)) > 0) {
switch (arg) {
case 'p':
- if (prog[0] != '/') {
+ if (prog[0] == '<') {
+ if (prog[strlen(prog)-1] != '>') {
+ rpmError(RPMERR_BADSPEC,
+ _("line %d: internal script must end "
+ "with \'>\': %s\n"), spec->lineNum, prog);
+ rc = RPMERR_BADSPEC;
+ goto exit;
+ }
+ } else if (prog[0] != '/') {
rpmError(RPMERR_BADSPEC,
_("line %d: script program must begin "
"with \'/\': %s\n"), spec->lineNum, prog);
@@ -261,7 +283,25 @@ int parseScript(Spec spec, int parsePart)
stripTrailingBlanksStringBuf(sb);
p = getStringBuf(sb);
- (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
+ if (!strcmp(progArgv[0], "<lua>")) {
+ rpmlua lua = rpmluaNew();
+ if (rpmluaCheckScript(lua, p, partname) != RPMRC_OK) {
+ rpmluaFree(lua);
+ rc = RPMERR_BADSPEC;
+ goto exit;
+ }
+ rpmluaFree(lua);
+ (void) rpmlibNeedsFeature(pkg->header,
+ "BuiltinLuaScripts", "4.2.2-1");
+ } else if (progArgv[0][0] == '<') {
+ rpmError(RPMERR_BADSPEC,
+ _("line %d: unsupported internal script: %s\n"),
+ spec->lineNum, progArgv[0]);
+ rc = RPMERR_BADSPEC;
+ goto exit;
+ } else {
+ (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
+ }
/* Trigger script insertion is always delayed in order to */
/* get the index right. */
@@ -300,6 +340,12 @@ int parseScript(Spec spec, int parsePart)
case PART_POSTUN:
pkg->postUnFile = xstrdup(file);
break;
+ case PART_PRETRANS:
+ pkg->preTransFile = xstrdup(file);
+ break;
+ case PART_POSTTRANS:
+ pkg->postTransFile = xstrdup(file);
+ break;
case PART_VERIFYSCRIPT:
pkg->verifyFile = xstrdup(file);
break;