RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall
Root: /v/rpm/cvs Email: [EMAIL PROTECTED]
Module: rpm Date: 24-Dec-2007 10:00:08
Branch: HEAD Handle: 2007122409000601
Modified files:
rpm CHANGES
rpm/rpmio macro.c rpmlua.c rpmmacro.h
Log:
- provide RPM Lua function rpm.undefine() based on the C function
rpmUndefineMacro
- provide rpmUndefineMacro API function to complement the existing
rpmDefineMacro API function
Summary:
Revision Changes Path
1.2012 +2 -0 rpm/CHANGES
2.160 +9 -0 rpm/rpmio/macro.c
2.31 +10 -0 rpm/rpmio/rpmlua.c
2.45 +10 -0 rpm/rpmio/rpmmacro.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2011 -r1.2012 CHANGES
--- rpm/CHANGES 23 Dec 2007 22:50:05 -0000 1.2011
+++ rpm/CHANGES 24 Dec 2007 09:00:06 -0000 1.2012
@@ -1,4 +1,6 @@
5.0b3 -> 5.0b4:
+ - rse: provide RPM Lua function rpm.undefine() based on the C function
rpmUndefineMacro
+ - rse: provide rpmUndefineMacro API function to complement the existing
rpmDefineMacro API function
- rse: add scripts/lua-dump.lua, a recursive dumper for Lua data
structures
- rse: fix parsing of the table key in RPM Lua function rpm.macros()
- rse: add an RPM Lua function rpm.load() for loading external Lua
scripts
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/macro.c
============================================================================
$ cvs diff -u -r2.159 -r2.160 macro.c
--- rpm/rpmio/macro.c 16 Dec 2007 22:54:40 -0000 2.159
+++ rpm/rpmio/macro.c 24 Dec 2007 09:00:07 -0000 2.160
@@ -2061,6 +2061,15 @@
}
/[EMAIL PROTECTED]@*/
+/[EMAIL PROTECTED]@*/ /* LCL: mc is modified through mb->mc, mb is abstract
*/
+int
+rpmUndefineMacro(MacroContext mc, const char * macro)
+{
+ (void) doUndefine(mc ? mc : rpmGlobalMacroContext, macro);
+ return 0;
+}
+/[EMAIL PROTECTED]@*/
+
void
rpmLoadMacros(MacroContext mc, int level)
{
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmlua.c
============================================================================
$ cvs diff -u -r2.30 -r2.31 rpmlua.c
--- rpm/rpmio/rpmlua.c 23 Dec 2007 22:46:00 -0000 2.30
+++ rpm/rpmio/rpmlua.c 24 Dec 2007 09:00:07 -0000 2.31
@@ -696,6 +696,15 @@
return 0;
}
+static int rpm_undefine(lua_State *L)
+ /[EMAIL PROTECTED] rpmGlobalMacroContext, h_errno, internalState @*/
+ /[EMAIL PROTECTED] L, rpmGlobalMacroContext, internalState @*/
+{
+ const char *str = luaL_checkstring(L, 1);
+ (void) rpmUndefineMacro(NULL, str);
+ return 0;
+}
+
static int rpm_interactive(lua_State *L)
/[EMAIL PROTECTED] fileSystem @*/
/[EMAIL PROTECTED] L, fileSystem @*/
@@ -918,6 +927,7 @@
{"macros", rpm_macros},
{"expand", rpm_expand},
{"define", rpm_define},
+ {"undefine", rpm_undefine},
{"register", rpm_register},
{"unregister", rpm_unregister},
{"call", rpm_call},
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmmacro.h
============================================================================
$ cvs diff -u -r2.44 -r2.45 rpmmacro.h
--- rpm/rpmio/rpmmacro.h 18 Dec 2007 13:02:08 -0000 2.44
+++ rpm/rpmio/rpmmacro.h 24 Dec 2007 09:00:07 -0000 2.45
@@ -148,6 +148,16 @@
/[EMAIL PROTECTED] mc, rpmGlobalMacroContext, internalState @*/;
/**
+ * Undefine macro in context.
+ * @param mc macro context (NULL uses global context).
+ * @param macro macro name
+ * @return @todo Document.
+ */
+int rpmUndefineMacro(/[EMAIL PROTECTED]@*/ MacroContext mc, const char *
macro)
+ /[EMAIL PROTECTED] rpmGlobalMacroContext, h_errno, internalState @*/
+ /[EMAIL PROTECTED] mc, rpmGlobalMacroContext, internalState @*/;
+
+/**
* Load macros from specific context into global context.
* @param mc macro context (NULL does nothing).
* @param level macro recursion level (0 is entry API)
@@ .
______________________________________________________________________
RPM Package Manager http://rpm5.org
CVS Sources Repository [email protected]