Push special doc directory generation next to other special doc foobar
- There's no need to carry the special doc directory in the package struct, the directory is only a fleeting thing deep down in the filelist parsing. Handle local-only needs locally. - No behavior/semantic changes intended or expected.
This commit is contained in:
parent
29677605d4
commit
5895463186
|
@ -1691,6 +1691,30 @@ exit:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static char * getSpecialDocDir(Header h)
|
||||
{
|
||||
const char *errstr, *docdir_fmt = "%{NAME}-%{VERSION}";
|
||||
char *fmt_macro, *fmt;
|
||||
char *res = NULL;
|
||||
|
||||
fmt_macro = rpmExpand("%{?_docdir_fmt}", NULL);
|
||||
if (fmt_macro && strlen(fmt_macro) > 0) {
|
||||
docdir_fmt = fmt_macro;
|
||||
}
|
||||
|
||||
fmt = headerFormat(h, docdir_fmt, &errstr);
|
||||
|
||||
if (fmt) {
|
||||
res = rpmGetPath("%{_docdir}/", fmt, NULL);
|
||||
} else {
|
||||
rpmlog(RPMLOG_ERR, _("illegal _docdir_fmt: %s\n"), errstr);
|
||||
}
|
||||
|
||||
free(fmt);
|
||||
free(fmt_macro);
|
||||
return res;
|
||||
}
|
||||
|
||||
static rpmRC processSpecialDocs(rpmSpec spec, const char *docDir,
|
||||
ARGV_const_t docs, int install, int test)
|
||||
{
|
||||
|
@ -1827,22 +1851,24 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
|
||||
/* Now process special doc, if there is one */
|
||||
if (specialDoc) {
|
||||
if (processSpecialDocs(spec, pkg->specialDocDir, specialDoc,
|
||||
installSpecialDoc, test)) {
|
||||
char *docDir = getSpecialDocDir(pkg->header);
|
||||
if (docDir == NULL || processSpecialDocs(spec, docDir, specialDoc,
|
||||
installSpecialDoc, test)) {
|
||||
fl.processingFailed = 1;
|
||||
} else {
|
||||
/* Reset for %doc */
|
||||
FileEntryFree(&fl.cur);
|
||||
|
||||
fl.cur.verifyFlags = fl.def.verifyFlags;
|
||||
|
||||
dupAttrRec(specialDocAttrRec, &fl.cur.ar);
|
||||
dupAttrRec(def_specialDocAttrRec, &fl.def.ar);
|
||||
freeAttrRec(specialDocAttrRec);
|
||||
freeAttrRec(def_specialDocAttrRec);
|
||||
|
||||
(void) processBinaryFile(pkg, &fl, docDir);
|
||||
}
|
||||
|
||||
/* Reset for %doc */
|
||||
FileEntryFree(&fl.cur);
|
||||
|
||||
fl.cur.verifyFlags = fl.def.verifyFlags;
|
||||
|
||||
dupAttrRec(specialDocAttrRec, &fl.cur.ar);
|
||||
dupAttrRec(def_specialDocAttrRec, &fl.def.ar);
|
||||
freeAttrRec(specialDocAttrRec);
|
||||
freeAttrRec(def_specialDocAttrRec);
|
||||
|
||||
(void) processBinaryFile(pkg, &fl, pkg->specialDocDir);
|
||||
free(docDir);
|
||||
}
|
||||
|
||||
if (fl.processingFailed)
|
||||
|
|
|
@ -536,30 +536,6 @@ static void fillOutMainPackage(Header h)
|
|||
}
|
||||
}
|
||||
|
||||
static int getSpecialDocDir(Package pkg)
|
||||
{
|
||||
const char *errstr, *docdir_fmt = "%{NAME}-%{VERSION}";
|
||||
char *fmt_macro, *fmt;
|
||||
int rc = -1;
|
||||
|
||||
fmt_macro = rpmExpand("%{?_docdir_fmt}", NULL);
|
||||
if (fmt_macro && strlen(fmt_macro) > 0) {
|
||||
docdir_fmt = fmt_macro;
|
||||
}
|
||||
fmt = headerFormat(pkg->header, docdir_fmt, &errstr);
|
||||
if (!fmt) {
|
||||
rpmlog(RPMLOG_ERR, _("illegal _docdir_fmt: %s\n"), errstr);
|
||||
goto exit;
|
||||
}
|
||||
pkg->specialDocDir = rpmGetPath("%{_docdir}/", fmt, NULL);
|
||||
rc = 0;
|
||||
|
||||
exit:
|
||||
free(fmt);
|
||||
free(fmt_macro);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static rpmRC readIcon(Header h, const char * file)
|
||||
|
@ -1110,10 +1086,6 @@ int parsePreamble(rpmSpec spec, int initialPackage)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (getSpecialDocDir(pkg)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* if we get down here nextPart has been set to non-error */
|
||||
res = nextPart;
|
||||
|
||||
|
|
|
@ -101,8 +101,6 @@ struct Package_s {
|
|||
char * postTransFile; /*!< %posttrans scriptlet. */
|
||||
char * verifyFile; /*!< %verifyscript scriptlet. */
|
||||
|
||||
char *specialDocDir;
|
||||
|
||||
struct TriggerFileEntry * triggerFiles;
|
||||
|
||||
ARGV_t fileFile;
|
||||
|
|
|
@ -134,7 +134,6 @@ static Package freePackage(Package pkg)
|
|||
pkg->policyList = argvFree(pkg->policyList);
|
||||
pkg->cpioList = rpmfiFree(pkg->cpioList);
|
||||
|
||||
pkg->specialDocDir = _free(pkg->specialDocDir);
|
||||
pkg->icon = freeSources(pkg->icon);
|
||||
pkg->triggerFiles = freeTriggerFiles(pkg->triggerFiles);
|
||||
|
||||
|
|
Loading…
Reference in New Issue