distromatic: use per-arch id counter for FileTree

This commit is contained in:
Silvan Calarco 2013-10-14 18:19:41 +02:00
parent 406de2b323
commit adf76fa4fd
3 changed files with 12 additions and 12 deletions

View File

@ -464,7 +464,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
if ((currheader->require[i]->name)[0] == '/') {
/* requirement is a file, find who provides it */
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name);
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name, archidx);
if (file->numproviders > 0) {
scanheader=file->provider[0];
provided->numproviders=file->numproviders;
@ -550,7 +550,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
}
if ((currheader->require[i]->name)[0] == '/') {
/* when there is a Requires: /file/requirement add provide from file tree as well */
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name);
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name, archidx);
for (k = 0; k < file->numproviders; k++) {
for (j = 0, found = 0; j < provided->numproviders; j++) {
/* avoid duplicates */
@ -717,7 +717,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
if ((currsourceheader->require[i]->name)[0] == '/') {
/* requirement is a file, find who provides it */
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currsourceheader->require[i]->name);
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currsourceheader->require[i]->name, archidx);
if (file->numproviders > 0) {
provided->numbuildproviders=file->numproviders;
provided->buildprovider=file->provider;

View File

@ -465,9 +465,9 @@ findOrCreateProvidedListEntry(struct providedList* *idx,
}
struct fileTree*
findOrCreateFileTreeBrother(struct fileTree* *first,char* findname)
findOrCreateFileTreeBrother(struct fileTree* *first,char* findname, int arch)
{
static long id = 0;
static long id[ARCHS_MAX] = { 0, 0, 0, 0, 0};
struct fileTree *newdir, *currdir, *prevdir = NULL;
int c = 0;
@ -486,7 +486,7 @@ findOrCreateFileTreeBrother(struct fileTree* *first,char* findname)
newdir->provider = NULL;
newdir->numproviders = 0;
newdir->parent = NULL;
newdir->id = id++;
newdir->id = id[arch]++;
if (prevdir) {
newdir->next = prevdir->next;
@ -503,7 +503,7 @@ findOrCreateFileTreeBrother(struct fileTree* *first,char* findname)
}
struct fileTree*
findOrCreateFileTreeEntry(struct fileTree* *first,char* findname)
findOrCreateFileTreeEntry(struct fileTree* *first,char* findname, int arch)
{
struct fileTree *currdir,*prevdir=NULL;
char *pstart,*pend;
@ -523,11 +523,11 @@ findOrCreateFileTreeEntry(struct fileTree* *first,char* findname)
f[pend-pstart]='\0';
if (prevdir) {
currdir = findOrCreateFileTreeBrother(&prevdir->firstchild,f);
currdir = findOrCreateFileTreeBrother(&prevdir->firstchild,f,arch);
currdir->parent = prevdir;
}
else
currdir = findOrCreateFileTreeBrother(first,f);
currdir = findOrCreateFileTreeBrother(first,f,arch);
if (!*first)
*first = currdir;
@ -1054,7 +1054,7 @@ addToHeaderList(struct configTag *ct,
malloc(sizeof(struct fileTree*) * filenamecount);
for (j=0; j<filenamecount; j++) {
snprintf(filename,bufsize,"%s%s",dirname[dirindex[j]],basename[j]);
newheaderlist->file[j] = findOrCreateFileTreeEntry(&ct->filetree[arch],filename);
newheaderlist->file[j] = findOrCreateFileTreeEntry(&ct->filetree[arch],filename,arch);
if (newheaderlist->file[j]->numproviders == 0) {
newheaderlist->file[j]->numproviders++;
newheaderlist->file[j]->provider=malloc(sizeof(struct headerList*));

View File

@ -168,10 +168,10 @@ findOrCreateProvidedListEntry(struct providedList **idx,
char* findname, int create, int arch);
struct fileTree*
findOrCreateFileTreeBrother(struct fileTree* *first,char* findname);
findOrCreateFileTreeBrother(struct fileTree* *first,char* findname, int arch);
struct fileTree*
findOrCreateFileTreeEntry(struct fileTree* *first,char* findname);
findOrCreateFileTreeEntry(struct fileTree* *first,char* findname, int arch);
void
cleanProvidedListIndex(struct configTag *ct, int arch);