summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-09-02 12:56:55 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-09-02 12:56:55 +0300
commit0b57571990817fa9872b9adfb000930bb09d58c0 (patch)
tree4d8b05ea402ca278743b54562bf64e5728b823eb
parentecaf972db05f6b23514a747c4a503268658ac98d (diff)
downloadrpm-0b57571990817fa9872b9adfb000930bb09d58c0.tar.gz
rpm-0b57571990817fa9872b9adfb000930bb09d58c0.tar.bz2
rpm-0b57571990817fa9872b9adfb000930bb09d58c0.zip
Make rpmScript opaque
- Add accessor for fetching the script tag, the final piece that psm needs (and will continue to do so) from script internals. This allows the script type to become opaque for real.
-rw-r--r--lib/psm.c9
-rw-r--r--lib/rpmscript.c13
-rw-r--r--lib/rpmscript.h10
3 files changed, 20 insertions, 12 deletions
diff --git a/lib/psm.c b/lib/psm.c
index c5ecbe470..7b1111b27 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -408,9 +408,10 @@ static rpmRC runScript(rpmpsm psm, ARGV_const_t prefixes,
rpmScript script, int arg1, int arg2)
{
rpmRC rc = RPMRC_OK;
- int warn_only = (script->tag != RPMTAG_PREIN &&
- script->tag != RPMTAG_PREUN &&
- script->tag != RPMTAG_VERIFYSCRIPT);
+ rpmTagVal stag = rpmScriptTag(script);
+ int warn_only = (stag != RPMTAG_PREIN &&
+ stag != RPMTAG_PREUN &&
+ stag != RPMTAG_VERIFYSCRIPT);
int selinux = !(rpmtsFlags(psm->ts) & RPMTRANS_FLAG_NOCONTEXTS);
rpmswEnter(rpmtsOp(psm->ts, RPMTS_OP_SCRIPTLETS), 0);
@@ -427,7 +428,7 @@ static rpmRC runScript(rpmpsm psm, ARGV_const_t prefixes,
if (warn_only) {
rc = RPMRC_OK;
}
- rpmtsNotify(psm->ts, psm->te, RPMCALLBACK_SCRIPT_ERROR, script->tag, rc);
+ rpmtsNotify(psm->ts, psm->te, RPMCALLBACK_SCRIPT_ERROR, stag, rc);
}
return rc;
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index f148eb506..9ab2c7da7 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -16,6 +16,14 @@
#include "debug.h"
+struct rpmScript_s {
+ rpmTagVal tag; /* script tag */
+ char **args; /* scriptlet call arguments */
+ char *body; /* script body */
+ char *descr; /* description for logging */
+ rpmscriptFlags flags; /* flags to control operation */
+};
+
/**
* Run internal Lua script.
*/
@@ -452,3 +460,8 @@ rpmScript rpmScriptFree(rpmScript script)
}
return NULL;
}
+
+rpmTagVal rpmScriptTag(rpmScript script)
+{
+ return (script != NULL) ? script->tag : RPMTAG_NOT_FOUND;
+}
diff --git a/lib/rpmscript.h b/lib/rpmscript.h
index 642090f96..1d87b0d95 100644
--- a/lib/rpmscript.h
+++ b/lib/rpmscript.h
@@ -14,14 +14,6 @@ typedef rpmFlags rpmscriptFlags;
typedef struct rpmScript_s * rpmScript;
-struct rpmScript_s {
- rpmTagVal tag; /* script tag */
- char **args; /* scriptlet call arguments */
- char *body; /* script body */
- char *descr; /* description for logging */
- rpmscriptFlags flags; /* flags to control operation */
-};
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -39,6 +31,8 @@ RPM_GNUC_INTERNAL
rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
ARGV_const_t prefixes, int warn_only, int selinux);
+RPM_GNUC_INTERNAL
+rpmTagVal rpmScriptTag(rpmScript script);
#ifdef __cplusplus
}
#endif