handleObsoletedPackages(): fix: prevent upper repositories packages to obsolete packages in current repository; code formatting fixes

This commit is contained in:
Silvan Calarco 2020-06-20 19:12:42 +02:00
parent fac5730549
commit 93936cac50
3 changed files with 134 additions and 136 deletions

View File

@ -1 +1 @@
1.5.0 1.5.0.1

View File

@ -235,13 +235,14 @@ int generateSQLite_provided(struct configTag* ct, sqlite3 *db, int arch) {
provided->flags, provided->flags,
provided->numproviders); provided->numproviders);
if (sqlite3_prepare_v3(db, sqlite3_query, -1, 0, &stmt, NULL)) { if (sqlite3_prepare_v3(db, sqlite3_query, -1, 0, &stmt, NULL)) {
fprintf(stderr, "ERROR: sqlite3_prepare_v2: %s (%s)\n", sqlite3_errmsg(db), sqlite3_query); fprintf(stderr, "ERROR: sqlite3_prepare_v2: %s (%s)\n",
sqlite3_errmsg(db), sqlite3_query);
return 1; return 1;
} }
sqlite3_bind_text(stmt, 1, provided->name, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 1, provided->name, -1, SQLITE_STATIC);
if (sqlite3_step(stmt) != SQLITE_DONE) { if (sqlite3_step(stmt) != SQLITE_DONE) {
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db)); fprintf(stderr, "ERROR: SQLite: (%s %s) %s; ignoring\n", sqlite3_query,
return 3; provided->name, sqlite3_errmsg(db));
} }
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
} }

View File

@ -288,7 +288,9 @@ handleObsoletedPackages(struct configTag *ct, int archidx)
} }
currheader = currheader -> nextbrother; currheader = currheader -> nextbrother;
} }
} else { obs[k]=i;
} else if (prov->provider[i]->altrepository == ct->repository_level) {
// NOTE: don't obsolete if it comes from an upper level repository
prov->provider[k]->obsoleted = 1; prov->provider[k]->obsoleted = 1;
snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s(%s,%s)", snprintf(buf, PATH_MAX, "%s(%s,%s) obsoletes %s(%s,%s)",
prov->provider[i]->name, prov->provider[i]->name,
@ -299,9 +301,9 @@ handleObsoletedPackages(struct configTag *ct, int archidx)
ct->repository[prov->provider[k]->altrepository]->tag); ct->repository[prov->provider[k]->altrepository]->tag);
addWarning(prov->provider[i]->sourceheader, buf); addWarning(prov->provider[i]->sourceheader, buf);
logmsg(LOG_WARNING,"%s", buf); logmsg(LOG_WARNING,"%s", buf);
}
obs[k]=i; obs[k]=i;
} }
}
// now delete found obsoleted providers // now delete found obsoleted providers
j = prov->numproviders; j = prov->numproviders;
@ -325,7 +327,6 @@ handleObsoletedPackages(struct configTag *ct, int archidx)
prov->numproviders = j; prov->numproviders = j;
} }
} }
prov=prov->next; prov=prov->next;
} }
@ -598,7 +599,8 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
/* updated packages: ignore check with upstream package */ /* updated packages: ignore check with upstream package */
if ((foundprovider >= 0) && if ((foundprovider >= 0) &&
!strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) && !strcmp(provided->provider[foundprovider]->name,provided->provider[j]->name) &&
provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository) { provided->provider[foundprovider]->altrepository < provided->provider[j]->altrepository)
{
found -= 1; found -= 1;
foundupstreamprovider = foundprovider; foundupstreamprovider = foundprovider;
foundprovider = -1; foundprovider = -1;
@ -618,9 +620,6 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
foundprovider = j; foundprovider = j;
} }
} }
/*if (!strcmp(provided->name,"pkgconfig(gio-2.0)"))
printf("provided->name=pkgconfig(gio-2.0) found=%d foundprovider=%d foundupstreamprovider=%d provided->version[j]=%s\n",
found, foundprovider, foundupstreamprovider, provided->version[j]);*/
} /* for */ } /* for */
if ((found >= 1) && (!foundupstreamprovider) && if ((found >= 1) && (!foundupstreamprovider) &&
(currheader->altrepository != 0) && (currheader->altrepository != 0) &&
@ -628,8 +627,7 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
(provided->provider[foundprovider]->sourceheader != currheader->sourceheader) && (provided->provider[foundprovider]->sourceheader != currheader->sourceheader) &&
(provided->provider[foundprovider]->altrepository == currheader->altrepository)) { (provided->provider[foundprovider]->altrepository == currheader->altrepository)) {
snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) because it needs %s=%s", snprintf(warning, PATH_MAX, "%s(%s,%s) requires %s(%s,%s) because it needs %s=%s",
currheader->name, currheader->name, currheader->arch,
currheader->arch,
ct->repository[currheader->altrepository]->tag, ct->repository[currheader->altrepository]->tag,
provided->provider[foundprovider]->name, provided->provider[foundprovider]->name,
provided->provider[foundprovider]->arch, provided->provider[foundprovider]->arch,
@ -670,10 +668,9 @@ resolveFirstLevelDependencies(struct configTag *ct, int archidx)
} }
} }
} }
} /* for */
} }
} }
}
} }
currheader->require[i]->resolved=provided; currheader->require[i]->resolved=provided;
} else { } else {