summaryrefslogtreecommitdiff
path: root/lib/macro.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-11-19 18:19:41 +0000
committerjbj <devnull@localhost>1999-11-19 18:19:41 +0000
commitc6d768583ef384f1037d5d3fb3c73174cebd6bdf (patch)
tree3b8803c45679d92143e2408d9fc08b7d398df6ac /lib/macro.c
parent1f6614e61efc520d2da0c09604d4ee1c06117073 (diff)
downloadlibrpm-tizen-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.tar.gz
librpm-tizen-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.tar.bz2
librpm-tizen-c6d768583ef384f1037d5d3fb3c73174cebd6bdf.zip
macros.in: Add buildsubdir and scriptlet template macros.
build/build.c: Rewrite to use scriptlet templates. build/files.c: Rename variables to prepare for (possibly) URL's in %files. build/myftw.c: Use Lstat. build/parsePreamble.c: Permit URL's in BuildRoot tag if not from spec file. build/parseSpec.c: ditto build/parsePrep.c: Add buildsubdir macro. lib/macro.c: Add url2path (nickname u2p) and verbose macro primitives. lib/url.c: urlPath returns "" if url is NULL (rpmGenPath memory corruption). CVS patchset: 3430 CVS date: 1999/11/19 18:19:41
Diffstat (limited to 'lib/macro.c')
-rw-r--r--lib/macro.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/macro.c b/lib/macro.c
index b206e2c45..ea71b43c1 100644
--- a/lib/macro.c
+++ b/lib/macro.c
@@ -785,7 +785,7 @@ doOutput(MacroBuf *mb, int waserror, const char *msg, size_t msglen)
}
static void
-doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
+doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t glen)
{
char buf[BUFSIZ], *b = NULL, *be;
int c;
@@ -811,6 +811,14 @@ doFoo(MacroBuf *mb, const char *f, size_t fn, const char *g, size_t glen)
b++;
} else if (STREQ("expand", f, fn)) {
b = buf;
+ } else if (STREQ("verbose", f, fn)) {
+ if (negate)
+ b = (rpmIsVerbose() ? NULL : buf);
+ else
+ b = (rpmIsVerbose() ? buf : NULL);
+ } else if (STREQ("url2path", f, fn) || STREQ("u2p", f, fn)) {
+ (void)urlPath(buf, (const char **)&b);
+ if (*b == '\0') b = "/";
} else if (STREQ("uncompress", f, fn)) {
int compressed = 1;
for (b = buf; (c = *b) && isblank(c);)
@@ -1061,11 +1069,14 @@ expandMacro(MacroBuf *mb)
if (STREQ("basename", f, fn) ||
STREQ("suffix", f, fn) ||
STREQ("expand", f, fn) ||
+ STREQ("verbose", f, fn) ||
STREQ("uncompress", f, fn) ||
+ STREQ("url2path", f, fn) ||
+ STREQ("u2p", f, fn) ||
STREQ("S", f, fn) ||
STREQ("P", f, fn) ||
STREQ("F", f, fn)) {
- doFoo(mb, f, fn, g, gn);
+ doFoo(mb, negate, f, fn, g, gn);
s = se;
continue;
}