xbps-bin: improve def unpack cb to print more meaningful messages.

This commit is contained in:
Juan RP
2012-05-06 16:48:47 +02:00
parent b4f202f89f
commit 5e0b06dc00
5 changed files with 16 additions and 63 deletions

View File

@@ -99,26 +99,3 @@ xbps_set_cb_state(xbps_state_t state,
if (buf != NULL)
free(buf);
}
void HIDDEN
xbps_set_cb_unpack(const char *entry,
int64_t entry_size,
ssize_t entry_extract_count,
ssize_t entry_total_count,
bool entry_is_metadata,
bool entry_is_conf)
{
const struct xbps_handle *xhp = xbps_handle_get();
struct xbps_unpack_cb_data xucd;
if (xhp->unpack_cb == NULL)
return;
xucd.entry = entry;
xucd.entry_size = entry_size;
xucd.entry_extract_count = entry_extract_count;
xucd.entry_total_count = entry_total_count;
xucd.entry_is_metadata = entry_is_metadata;
xucd.entry_is_conf = entry_is_conf;
(*xhp->unpack_cb)(&xucd, xhp->unpack_cb_data);
}

View File

@@ -240,9 +240,9 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
* Prepare unpack callback ops.
*/
if (xucd != NULL) {
xucd->pkgver = pkgver;
xucd->entry = entry_pname;
xucd->entry_size = archive_entry_size(entry);
xucd->entry_is_metadata = false;
xucd->entry_is_conf = false;
}
if (strcmp("./INSTALL", entry_pname) == 0) {
@@ -275,11 +275,6 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
goto out;
}
nmetadata++;
if (xucd != NULL) {
xucd->entry_is_metadata = true;
xucd->entry_extract_count++;
(*xhp->unpack_cb)(xucd, xhp->unpack_cb_data);
}
continue;
} else if (strcmp("./REMOVE", entry_pname) == 0) {
@@ -289,11 +284,6 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
goto out;
nmetadata++;
if (xucd != NULL) {
xucd->entry_is_metadata = true;
xucd->entry_extract_count++;
(*xhp->unpack_cb)(xucd, xhp->unpack_cb_data);
}
continue;
} else if (strcmp("./files.plist", entry_pname) == 0) {
@@ -308,11 +298,6 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
goto out;
}
nmetadata++;
if (xucd != NULL) {
xucd->entry_is_metadata = true;
xucd->entry_extract_count++;
(*xhp->unpack_cb)(xucd, xhp->unpack_cb_data);
}
continue;
} else if (strcmp("./props.plist", entry_pname) == 0) {
@@ -328,11 +313,6 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
goto out;
}
nmetadata++;
if (xucd != NULL) {
xucd->entry_is_metadata = true;
xucd->entry_extract_count++;
(*xhp->unpack_cb)(xucd, xhp->unpack_cb_data);
}
continue;
}
/*
@@ -360,10 +340,10 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar)
}
/*
* Compute total entries in progress data, if set.
* total_entries = metadata + files + conf_files + links.
* total_entries = files + conf_files + links.
*/
if (xucd != NULL) {
xucd->entry_total_count = nmetadata;
xucd->entry_total_count = 0;
array = prop_dictionary_get(filesd, "files");
xucd->entry_total_count +=
(ssize_t)prop_array_count(array);