Use ARGV_t for package fileFile, fileList and policyList
- Similar to commit 1e3db59b56
,
all these end up being passed to argvSplit() to process them line
by line in the end, collect them in the argv to start with saving
a whole lotta huffing and puffing in the process
This commit is contained in:
parent
1e3db59b56
commit
a32705e737
|
@ -1709,8 +1709,6 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
Package pkg, int installSpecialDoc, int test)
|
||||
{
|
||||
struct FileList_s fl;
|
||||
char *s, **fp;
|
||||
ARGV_t files = NULL;
|
||||
const char *fileName;
|
||||
char buf[BUFSIZ];
|
||||
struct AttrRec_s arbuf;
|
||||
|
@ -1722,11 +1720,9 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
|
||||
if (pkg->fileFile) {
|
||||
char *ffn;
|
||||
ARGV_t filelists = NULL;
|
||||
FILE *fd;
|
||||
|
||||
argvSplit(&filelists, getStringBuf(pkg->fileFile), "\n");
|
||||
for (fp = filelists; *fp != NULL; fp++) {
|
||||
for (ARGV_const_t fp = pkg->fileFile; *fp != NULL; fp++) {
|
||||
if (**fp == '/') {
|
||||
ffn = rpmGetPath(*fp, NULL);
|
||||
} else {
|
||||
|
@ -1749,11 +1745,10 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
fclose(fd);
|
||||
return RPMRC_FAIL;
|
||||
}
|
||||
appendStringBuf(pkg->fileList, buf);
|
||||
argvAdd(&(pkg->fileList), buf);
|
||||
}
|
||||
(void) fclose(fd);
|
||||
}
|
||||
argvFree(filelists);
|
||||
}
|
||||
|
||||
/* Init the file list structure */
|
||||
|
@ -1803,11 +1798,8 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
fl.fileListRecsAlloced = 0;
|
||||
fl.fileListRecsUsed = 0;
|
||||
|
||||
s = getStringBuf(pkg->fileList);
|
||||
argvSplit(&files, s, "\n");
|
||||
|
||||
for (fp = files; *fp != NULL; fp++) {
|
||||
s = *fp;
|
||||
for (ARGV_const_t fp = pkg->fileList; *fp != NULL; fp++) {
|
||||
const char *s = *fp;
|
||||
SKIPSPACE(s);
|
||||
if (*s == '\0')
|
||||
continue;
|
||||
|
@ -1907,8 +1899,6 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
|
|||
specialDoc = _free(specialDoc);
|
||||
}
|
||||
|
||||
argvFree(files);
|
||||
|
||||
if (fl.processingFailed)
|
||||
goto exit;
|
||||
|
||||
|
|
|
@ -67,8 +67,7 @@ int parseFiles(rpmSpec spec)
|
|||
for (arg=1; arg<argc; arg++) {
|
||||
if (rstreq(argv[arg], "-f") && argv[arg+1]) {
|
||||
char *file = rpmGetPath(argv[arg+1], NULL);
|
||||
if (!pkg->fileFile) pkg->fileFile = newStringBuf();
|
||||
appendLineStringBuf(pkg->fileFile, file);
|
||||
argvAdd(&(pkg->fileFile), file);
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +78,7 @@ int parseFiles(rpmSpec spec)
|
|||
goto exit;
|
||||
} else {
|
||||
while (! (nextPart = isPart(spec->line))) {
|
||||
appendStringBuf(pkg->fileList, spec->line);
|
||||
argvAdd(&(pkg->fileList), spec->line);
|
||||
if ((rc = readLine(spec, STRIP_COMMENTS)) > 0) {
|
||||
nextPart = PART_NONE;
|
||||
break;
|
||||
|
|
|
@ -64,15 +64,13 @@ int parsePolicies(rpmSpec spec)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
pkg->policyList = newStringBuf();
|
||||
|
||||
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
|
||||
nextPart = PART_NONE;
|
||||
} else if (rc < 0) {
|
||||
goto exit;
|
||||
} else {
|
||||
while (!(nextPart = isPart(spec->line))) {
|
||||
appendLineStringBuf(pkg->policyList, spec->line);
|
||||
argvAdd(&(pkg->policyList), spec->line);
|
||||
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
|
||||
nextPart = PART_NONE;
|
||||
break;
|
||||
|
|
|
@ -221,8 +221,6 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
|||
uint32_t flags = 0;
|
||||
poptContext optCon = NULL;
|
||||
|
||||
ARGV_t policies = NULL;
|
||||
ARGV_t pol;
|
||||
rpmRC rc = RPMRC_FAIL;
|
||||
|
||||
struct poptOption optionsTable[] = {
|
||||
|
@ -236,10 +234,9 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
argvSplit(&policies, getStringBuf(pkg->policyList), "\n");
|
||||
for (pol = policies; *pol != NULL; pol++) {
|
||||
for (ARGV_const_t pol = pkg->policyList; *pol != NULL; pol++) {
|
||||
ModuleRec mod;
|
||||
char *line = *pol;
|
||||
const char *line = *pol;
|
||||
const char **argv = NULL;
|
||||
int argc = 0;
|
||||
int err;
|
||||
|
@ -288,7 +285,6 @@ static rpmRC processPolicies(rpmSpec spec, Package pkg, int test)
|
|||
rc = RPMRC_OK;
|
||||
|
||||
exit:
|
||||
argvFree(policies);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -129,9 +129,9 @@ struct Package_s {
|
|||
|
||||
struct TriggerFileEntry * triggerFiles;
|
||||
|
||||
StringBuf fileFile;
|
||||
StringBuf fileList; /* If NULL, package will not be written */
|
||||
StringBuf policyList;
|
||||
ARGV_t fileFile;
|
||||
ARGV_t fileList; /* If NULL, package will not be written */
|
||||
ARGV_t policyList;
|
||||
|
||||
Package next;
|
||||
};
|
||||
|
|
|
@ -99,7 +99,8 @@ Package newPackage(rpmSpec spec)
|
|||
p->header = headerNew();
|
||||
p->autoProv = 1;
|
||||
p->autoReq = 1;
|
||||
p->fileList = newStringBuf();
|
||||
p->fileList = argvNew();
|
||||
p->fileFile = NULL;
|
||||
p->policyList = NULL;
|
||||
|
||||
if (spec->packages == NULL) {
|
||||
|
@ -128,9 +129,9 @@ static Package freePackage(Package pkg)
|
|||
|
||||
pkg->header = headerFree(pkg->header);
|
||||
pkg->ds = rpmdsFree(pkg->ds);
|
||||
pkg->fileList = freeStringBuf(pkg->fileList);
|
||||
pkg->fileFile = freeStringBuf(pkg->fileFile);
|
||||
pkg->policyList = freeStringBuf(pkg->policyList);
|
||||
pkg->fileList = argvFree(pkg->fileList);
|
||||
pkg->fileFile = argvFree(pkg->fileFile);
|
||||
pkg->policyList = argvFree(pkg->policyList);
|
||||
if (pkg->cpioList) {
|
||||
rpmfi fi = pkg->cpioList;
|
||||
pkg->cpioList = NULL;
|
||||
|
|
Loading…
Reference in New Issue