xbps-install(1): implement #109.

-n/--dry-run mode now prints "installed_size" obj as 5th argument,
and "filename-size" as 6th argument (if available).

Close #109
This commit is contained in:
Juan RP 2015-10-19 19:02:26 +02:00
parent 99bf58b091
commit 24af8cde9b
4 changed files with 22 additions and 4 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.48 (???):
* xbps-install(1): -n/--dry-run mode now also prints "installed_size" and
"filename-size" objects as 5th and 6th argument, respectively.
This implements #109 (https://github.com/voidlinux/xbps/issues/109).
* libxbps: fixed another issue when replacing an existing pkg with a virtual
pkg, and there's an update for the original pkg in the transaction.
Fixes #116 (https://github.com/voidlinux/xbps/issues/116).

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009-2014 Juan Romero Pardines.
* Copyright (c) 2009-2015 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,8 +52,10 @@ show_actions(xbps_object_iterator_t iter)
{
xbps_object_t obj;
const char *repoloc, *trans, *pkgver, *arch;
uint64_t isize, dsize;
repoloc = trans = pkgver = arch = NULL;
isize = dsize = 0;
while ((obj = xbps_object_iterator_next(iter)) != NULL) {
xbps_dictionary_get_cstring_nocopy(obj, "transaction", &trans);
@ -63,6 +65,12 @@ show_actions(xbps_object_iterator_t iter)
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
if (repoloc && arch)
printf(" %s %s", arch, repoloc);
xbps_dictionary_get_uint64(obj, "installed_size", &isize);
xbps_dictionary_get_uint64(obj, "filename-size", &dsize);
if (isize)
printf(" %ju", isize);
if (dsize)
printf(" %ju", dsize);
printf("\n");
}

View File

@ -439,7 +439,9 @@ update_xbps_body() {
xbps-rindex -d -a repo/*.xbps
atf_check_equal $? 0
out=$(xbps-install -r root --repository=repo -yun)
atf_check_equal "$out" "xbps-1.1_1 update noarch $(readlink -f repo)"
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "xbps-1.1_1 update noarch $(readlink -f repo)"
}
atf_test_case update_xbps_virtual
@ -476,7 +478,9 @@ update_xbps_virtual_body() {
xbps-rindex -d -a repo/*.xbps
atf_check_equal $? 0
out=$(xbps-install -r root --repository=repo -yun)
atf_check_equal "$out" "xbps-git-1.1_1 update noarch $(readlink -f repo)"
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "xbps-git-1.1_1 update noarch $(readlink -f repo)"
}
atf_init_test_cases() {

View File

@ -27,7 +27,9 @@ update_hold_body() {
atf_check_equal $? 0
cd ..
out=$(xbps-install -r root --repository=$PWD/repo -un)
atf_check_equal "$out" "A-1.1_1 hold noarch $PWD/repo"
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "A-1.1_1 hold noarch $PWD/repo"
xbps-install -r root --repository=$PWD/repo -yuvd
atf_check_equal $? 0
out=$(xbps-query -r root -p pkgver A)