Fix version requirements checks with multiple providers
Also make providedList more linear by removing numversions and using numproviders for provider[] and version[] vectors
This commit is contained in:
parent
f49e684c64
commit
57786153d2
@ -417,10 +417,11 @@ static int
|
|||||||
resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
||||||
{
|
{
|
||||||
struct headerList *currheader, *scanheader, **newprovider;
|
struct headerList *currheader, *scanheader, **newprovider;
|
||||||
struct providedList *provided;
|
struct providedList *provided, *foundverprovided;
|
||||||
struct fileTree *file;
|
struct fileTree *file;
|
||||||
int i,j,k,found;
|
int i,j,k,found;
|
||||||
char warning[PATH_MAX];
|
char warning[PATH_MAX];
|
||||||
|
char ** newversion;
|
||||||
|
|
||||||
currheader = ct->headerlist[archidx];
|
currheader = ct->headerlist[archidx];
|
||||||
|
|
||||||
@ -593,51 +594,76 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
|
|||||||
newprovider[j]=provided->provider[j];
|
newprovider[j]=provided->provider[j];
|
||||||
}
|
}
|
||||||
newprovider[provided->numproviders-1] = file->provider[k];
|
newprovider[provided->numproviders-1] = file->provider[k];
|
||||||
free(provided->provider);
|
if (provided->provider) free(provided->provider);
|
||||||
provided->provider=newprovider;
|
provided->provider=newprovider;
|
||||||
|
newversion=malloc(sizeof(char *)*provided->numproviders);
|
||||||
|
for (j = 0; j < provided->numproviders-1; j++) {
|
||||||
|
newversion[j]=provided->version[j];
|
||||||
|
}
|
||||||
|
newversion[provided->numproviders-1] = strdup(provided->provider[j]->version);
|
||||||
|
if (provided->version) free(provided->version);
|
||||||
|
provided->version=newversion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provided->numversions > 0) {
|
if (provided->numproviders > 0) {
|
||||||
if (strcmp(currheader->require[i]->version,"") &&
|
if (strcmp(currheader->require[i]->version,"") &&
|
||||||
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) {
|
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) {
|
||||||
|
|
||||||
found = 0;
|
found = 0;
|
||||||
for (j = 0; j < provided->numversions; j++) {
|
foundverprovided = NULL;
|
||||||
|
|
||||||
|
for (j = 0; j < provided->numproviders; j++) {
|
||||||
|
if (foundverprovided && !strcmp(foundverprovided->name,provided->name)) {
|
||||||
|
found = 0;
|
||||||
|
foundverprovided = NULL;
|
||||||
|
}
|
||||||
if (!strcmp(provided->version[j],"")) {
|
if (!strcmp(provided->version[j],"")) {
|
||||||
/* provider with no version; assume ok */
|
/* provider with no version; assume ok */
|
||||||
found = 1;
|
found = 1;
|
||||||
|
foundverprovided=provided;
|
||||||
} else {
|
} else {
|
||||||
if (checkVersionWithFlags(
|
if (checkVersionWithFlags(
|
||||||
currheader->require[i]->version,
|
currheader->require[i]->version,
|
||||||
currheader->require[i]->flags,
|
currheader->require[i]->flags,
|
||||||
provided->version[j])) found = 1;
|
provided->version[j])) {
|
||||||
|
found = 1;
|
||||||
|
foundverprovided=provided;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} /* for */
|
} /* for */
|
||||||
if (!found) {
|
if (!found) {
|
||||||
for (j = 0; j < provided->numversions; j++) {
|
for (j = 0; j < provided->numproviders; j++) {
|
||||||
snprintf(warning, PATH_MAX, "%s = %s fails to provide %s ",
|
if (!checkVersionWithFlags(
|
||||||
|
currheader->require[i]->version,
|
||||||
|
currheader->require[i]->flags,
|
||||||
|
provided->version[j])) {
|
||||||
|
snprintf(warning, PATH_MAX, "%s = %s from %s(%s,%s) fails to provide %s ",
|
||||||
provided->name,
|
provided->name,
|
||||||
provided->version[j],
|
provided->version[j],
|
||||||
|
provided->provider[j]->name,
|
||||||
|
provided->provider[j]->arch,
|
||||||
|
ct->repository[provided->provider[j]->altrepository]->tag,
|
||||||
provided->name);
|
provided->name);
|
||||||
if (currheader->require[i]->flags & RPMSENSE_LESS) snprintf(&warning[strlen(warning)], PATH_MAX,"<");
|
if (currheader->require[i]->flags & RPMSENSE_LESS) snprintf(&warning[strlen(warning)], PATH_MAX,"<");
|
||||||
if (currheader->require[i]->flags & RPMSENSE_GREATER) snprintf(&warning[strlen(warning)], PATH_MAX, ">");
|
if (currheader->require[i]->flags & RPMSENSE_GREATER) snprintf(&warning[strlen(warning)], PATH_MAX, ">");
|
||||||
if (currheader->require[i]->flags & RPMSENSE_EQUAL) snprintf(&warning[strlen(warning)], PATH_MAX, "=");
|
if (currheader->require[i]->flags & RPMSENSE_EQUAL) snprintf(&warning[strlen(warning)], PATH_MAX, "=");
|
||||||
snprintf(&warning[strlen(warning)], PATH_MAX, " %s to %s(%s,%s)",
|
snprintf(&warning[strlen(warning)], PATH_MAX, " %s to %s(%s,%s)",
|
||||||
currheader->require[i]->version,
|
currheader->require[i]->version,
|
||||||
currheader->name,
|
currheader->name,
|
||||||
currheader->arch,
|
currheader->arch,
|
||||||
ct->repository[currheader->altrepository]->tag);
|
ct->repository[currheader->altrepository]->tag);
|
||||||
|
|
||||||
for (k = 0; k < provided->numproviders; k++) {
|
for (k = 0; k < provided->numproviders; k++) {
|
||||||
if (provided->provider[k]->sourceheader &&
|
if (provided->provider[k]->sourceheader &&
|
||||||
(provided->provider[k]->altrepository == ct->repository_level)) {
|
(provided->provider[k]->altrepository == ct->repository_level)) {
|
||||||
fprintf(stderr,"Warning: %s\n", warning);
|
fprintf(stderr,"Warning: %s\n", warning);
|
||||||
addWarning(provided->provider[k]->sourceheader, warning);
|
addWarning(provided->provider[k]->sourceheader, warning);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +764,7 @@ resolveFirstLevelSourceDependencies(struct configTag *ct, int archidx)
|
|||||||
if (strcmp(currsourceheader->require[i]->version,"") &&
|
if (strcmp(currsourceheader->require[i]->version,"") &&
|
||||||
(currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) {
|
(currsourceheader->require[i]->flags & (RPMSENSE_LESS+RPMSENSE_GREATER+RPMSENSE_EQUAL))) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (j = 0; j < provided->numversions; j++) {
|
for (j = 0; j < provided->numproviders; j++) {
|
||||||
if (!strcmp(provided->version[j],"")) {
|
if (!strcmp(provided->version[j],"")) {
|
||||||
/* provider with no version; assume ok */
|
/* provider with no version; assume ok */
|
||||||
found = 1;
|
found = 1;
|
||||||
|
@ -456,7 +456,6 @@ findOrCreateProvidedListEntry(struct providedList* *idx,
|
|||||||
newprovided->provider = NULL;
|
newprovided->provider = NULL;
|
||||||
newprovided->numproviders = 0;
|
newprovided->numproviders = 0;
|
||||||
newprovided->numbuildproviders = 0;
|
newprovided->numbuildproviders = 0;
|
||||||
newprovided->numversions = 0;
|
|
||||||
newprovided->buildprovider = NULL;
|
newprovided->buildprovider = NULL;
|
||||||
newprovided->name = strdup(findname);
|
newprovided->name = strdup(findname);
|
||||||
newprovided->id = ++providedListId;
|
newprovided->id = ++providedListId;
|
||||||
@ -1003,7 +1002,6 @@ addToHeaderList(struct configTag *ct,
|
|||||||
provided->numproviders++;
|
provided->numproviders++;
|
||||||
provided->provider=malloc(sizeof(struct headerList*));
|
provided->provider=malloc(sizeof(struct headerList*));
|
||||||
provided->provider[0]=newheaderlist;
|
provided->provider[0]=newheaderlist;
|
||||||
provided->numversions++;
|
|
||||||
provided->version=malloc(sizeof(char *));
|
provided->version=malloc(sizeof(char *));
|
||||||
provided->version[0]=strdup(provideversion[i]);
|
provided->version[0]=strdup(provideversion[i]);
|
||||||
} else if (provided && (provided->numproviders > 0)) {
|
} else if (provided && (provided->numproviders > 0)) {
|
||||||
@ -1016,21 +1014,14 @@ addToHeaderList(struct configTag *ct,
|
|||||||
free(provided->provider);
|
free(provided->provider);
|
||||||
provided->provider=newprovider;
|
provided->provider=newprovider;
|
||||||
|
|
||||||
// check if version is already provided
|
newversion=malloc(sizeof(char *)*provided->numproviders);
|
||||||
for (j = 0; j < provided->numversions; j++) {
|
for (j = 0; j < provided->numproviders-1; j++) {
|
||||||
if (!strcmp(provided->version[j],provideversion[i])) break;
|
newversion[j]=provided->version[j];
|
||||||
}
|
|
||||||
// if not add to the list of versions
|
|
||||||
if (j == provided->numversions) {
|
|
||||||
provided->numversions++;
|
|
||||||
newversion=malloc(sizeof(char *)*provided->numversions);
|
|
||||||
for (j = 0; j < provided->numversions-1; j++) {
|
|
||||||
newversion[j]=provided->version[j];
|
|
||||||
}
|
|
||||||
newversion[provided->numversions-1] = strdup(provideversion[i]);
|
|
||||||
free(provided->version);
|
|
||||||
provided->version=newversion;
|
|
||||||
}
|
}
|
||||||
|
newversion[provided->numproviders-1] = strdup(provideversion[i]);
|
||||||
|
free(provided->version);
|
||||||
|
provided->version=newversion;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"%s has %d providers but is ignored\n",provided->name,provided->numproviders);
|
fprintf(stderr,"%s has %d providers but is ignored\n",provided->name,provided->numproviders);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ struct providedList {
|
|||||||
struct headerList **provider;
|
struct headerList **provider;
|
||||||
int numbuildproviders;
|
int numbuildproviders;
|
||||||
struct headerList **buildprovider;
|
struct headerList **buildprovider;
|
||||||
int numversions;
|
|
||||||
char **version;
|
char **version;
|
||||||
int buildpriority;
|
int buildpriority;
|
||||||
struct providedList *next;
|
struct providedList *next;
|
||||||
|
Loading…
Reference in New Issue
Block a user