diff options
author | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:12:32 +0100 |
---|---|---|
committer | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:12:32 +0100 |
commit | fd6e4142505093ca91aafcba1351bb33820ae39a (patch) | |
tree | 58e5ea1f2b24aeb9b7af657c44c335c0d3d2cb83 | |
parent | 026b82f53b8f19e2b3af1f4366de0de2554d2173 (diff) | |
download | librpm-tizen-fd6e4142505093ca91aafcba1351bb33820ae39a.tar.gz librpm-tizen-fd6e4142505093ca91aafcba1351bb33820ae39a.tar.bz2 librpm-tizen-fd6e4142505093ca91aafcba1351bb33820ae39a.zip |
Add support for a new macro, %{_docdir}. It can be used to specify
the name of the directory for %doc files.
Default is "%{NAME}-%{VERSION}", SUSE uses just "%{NAME}".
rh#125514
Patch from OpenSuSE
-rw-r--r-- | build/files.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/build/files.c b/build/files.c index 49188a4c3..f1d6a19a8 100644 --- a/build/files.c +++ b/build/files.c @@ -1006,11 +1006,23 @@ static int parseForSimple(/*@unused@*/Spec spec, Package pkg, char * buf, res = 1; } else { /* XXX WATCHOUT: buf is an arg */ - { const char *ddir, *n, *v; - - (void) headerNVR(pkg->header, &n, &v, NULL); - - ddir = rpmGetPath("%{_docdir}/", n, "-", v, NULL); + { + static char *_docdir_fmt= 0; + static int oneshot = 0; + const char *ddir, *fmt, *errstr; + if (!oneshot) { + _docdir_fmt = rpmExpand("%{?_docdir_fmt}", NULL); + if (!_docdir_fmt || !*_docdir_fmt) + _docdir_fmt = "%{NAME}-%{VERSION}"; + oneshot = 1; + } + fmt = headerSprintf(pkg->header, _docdir_fmt, rpmTagTable, rpmHeaderFormats, &errstr); + if (!fmt) { + rpmError(RPMERR_BADSPEC, _("illegal _docdir_fmt: %s\n"), errstr); + fl->processingFailed = 1; + res = 1; + } + ddir = rpmGetPath("%{_docdir}/", fmt, NULL); strcpy(buf, ddir); ddir = _free(ddir); } |