rpm/docdir_fmt.diff

37 lines
1.2 KiB
Diff

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
--- ./build/files.c.orig 2005-12-14 19:22:43.000000000 +0000
+++ ./build/files.c 2006-02-17 13:57:25.000000000 +0000
@@ -1006,11 +1006,23 @@ static int parseForSimple(/*@unused@*/Sp
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);
}