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 { ...@@ -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_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); 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(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, struct apk_db_dir *apk_db_dir_query(struct apk_database *db,
apk_blob_t name); apk_blob_t name);
struct apk_db_file *apk_db_file_query(struct apk_database *db, 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) ...@@ -1475,6 +1475,17 @@ int apk_db_get_tag_id(struct apk_database *db, apk_blob_t tag)
return -1; 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) static int fire_triggers(apk_hash_item item, void *ctx)
{ {
struct apk_database *db = (struct apk_database *) ctx; struct apk_database *db = (struct apk_database *) ctx;
......
...@@ -1061,24 +1061,37 @@ static void print_change(struct apk_database *db, ...@@ -1061,24 +1061,37 @@ static void print_change(struct apk_database *db,
struct apk_package *oldpkg = change->oldpkg; struct apk_package *oldpkg = change->oldpkg;
struct apk_package *newpkg = change->newpkg; struct apk_package *newpkg = change->newpkg;
const char *msg = NULL; const char *msg = NULL;
char status[64]; char status[32], n[512], *nameptr;
int r; int r, tag;
snprintf(status, sizeof(status), "(%i/%i)", cur+1, total); snprintf(status, sizeof(status), "(%i/%i)", cur+1, total);
status[sizeof(status) - 1] = '\0'; status[sizeof(status) - 1] = 0;
if (oldpkg != NULL) if (newpkg != NULL) {
name = oldpkg->name;
else
name = newpkg->name; 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) { if (oldpkg == NULL) {
apk_message("%s Installing %s (" BLOB_FMT ")", apk_message("%s Installing %s (" BLOB_FMT ")",
status, name->name, status, nameptr,
BLOB_PRINTF(*newpkg->version)); BLOB_PRINTF(*newpkg->version));
} else if (newpkg == NULL) { } else if (newpkg == NULL) {
apk_message("%s Purging %s (" BLOB_FMT ")", apk_message("%s Purging %s (" BLOB_FMT ")",
status, name->name, status, nameptr,
BLOB_PRINTF(*oldpkg->version)); BLOB_PRINTF(*oldpkg->version));
} else { } else {
r = apk_pkg_version_compare(newpkg, oldpkg); r = apk_pkg_version_compare(newpkg, oldpkg);
...@@ -1097,7 +1110,7 @@ static void print_change(struct apk_database *db, ...@@ -1097,7 +1110,7 @@ static void print_change(struct apk_database *db,
break; break;
} }
apk_message("%s %s %s (" BLOB_FMT " -> " BLOB_FMT ")", apk_message("%s %s %s (" BLOB_FMT " -> " BLOB_FMT ")",
status, msg, name->name, status, msg, nameptr,
BLOB_PRINTF(*oldpkg->version), BLOB_PRINTF(*oldpkg->version),
BLOB_PRINTF(*newpkg->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