Commit 30965aa8 authored by Timo Teräs's avatar Timo Teräs

solver: print repository tag when committing package changes

parent f1de353b
......@@ -167,6 +167,7 @@ typedef union apk_database_or_void {
struct apk_name *apk_db_get_name(struct apk_database *db, apk_blob_t name);
struct apk_name *apk_db_query_name(struct apk_database *db, apk_blob_t name);
int apk_db_get_tag_id(struct apk_database *db, apk_blob_t tag);
int apk_db_get_tag_id_by_repos(struct apk_database *db, unsigned int repos);
struct apk_db_dir *apk_db_dir_query(struct apk_database *db,
apk_blob_t name);
struct apk_db_file *apk_db_file_query(struct apk_database *db,
......
......@@ -1475,6 +1475,17 @@ int apk_db_get_tag_id(struct apk_database *db, apk_blob_t tag)
return -1;
}
int apk_db_get_tag_id_by_repos(struct apk_database *db, unsigned int repos)
{
int i;
for (i = 0; i < db->num_repo_tags; i++) {
if (db->repo_tags[i].allowed_repos & repos)
return i;
}
return -1;
}
static int fire_triggers(apk_hash_item item, void *ctx)
{
struct apk_database *db = (struct apk_database *) ctx;
......
......@@ -1061,24 +1061,37 @@ static void print_change(struct apk_database *db,
struct apk_package *oldpkg = change->oldpkg;
struct apk_package *newpkg = change->newpkg;
const char *msg = NULL;
char status[64];
int r;
char status[32], n[512], *nameptr;
int r, tag;
snprintf(status, sizeof(status), "(%i/%i)", cur+1, total);
status[sizeof(status) - 1] = '\0';
status[sizeof(status) - 1] = 0;
if (oldpkg != NULL)
name = oldpkg->name;
else
if (newpkg != NULL) {
name = newpkg->name;
tag = apk_db_get_tag_id_by_repos(db, newpkg->repos);
} else {
name = oldpkg->name;
tag = apk_db_get_tag_id_by_repos(db, oldpkg->repos);
}
if (tag > 0) {
snprintf(n, sizeof(n), "%s@" BLOB_FMT,
name->name,
BLOB_PRINTF(*db->repo_tags[tag].name));
n[sizeof(n) - 1] = 0;
nameptr = n;
} else {
nameptr = name->name;
}
if (oldpkg == NULL) {
apk_message("%s Installing %s (" BLOB_FMT ")",
status, name->name,
status, nameptr,
BLOB_PRINTF(*newpkg->version));
} else if (newpkg == NULL) {
apk_message("%s Purging %s (" BLOB_FMT ")",
status, name->name,
status, nameptr,
BLOB_PRINTF(*oldpkg->version));
} else {
r = apk_pkg_version_compare(newpkg, oldpkg);
......@@ -1097,7 +1110,7 @@ static void print_change(struct apk_database *db,
break;
}
apk_message("%s %s %s (" BLOB_FMT " -> " BLOB_FMT ")",
status, msg, name->name,
status, msg, nameptr,
BLOB_PRINTF(*oldpkg->version),
BLOB_PRINTF(*newpkg->version));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment