From 91291d5aec3284f8768226c3c7c57be0de0145b2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 16 Feb 2009 22:48:18 +0100 Subject: [PATCH] Improve informative messages when installing binpkgs. This now looks like: $ xbps-bin -r /raid/random/xbps/test install initramfs-tools Installing dependency xbps-base-dirs: found xbps-base-dirs-0.2 ... done. Installing dependency glibc: found glibc-2.9 ... done. Installing dependency e2fsprogs: found e2fsprogs-1.41.3 ... done. Installing dependency zlib: found zlib-1.2.3 ... done. Installing dependency gawk: found gawk-3.1.6 ... done. Installing dependency findutils: found findutils-4.4.0 ... done. Installing dependency sed: found sed-4.1.5 ... done. Installing dependency grep: found grep-2.5.3 ... done. Installing dependency gzip: found gzip-1.3.12 ... done. Installing dependency cpio: found cpio-2.9 ... done. ... ... Installing initramfs-tools-0.92o ... done. Package initramfs-tools installed successfully. $ --HG-- extra : convert_revision : 79df585206c9ddc7f1267bc89bfd431ab572e527 --- lib/install.c | 13 ++++++++++++- lib/unpack.c | 19 +------------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/install.c b/lib/install.c index a38580a1a10..a2eb3ab7aa7 100644 --- a/lib/install.c +++ b/lib/install.c @@ -57,8 +57,14 @@ xbps_install_binary_pkg_fini(prop_dictionary_t repo, prop_dictionary_t pkg, assert(version != NULL); assert(desc != NULL); - if (repo == false) + if (repo == false) { automatic = true; + printf("Installing dependency %s: found %s-%s ... ", + pkgname, pkgname, version); + } else { + printf("Installing %s-%s ... ", pkgname, version); + } + (void)fflush(stdout); rv = xbps_unpack_binary_pkg(repo, pkg, destdir, NULL); if (rv == 0) { @@ -67,6 +73,11 @@ xbps_install_binary_pkg_fini(prop_dictionary_t repo, prop_dictionary_t pkg, rv = 0; } + if (rv == 0) + printf("done.\n"); + else + printf("failed!\n"); + return rv; } diff --git a/lib/unpack.c b/lib/unpack.c index bd407eba662..459dd164e21 100644 --- a/lib/unpack.c +++ b/lib/unpack.c @@ -38,19 +38,6 @@ static int unpack_archive_init(prop_dictionary_t, const char *, const char *); static int unpack_archive_fini(struct archive *, const char *, prop_dictionary_t); -static void unpack_defcb_print(prop_dictionary_t); - -static void -unpack_defcb_print(prop_dictionary_t pkg) -{ - const char *pkgname, *version; - assert(pkg != NULL); - - prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); - prop_dictionary_get_cstring_nocopy(pkg, "version", &version); - - printf(" Unpacking %s-%s...\n", pkgname, version); -} int xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg, @@ -85,9 +72,7 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg, } free(path); - if (!cb_print) - unpack_defcb_print(pkg); - else + if (cb_print) (*cb_print)(pkg); rv = unpack_archive_init(pkg, destdir, binfile); @@ -205,9 +190,7 @@ unpack_archive_fini(struct archive *ar, const char *destdir, rv = stat(path, &st); if (rv == 0) { - rv = EEXIST; free(path); - printf(" Not overwriting %s\n", archive_entry_pathname(entry)); continue; } free(path);