From 56677044b8d2013b8682236d66a34ed674c33fa8 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 12 Mar 2021 21:25:41 +0100 Subject: [PATCH] headerlist: generateHeaderList (repodata): process upstream packages first to fix following provder checks for updated packages --- src/distromatic.c | 97 +++++++++++++++++++++++------------------------ src/headerlist.c | 1 + 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/src/distromatic.c b/src/distromatic.c index e30614a..af641b8 100644 --- a/src/distromatic.c +++ b/src/distromatic.c @@ -457,16 +457,14 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) continue; } // currheader->require.resolved = malloc(sizeof(struct providedList*)*currheader->requirecount); - 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 */ /* fprintf(stderr,"Warning: skipping unhandled requirement %s for package %s\n", currheader->require[i]->name,currheader->name);*/ currheader->require[i]->resolved=NULL; - } else if (strncmp("rpmlib(",currheader->require[i]->name,7) && - strncmp("debuginfo(build-id)",currheader->require[i]->name,20)) { + } else if (strncmp("rpmlib(",currheader->require[i]->name,7) && + strncmp("debuginfo(build-id)",currheader->require[i]->name,20)) { provided=findOrCreateProvidedListEntry((struct providedList**) &ct->providedlist_idx[archidx], currheader->require[i]->name,1,archidx); if (provided->numproviders == 0) { @@ -589,25 +587,15 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) } } } - } + } if (provided->numproviders > 0) { if (strcmp(currheader->require[i]->version,"") && (currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) { - found = 0; foundprovider = -1; foundupstreamprovider = 0; 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],"")) { /* provider with no version; assume ok */ found += 1; @@ -623,6 +611,15 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) 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 */ if ((found >= 1) && (!foundupstreamprovider) && (currheader->altrepository != 0) && @@ -639,41 +636,41 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx) provided->version[foundprovider]); logmsg(LOG_WARNING,"%s", warning); addWarning(currheader->sourceheader, warning); - } else if (!found) { - for (j = 0; j < provided->numproviders; j++) { - 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->version[j], - provided->provider[j]->name, - provided->provider[j]->arch, - ct->repository[provided->provider[j]->altrepository]->tag, - provided->name); - 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_EQUAL) snprintf(&warning[strlen(warning)], PATH_MAX, "="); - snprintf(&warning[strlen(warning)], PATH_MAX, "%s to %s(%s,%s)", - currheader->require[i]->version, - currheader->name, - currheader->arch, - ct->repository[currheader->altrepository]->tag); - logmsg(LOG_WARNING,"%s", warning); - for (k = 0; k < provided->numproviders; k++) { - if (provided->provider[k]->sourceheader && - (provided->provider[k]->altrepository == ct->repository_level)) { - addWarning(provided->provider[k]->sourceheader, warning); - } - if ((currheader->altrepository == ct->repository_level)) { - addWarning(currheader->sourceheader, warning); - } - } - } + } else if (!found) { + for (j = 0; j < provided->numproviders; j++) { + 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->version[j], + provided->provider[j]->name, + provided->provider[j]->arch, + ct->repository[provided->provider[j]->altrepository]->tag, + provided->name); + 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_EQUAL) snprintf(&warning[strlen(warning)], PATH_MAX, "="); + snprintf(&warning[strlen(warning)], PATH_MAX, "%s to %s(%s,%s)", + currheader->require[i]->version, + currheader->name, + currheader->arch, + ct->repository[currheader->altrepository]->tag); + logmsg(LOG_WARNING,"%s", warning); + for (k = 0; k < provided->numproviders; k++) { + if (provided->provider[k]->sourceheader && + (provided->provider[k]->altrepository == ct->repository_level)) { + addWarning(provided->provider[k]->sourceheader, warning); + } + if ((currheader->altrepository == ct->repository_level)) { + addWarning(currheader->sourceheader, warning); + } + } + } } /* for */ - } - } + } + } } currheader->require[i]->resolved=provided; } else { diff --git a/src/headerlist.c b/src/headerlist.c index 45d1609..c75dbee 100644 --- a/src/headerlist.c +++ b/src/headerlist.c @@ -1554,6 +1554,7 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) { (nextname[0] == '\0' || strcmp(nextname, currnames[i]) >= 0)) { strncpy(nextname, currnames[i], bufsize); altidx = i; + break; } }