RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall
Root: /v/rpm/cvs Email: rse@rpm5.org
Module: rpm Date: 27-Dec-2007 18:07:09
Branch: HEAD Handle: 2007122717070900
Modified files:
rpm CHANGES
rpm/lib poptALL.c
Log:
To be able to completely disable an RPM Lua part from the CLI one can
AFAIK only write a construct like...
%__foo_enabled 1
[...] %{?__foo_enabled:%{lua: <code>}} [...]
...in an "rpmmacros" file. To let <code> now be optionally disabled
under run-time from the CLI one has to configure an "rpmpopt" containing:
rpm alias --disable-foo --undefine '__foo_enabled'
So, let us implement "rpm --undefine <macro>" as the counterpart to "rpm
--define '<macro> <value>'" now to support this.
OTOH, even if one could solve the above issue also with other tools, for
consistency reasons it is good to have both --define and --undefine!
Summary:
Revision Changes Path
1.2024 +1 -0 rpm/CHANGES
2.67 +21 -0 rpm/lib/poptALL.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2023 -r1.2024 CHANGES
--- rpm/CHANGES 27 Dec 2007 16:44:13 -0000 1.2023
+++ rpm/CHANGES 27 Dec 2007 17:07:09 -0000 1.2024
@@ -1,4 +1,5 @@
5.0b3 -> 5.0b4:
+ - rse: implement "rpm --undefine <macro>" as the counterpart to "rpm --define '<macro> <value>'"
- afb: added %__objext,%__libext,%__shlibext,%__exeext for file extensions.
- rse: make size of line buffer for .spec file parsing run-time configurable via macro _spec_line_buffer_size
- rse: improve %patch macro implementation: less expansion redundancy and macro namespace collision avoidance
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.66 -r2.67 poptALL.c
--- rpm/lib/poptALL.c 25 Dec 2007 19:22:34 -0000 2.66
+++ rpm/lib/poptALL.c 27 Dec 2007 17:07:09 -0000 2.67
@@ -22,6 +22,7 @@
#ifdef DEAD /* XXX remember the previous definition however. */
#define POPT_RCFILE -995
#endif
+#define POPT_UNDEFINE -994
/*@access headerTagIndices @*/ /* XXX rpmcliFini */
/*@access headerTagTableEntry @*/ /* XXX rpmcliFini */
@@ -226,6 +227,23 @@
/*@=type@*/
s = _free(s);
} break;
+ case POPT_UNDEFINE:
+ { char *s, *t;
+ /* XXX Convert '-' in macro name to underscore, skip leading %. */
+ s = t = xstrdup(arg);
+ while (*t && !xisspace(*t)) {
+ if (*t == '-') *t = '_';
+ t++;
+ }
+ t = s;
+ if (*t == '%') t++;
+/*@-type@*/
+ rpmcliConfigured();
+ (void) rpmUndefineMacro(NULL, t);
+ (void) rpmUndefineMacro(rpmCLIMacroContext, t);
+/*@=type@*/
+ s = _free(s);
+ } break;
case 'E':
rpmcliConfigured();
{ const char *val = rpmExpand(arg, NULL);
@@ -369,6 +387,9 @@
{ "define", 'D', POPT_ARG_STRING, NULL, 'D',
N_("define MACRO with value EXPR"),
N_("'MACRO EXPR'") },
+ { "undefine", '\0', POPT_ARG_STRING, NULL, POPT_UNDEFINE,
+ N_("undefine MACRO"),
+ N_("'MACRO'") },
{ "eval", 'E', POPT_ARG_STRING, NULL, 'E',
N_("print macro expansion of EXPR"),
N_("'EXPR'") },
@@ .
Received on Thu Dec 27 18:07:09 2007