xbps-remove: fix #95 (xbps-remove -R pkg lists/removes orphans)

This commit is contained in:
Juan RP 2015-05-06 17:21:13 +02:00
parent ee5e2681bb
commit c5d6556c50
3 changed files with 10 additions and 3 deletions

6
NEWS
View File

@ -1,5 +1,11 @@
xbps-0.45 (???): xbps-0.45 (???):
* xbps-remove(8): fixed regression while removing recursively packages, don't remove
all package orphans, this task belongs to -o not -R.
This closes #95 (xbps-remove -R pkg lists/removes orphans):
https://github.com/voidlinux/xbps/issues/95
* xbps-uunshare(8): replaced -D, -H and -S with -b src:dest. This bind mounts * xbps-uunshare(8): replaced -D, -H and -S with -b src:dest. This bind mounts
src into dir/dest and allows unlimited mounts. src into dir/dest and allows unlimited mounts.

View File

@ -85,6 +85,9 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user _unused
continue; continue;
xbps_array_add(array, pkgd); xbps_array_add(array, pkgd);
} }
if (orphans_user)
goto add_orphans;
iter = xbps_dictionary_iterator(xhp->pkgdb); iter = xbps_dictionary_iterator(xhp->pkgdb);
assert(iter); assert(iter);
/* /*
@ -113,6 +116,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user _unused
} }
xbps_object_iterator_release(iter); xbps_object_iterator_release(iter);
add_orphans:
for (i = 0; i < xbps_array_count(array); i++) { for (i = 0; i < xbps_array_count(array); i++) {
pkgd = xbps_array_get(array, i); pkgd = xbps_array_get(array, i);
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &curpkgver); xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &curpkgver);

View File

@ -28,11 +28,8 @@
static const char expected_output[] = static const char expected_output[] =
"xbps-git-20130310_2\n" "xbps-git-20130310_2\n"
"unexistent-pkg-0_1\n"
"xbps-triggers-1.0_1\n" "xbps-triggers-1.0_1\n"
"libxbps-git-20130310_2\n" "libxbps-git-20130310_2\n"
"orphan1-0_1\n"
"orphan0-0_1\n"
"confuse-2.7_2\n" "confuse-2.7_2\n"
"proplib-0.6.3_1\n" "proplib-0.6.3_1\n"
"libarchive-3.1.2_1\n" "libarchive-3.1.2_1\n"