headerlist: generateHeaderList (repodata): process upstream packages first to fix following provder checks for updated packages

This commit is contained in:
Silvan Calarco 2021-03-12 21:25:41 +01:00
parent 4891e1f7ec
commit 56677044b8
2 changed files with 48 additions and 50 deletions

View File

@ -457,16 +457,14 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
continue; continue;
} }
// currheader->require.resolved = malloc(sizeof(struct providedList*)*currheader->requirecount); // currheader->require.resolved = malloc(sizeof(struct providedList*)*currheader->requirecount);
for (i = 0; i < currheader->requirecount; i++) { for (i = 0; i < currheader->requirecount; i++) {
if (!strncmp("executable(",currheader->require[i]->name,11)) {
if (!strncmp("executable(",currheader->require[i]->name,11)) {
/* dynamic requirement for executable file */ /* dynamic requirement for executable file */
/* fprintf(stderr,"Warning: skipping unhandled requirement %s for package %s\n", /* fprintf(stderr,"Warning: skipping unhandled requirement %s for package %s\n",
currheader->require[i]->name,currheader->name);*/ currheader->require[i]->name,currheader->name);*/
currheader->require[i]->resolved=NULL; currheader->require[i]->resolved=NULL;
} else if (strncmp("rpmlib(",currheader->require[i]->name,7) && } else if (strncmp("rpmlib(",currheader->require[i]->name,7) &&
strncmp("debuginfo(build-id)",currheader->require[i]->name,20)) { strncmp("debuginfo(build-id)",currheader->require[i]->name,20)) {
provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx], provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx],
currheader->require[i]->name,1,archidx); currheader->require[i]->name,1,archidx);
if (provided->numproviders == 0) { if (provided->numproviders == 0) {
@ -589,25 +587,15 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
} }
} }
} }
} }
if (provided->numproviders > 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;
foundprovider = -1; foundprovider = -1;
foundupstreamprovider = 0; foundupstreamprovider = 0;
for (j = 0; j < provided->numproviders; j++) { for (j = 0; j < provided->numproviders; j++) {
/* updated packages: ignore check with upstream package */
if ((foundprovider >= 0) &&
!strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) &&
provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository)
{
found -= 1;
foundupstreamprovider = foundprovider;
foundprovider = -1;
}
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;
@ -623,6 +611,15 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
foundprovider = j; foundprovider = j;
} }
} }
/* updated packages: ignore check with upstream package */
if ((foundprovider >= 0) &&
!strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) &&
provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository)
{
found -= 1;
foundupstreamprovider = foundprovider;
foundprovider = -1;
}
} /* for */ } /* for */
if ((found >= 1) && (!foundupstreamprovider) && if ((found >= 1) && (!foundupstreamprovider) &&
(currheader->altrepository != 0) && (currheader->altrepository != 0) &&
@ -639,41 +636,41 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
provided->version[foundprovider]); provided->version[foundprovider]);
logmsg(LOG_WARNING,"%s", warning); logmsg(LOG_WARNING,"%s", warning);
addWarning(currheader->sourceheader, warning); addWarning(currheader->sourceheader, warning);
} else if (!found) { } else if (!found) {
for (j = 0; j < provided->numproviders; j++) { for (j = 0; j < provided->numproviders; j++) {
if (!checkVersionWithFlags( if (!checkVersionWithFlags(
currheader->require[i]->version, currheader->require[i]->version,
currheader->require[i]->flags, currheader->require[i]->flags,
provided->version[j])) { provided->version[j])) {
snprintf(warning, PATH_MAX, "%s=%s from %s(%s,%s) fails to provide %s", 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]->name,
provided->provider[j]->arch, provided->provider[j]->arch,
ct->repository[provided->provider[j]->altrepository]->tag, 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);
logmsg(LOG_WARNING,"%s", warning); logmsg(LOG_WARNING,"%s", warning);
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)) {
addWarning(provided->provider[k]->sourceheader, warning); addWarning(provided->provider[k]->sourceheader, warning);
} }
if ((currheader->altrepository == ct->repository_level)) { if ((currheader->altrepository == ct->repository_level)) {
addWarning(currheader->sourceheader, warning); addWarning(currheader->sourceheader, warning);
} }
} }
} }
} /* for */ } /* for */
} }
} }
} }
currheader->require[i]->resolved=provided; currheader->require[i]->resolved=provided;
} else { } else {

View File

@ -1554,6 +1554,7 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) {
(nextname[0] == '\0' || strcmp(nextname, currnames[i]) >= 0)) { (nextname[0] == '\0' || strcmp(nextname, currnames[i]) >= 0)) {
strncpy(nextname, currnames[i], bufsize); strncpy(nextname, currnames[i], bufsize);
altidx = i; altidx = i;
break;
} }
} }