distromatic.c: indentation fixes

This commit is contained in:
Silvan Calarco 2021-03-20 12:21:11 +01:00
parent 04d323e9a7
commit 7d07afc0cc

View File

@ -401,290 +401,290 @@ handleObsoletedPackages(struct configTag *ct, int archidx)
static int 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;
struct fileTree *file; struct fileTree *file;
int i,j,k,found,foundprovider, foundupstreamprovider; int i,j,k,found,foundprovider, foundupstreamprovider;
char warning[PATH_MAX]; char warning[PATH_MAX];
char ** newversion; char ** newversion;
currheader = ct->headerlist[archidx]; currheader = ct->headerlist[archidx];
logmsg(LOG_DEBUG,"resolveFirstLevelDependencies - binaries"); logmsg(LOG_DEBUG,"resolveFirstLevelDependencies - binaries");
while (currheader) { while (currheader) {
scanheader = ct->headerlist[archidx]; scanheader = ct->headerlist[archidx];
currheader->requirelist = NULL; currheader->requirelist = NULL;
if ((!currheader->obsoleted) && (currheader->next) && (currheader->sourceheader->updatingparent)) { if ((!currheader->obsoleted) && (currheader->next) && (currheader->sourceheader->updatingparent)) {
// mark obsoleted any package with same name in upper level repositories // mark obsoleted any package with same name in upper level repositories
if (currheader->altrepository < currheader->sourceheader->updatingparent->altrepository) { if (currheader->altrepository < currheader->sourceheader->updatingparent->altrepository) {
currheader->obsoleted = 1; currheader->obsoleted = 1;
if (checkVersionWithFlags( if (checkVersionWithFlags(
currheader->version, currheader->version,
RPMSENSE_GREATER & RPMSENSE_EQUAL, RPMSENSE_GREATER & RPMSENSE_EQUAL,
currheader->next->version)) { currheader->next->version)) {
snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)", snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)",
currheader->name, currheader->name,
ct->arch[archidx], ct->arch[archidx],
ct->repository[currheader->altrepository]->tag, ct->repository[currheader->altrepository]->tag,
ct->repository[currheader->next->altrepository]->tag, ct->repository[currheader->next->altrepository]->tag,
currheader->version, currheader->version,
currheader->next->version); currheader->next->version);
fprintf(stderr,"Warning: %s\n",warning); fprintf(stderr,"Warning: %s\n",warning);
addWarning(currheader->sourceheader,warning); addWarning(currheader->sourceheader,warning);
} }
} else if (currheader->altrepository >= currheader->sourceheader->updatingparent->altrepository) { } else if (currheader->altrepository >= currheader->sourceheader->updatingparent->altrepository) {
currheader->next->obsoleted = 1; currheader->next->obsoleted = 1;
if (checkVersionWithFlags( if (checkVersionWithFlags(
currheader->version, currheader->version,
RPMSENSE_LESS & RPMSENSE_EQUAL, RPMSENSE_LESS & RPMSENSE_EQUAL,
currheader->next->version)) { currheader->next->version)) {
snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)", snprintf(warning,PATH_MAX,"%s(%s,%s): same or higher version than package with same name in %s (%s >= %s)",
currheader->next->name, currheader->next->name,
ct->arch[archidx], ct->arch[archidx],
ct->repository[currheader->next->altrepository]->tag, ct->repository[currheader->next->altrepository]->tag,
ct->repository[currheader->altrepository]->tag, ct->repository[currheader->altrepository]->tag,
currheader->next->version, currheader->next->version,
currheader->version); currheader->version);
fprintf(stderr,"Warning: %s\n",warning); fprintf(stderr,"Warning: %s\n",warning);
addWarning(currheader->sourceheader,warning); addWarning(currheader->sourceheader,warning);
} }
} }
} }
if (currheader->obsoleted || currheader->sourceheader->updatingparent) { if (currheader->obsoleted || currheader->sourceheader->updatingparent) {
currheader = currheader->next; currheader = currheader->next;
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) {
// check if require[i]->name requirement is met // check if require[i]->name requirement is met
scanheader = ct->headerlist[archidx]; scanheader = ct->headerlist[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, archidx);
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; provided->numbuildproviders=0;
provided->numbuildproviders=0; provided->provider=file->provider;
provided->provider=file->provider; provided->flags=0;
provided->flags=0; } else {
} else { scanheader=NULL;
scanheader=NULL; }
} } else {
} else { /* requirement is not a file, cross-check with provides */
/* requirement is not a file, cross-check with provides */ while (scanheader && !checkRequireWithProvides(
while (scanheader && currheader->require[i]->name, scanheader))
!checkRequireWithProvides( scanheader = scanheader->next;
currheader->require[i]->name, if (scanheader) {
scanheader)) scanheader = scanheader->next; provided->numproviders=1;
if (scanheader) { provided->numbuildproviders=0;
provided->numproviders=1; provided->provider=malloc(sizeof(struct headerList*));
provided->numbuildproviders=0; provided->provider[0]=scanheader;
provided->provider=malloc(sizeof(struct headerList*)); provided->flags=0;
provided->provider[0]=scanheader; }
provided->flags=0; }
} if (!scanheader && incremental_mode) {
} snprintf(warning,PATH_MAX,"%s(%s,%s): missing provider for %s",
if (!scanheader && incremental_mode) { currheader->name,
snprintf(warning,PATH_MAX,"%s(%s,%s): missing provider for %s", ct->arch[archidx],
currheader->name, ct->repository[currheader->altrepository]->tag,
ct->arch[archidx], currheader->require[i]->name);
ct->repository[currheader->altrepository]->tag, fprintf(stderr,"Warning: %s\n",warning);
currheader->require[i]->name); addWarning(currheader->sourceheader,warning);
fprintf(stderr,"Warning: %s\n",warning); }
addWarning(currheader->sourceheader,warning); } else { /* provided->numproviders > 0 */
} /* warn about provides only provided by older packages */
} else { /* provided->numproviders > 0 */ k=0;
/* warn about provides only provided by older packages */ for (j = 0; j < provided->numproviders; j++) {
k=0; if (provided->provider[j]->sourceheader->updatingparent &&
for (j = 0; j < provided->numproviders; j++) { provided->provider[j]->sourceheader->updatingparent->firstchild[archidx] && /* skip if not built for arch */
if (provided->provider[j]->sourceheader->updatingparent && !currheader->obsoleted) k++;
provided->provider[j]->sourceheader->updatingparent->firstchild[archidx] && /* skip if not built for arch */ }
!currheader->obsoleted) k++; if (k == provided->numproviders) { // all provides are from older packages
} snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s which is only provided by older package(s):",
if (k == provided->numproviders) { // all provides are from older packages currheader->name,
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s which is only provided by older package(s):", currheader->arch,
currheader->name, ct->repository[currheader->altrepository]->tag,
currheader->arch, provided->name);
ct->repository[currheader->altrepository]->tag, for (j = 0; j < provided->numproviders; j++) {
provided->name); snprintf(&warning[strlen(warning)], PATH_MAX - strlen(warning), " %s(%s,%s)",
for (j = 0; j < provided->numproviders; j++) { provided->provider[j]->name,
snprintf(&warning[strlen(warning)], PATH_MAX - strlen(warning), " %s(%s,%s)", provided->provider[j]->arch,
provided->provider[j]->name, ct->repository[provided->provider[j]->altrepository]->tag);
provided->provider[j]->arch, addRebuild(provided->provider[j]->sourceheader,currheader->sourceheader,provided->provider[j]);
ct->repository[provided->provider[j]->altrepository]->tag); addWarning(provided->provider[j]->sourceheader,warning);
addRebuild(provided->provider[j]->sourceheader,currheader->sourceheader,provided->provider[j]); }
addWarning(provided->provider[j]->sourceheader,warning); fprintf(stderr,"Warning: %s\n",warning);
} } else {
fprintf(stderr,"Warning: %s\n",warning); /* warn about provides provided by obsoleted packages */
} else { k=0;
/* warn about provides provided by obsoleted packages */ for (j = 0; j < provided->numproviders; j++) {
k=0; if (provided->provider[j]->obsoleted &&
for (j = 0; j < provided->numproviders; j++) { !provided->provider[j]->sourceheader->updatingparent && // don't fall in case above
if (provided->provider[j]->obsoleted && !currheader->obsoleted) k++;
!provided->provider[j]->sourceheader->updatingparent && // don't fall in case above }
!currheader->obsoleted) k++; if (k == provided->numproviders) { // all provides are obsoleted
} snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s which is only provided by obsoleted package(s):",
if (k == provided->numproviders) { // all provides are obsoleted currheader->name,
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s which is only provided by obsoleted package(s):", currheader->arch,
currheader->name, ct->repository[currheader->altrepository]->tag,
currheader->arch, provided->name);
ct->repository[currheader->altrepository]->tag, for (j = 0; j < provided->numproviders; j++) {
provided->name); snprintf(&warning[strlen(warning)], PATH_MAX - strlen(warning), " %s(%s,%s)",
for (j = 0; j < provided->numproviders; j++) { provided->provider[j]->name,
snprintf(&warning[strlen(warning)], PATH_MAX - strlen(warning), " %s(%s,%s)", provided->provider[j]->arch,
provided->provider[j]->name, ct->repository[provided->provider[j]->altrepository]->tag);
provided->provider[j]->arch, }
ct->repository[provided->provider[j]->altrepository]->tag); fprintf(stderr,"Warning: %s\n",warning);
} addWarning(currheader->sourceheader,warning);
fprintf(stderr,"Warning: %s\n",warning); for (j = 0; j < provided->numproviders; j++) {
addWarning(currheader->sourceheader,warning); addWarning(provided->provider[j]->sourceheader,warning);
for (j = 0; j < provided->numproviders; j++) { }
addWarning(provided->provider[j]->sourceheader,warning); }
} }
} if ((currheader->require[i]->name)[0] == '/') {
} /* when there is a Requires: /file/requirement add provide from file tree as well */
if ((currheader->require[i]->name)[0] == '/') { file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name, archidx);
/* when there is a Requires: /file/requirement add provide from file tree as well */ for (k = 0; k < file->numproviders; k++) {
file=findOrCreateFileTreeEntry(&ct->filetree[archidx],currheader->require[i]->name, archidx); for (j = 0, found = 0; j < provided->numproviders; j++) {
for (k = 0; k < file->numproviders; k++) { /* avoid duplicates */
for (j = 0, found = 0; j < provided->numproviders; j++) { if (file->provider[k] == provided->provider[j]) {
/* avoid duplicates */ found = 1;
if (file->provider[k] == provided->provider[j]) { break;
found = 1; }
break; }
} if (! found) {
} //printf("%s also provided by %s\n", currheader->require[i]->name, file->provider[k]->name);
if (! found) { provided->numproviders++;
//printf("%s also provided by %s\n", currheader->require[i]->name, file->provider[k]->name); newprovider=malloc(sizeof(struct headerList*)*provided->numproviders);
provided->numproviders++; for (j = 0; j < provided->numproviders-1; j++) {
newprovider=malloc(sizeof(struct headerList*)*provided->numproviders); newprovider[j]=provided->provider[j];
for (j = 0; j < provided->numproviders-1; j++) { }
newprovider[j]=provided->provider[j]; newprovider[provided->numproviders-1] = file->provider[k];
} if (provided->provider) free(provided->provider);
newprovider[provided->numproviders-1] = file->provider[k]; provided->provider=newprovider;
if (provided->provider) free(provided->provider); newversion=malloc(sizeof(char *)*provided->numproviders);
provided->provider=newprovider; for (j = 0; j < provided->numproviders-1; j++) {
newversion=malloc(sizeof(char *)*provided->numproviders); newversion[j]=provided->version[j];
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);
newversion[provided->numproviders-1] = strdup(provided->provider[j]->version); provided->version=newversion;
if (provided->version) free(provided->version); }
provided->version=newversion; }
} }
} }
} if (provided->numproviders > 0) {
} if (strcmp(currheader->require[i]->version,"") &&
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) {
if (provided->numproviders > 0) { found = 0;
if (strcmp(currheader->require[i]->version,"") && foundprovider = -1;
(currheader->require[i]->flags & (RPMSENSE_LESS|RPMSENSE_GREATER|RPMSENSE_EQUAL))) { foundupstreamprovider = 0;
found = 0; for (j = 0; j < provided->numproviders; j++) {
foundprovider = -1; /* updated packages: ignore check with upstream package */
foundupstreamprovider = 0; if ((foundprovider >= 0) &&
for (j = 0; j < provided->numproviders; j++) { !strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) &&
/* updated packages: ignore check with upstream package */ provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository) {
if ((foundprovider >= 0) && found -= 1;
!strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) && foundupstreamprovider = foundprovider;
provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository) { foundprovider = -1;
found -= 1; }
foundupstreamprovider = foundprovider; if (!strcmp(provided->version[j],"")) {
foundprovider = -1; /* provider with no version; assume ok */
}
if (!strcmp(provided->version[j],"")) {
/* provider with no version; assume ok */
found += 1;
foundupstreamprovider = foundprovider;
foundprovider = j;
} else {
if (checkVersionWithFlags(
currheader->require[i]->version,
currheader->require[i]->flags,
provided->version[j])) {
found += 1; found += 1;
foundupstreamprovider = foundprovider; foundupstreamprovider = foundprovider;
foundprovider = j; foundprovider = j;
} } else {
} if (checkVersionWithFlags(
} /* for */ currheader->require[i]->version,
if ((found >= 1) && (!foundupstreamprovider) && currheader->require[i]->flags,
(currheader->altrepository != 0) && provided->version[j])) {
(currheader->altrepository = ct->repository_level) && found += 1;
(provided->provider[foundprovider]->sourceheader != currheader->sourceheader) && foundupstreamprovider = foundprovider;
(provided->provider[foundprovider]->altrepository == currheader->altrepository)) { foundprovider = j;
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) because it needs %s=%s",
currheader->name, currheader->arch,
ct->repository[currheader->altrepository]->tag,
provided->provider[foundprovider]->name,
provided->provider[foundprovider]->arch,
ct->repository[provided->provider[foundprovider]->altrepository]->tag,
provided->name,
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);
}
} }
} }
} /* for */ } /* for */
if ((found >= 1) && (!foundupstreamprovider) &&
(currheader->altrepository != 0) &&
(currheader->altrepository = ct->repository_level) &&
(provided->provider[foundprovider]->sourceheader != currheader->sourceheader) &&
(provided->provider[foundprovider]->altrepository == currheader->altrepository)) {
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) because it needs %s=%s",
currheader->name, currheader->arch,
ct->repository[currheader->altrepository]->tag,
provided->provider[foundprovider]->name,
provided->provider[foundprovider]->arch,
ct->repository[provided->provider[foundprovider]->altrepository]->tag,
provided->name,
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);
}
}
}
} /* for */
}
} }
} }
} currheader->require[i]->resolved=provided;
currheader->require[i]->resolved=provided; } else {
} else { currheader->require[i]->resolved=NULL;
currheader->require[i]->resolved=NULL; } /* if */
} } /* for currheader->requirecount */
}
// sort required list by first provider's name // sort required list by first provider's name
qsort((void *) &currheader->require[0], qsort((void *) &currheader->require[0],
currheader->requirecount, currheader->requirecount,
sizeof(struct Require *), sizeof(struct Require *),
compareRequiredList); compareRequiredList);
currheader = currheader->next; currheader = currheader->next;
} }
logmsg(LOG_DEBUG,"resolveFirstLevelDependencies - done"); logmsg(LOG_DEBUG,"resolveFirstLevelDependencies - done");
return 0; return 0;
} }
static int static int