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

View File

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

View File

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