backend-sqlite3: remove unresolved requires warning for obsoleted packages; fix needrebuild table

This commit is contained in:
Silvan Calarco 2024-07-13 15:01:43 +02:00
parent 112fec200e
commit 03cdeccccf

View File

@ -349,14 +349,20 @@ long generateSQLite_add_needrebuild(sqlite3 *db, struct rebuildList* firstRebuil
long lastrebuildid = 0;
while (rebuild) {
snprintf(sqlite3_query, PATH_MAX, "INSERT INTO needrebuild VALUES(NULL,%ld,%ld,%ld);",
id_source,
rebuild->sourceheader->id,
rebuild->provider->id);
snprintf(sqlite3_query, PATH_MAX, "INSERT INTO needrebuild VALUES(NULL,%ld,?,?);",
id_source);
if (sqlite3_prepare_v2(db, sqlite3_query, -1, &stmt, NULL)) {
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
}
sqlite3_bind_text(stmt, 1, rebuild->sourceheader->name, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, rebuild->provider->arch, -1, SQLITE_STATIC);
if (sqlite3_step(stmt) != SQLITE_DONE) {
fprintf(stderr, "ERROR: SQLite: (%s) %s\n", sqlite3_query, sqlite3_errmsg(db));
return 3;
}
rebuild->id = sqlite3_last_insert_rowid(db);
lastrebuildid = rebuild->id;
sqlite3_finalize(stmt);
@ -474,7 +480,7 @@ generateSQLite_packages(struct configTag *ct, sqlite3 *db, int arch) {
return 3;
}
sqlite3_finalize(stmt);
} else if (strstr(currpackage->require[i]->name,"rpmlib(") != currpackage->require[i]->name) {
} else if (currpackage->obsoleted == 0 && strstr(currpackage->require[i]->name,"rpmlib(") != currpackage->require[i]->name) {
fprintf(stderr, "WARNING: package %s requires %s not in provided list\n", currpackage->name, currpackage->require[i]->name);
}
}
@ -500,7 +506,7 @@ generateSQLite_packages(struct configTag *ct, sqlite3 *db, int arch) {
#define SQLITE_TABLE_warnings "id INTEGER PRIMARY KEY, "\
"repository STRING, arch STRING, name STRING, text STRING"
#define SQLITE_TABLE_needrebuild "id INTEGER PRIMARY KEY, "\
"id_source INTEGER, id_source_rebuild INTEGER, id_provider INTEGER"
"id_source INTEGER, name STRING, arch STRING"
int
generateSQLite_sources(struct configTag *ct, sqlite3 *db) {
@ -629,15 +635,16 @@ generateSQLite_sources(struct configTag *ct, sqlite3 *db) {
if (currsource->changelog) {
generateSQLite_add_changelog(db, currsource->changelog, currsource->id);
}
if (currsource->firstrebuild) {
generateSQLite_add_needrebuild(db, currsource->firstrebuild, currsource->id);
}
}
if (currsource->firstwarning) {
generateSQLite_add_warnings(db, currsource->firstwarning, ct->repository[currsource->altrepository]->tag);
}
if (currsource->firstrebuild) {
generateSQLite_add_needrebuild(db, currsource->firstrebuild, currsource->id);
}
currsource = currsource->next;
}
SQLite_commit_transaction(db);