diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-01-12 11:33:04 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-01-12 11:33:04 +0200 |
commit | 30965aa86735f7d2dcd544bae0b788195c51f336 (patch) | |
tree | 028bb08c90f425796dbb5dbf1cfb89bf1a0214d0 /src/solver.c | |
parent | f1de353b8162b6f41c36c01fd54599d446203a68 (diff) | |
download | apk-tools-30965aa86735f7d2dcd544bae0b788195c51f336.tar.gz apk-tools-30965aa86735f7d2dcd544bae0b788195c51f336.tar.bz2 apk-tools-30965aa86735f7d2dcd544bae0b788195c51f336.tar.xz apk-tools-30965aa86735f7d2dcd544bae0b788195c51f336.zip |
solver: print repository tag when committing package changes
Diffstat (limited to 'src/solver.c')
-rw-r--r-- | src/solver.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/solver.c b/src/solver.c index 1ebadcc..074df6b 100644 --- a/src/solver.c +++ b/src/solver.c @@ -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)); } |