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: 25-Dec-2007 20:22:34
Branch: HEAD Handle: 2007122519223400
Modified files:
rpm VENDOR
rpm/lib poptALL.c
Log:
An OpenPKG-specific cosmetics hack: do not output an extra newline on
--eval '' if the expanded macro text already terminates with a newline
Background is that using e.g. rpm --eval "%{lua: print('foo\\n') }" should
not lead to an extra trailing blank line. This is still OpenPKG-specific
as it is not backward compatible to the behaviour others might expect
from RPM. OTOH I see no problem in making this behaviour the standard in
RPM 5 as we do not really *have* to be compatible... but let Jeff decide
on those things.
Summary:
Revision Changes Path
2.19 +7 -0 rpm/VENDOR
2.66 +7 -0 rpm/lib/poptALL.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/VENDOR
============================================================================
$ cvs diff -u -r2.18 -r2.19 VENDOR
--- rpm/VENDOR 23 Dec 2007 21:21:26 -0000 2.18
+++ rpm/VENDOR 25 Dec 2007 19:22:34 -0000 2.19
@@ -321,4 +321,11 @@
we want to fetch at a particular controlled step
in the packaging life-cycle (between "rpm -bt" and
"rpm -bp").
+ ________________________________________________________________________
+
+ Change: no-extra-terminating-newline-on-eval
+ Purpose: Do not output an extra newline on --eval '' if the
+ expanded macro text already terminates with a newline
+ Reason: Using e.g. rpm --eval "%{lua: print('foo\\n') }" should
+ not lead to an extra trailing blank line.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.65 -r2.66 poptALL.c
--- rpm/lib/poptALL.c 16 Dec 2007 19:30:06 -0000 2.65
+++ rpm/lib/poptALL.c 25 Dec 2007 19:22:34 -0000 2.66
@@ -229,6 +229,13 @@
case 'E':
rpmcliConfigured();
{ const char *val = rpmExpand(arg, NULL);
+#if defined(RPM_VENDOR_OPENPKG) /* no-extra-terminating-newline-on-eval */
+ size_t val_len;
+ val_len = strlen(val);
+ if (val[val_len - 1] == '\n')
+ fwrite(val, val_len, 1, stdout);
+ else
+#endif
fprintf(stdout, "%s\n", val);
val = _free(val);
}
@@ .
Received on Tue Dec 25 20:22:34 2007