From 00513823dc9e15c4de12c02f8faa4dd72ca4ee4e Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Mon, 17 Jun 2013 10:46:38 +0200 Subject: Make --unrequired filter packages that are optdep as well Specify it twice to only filter direct dependencies. Signed-off-by: Olivier Brunel Signed-off-by: Allan McRae --- src/pacman/query.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/pacman/query.c') diff --git a/src/pacman/query.c b/src/pacman/query.c index f5862a2d..e88b393b 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -312,11 +312,16 @@ static unsigned short pkg_get_locality(alpm_pkg_t *pkg) return PKG_LOCALITY_FOREIGN; } -static int is_unrequired(alpm_pkg_t *pkg) +static int is_unrequired(alpm_pkg_t *pkg, unsigned short level) { alpm_list_t *requiredby = alpm_pkg_compute_requiredby(pkg); if(requiredby == NULL) { - return 1; + if(level == 1) { + requiredby = alpm_pkg_compute_optionalfor(pkg); + } + if(requiredby == NULL) { + return 1; + } } FREELIST(requiredby); return 0; @@ -339,7 +344,7 @@ static int filter(alpm_pkg_t *pkg) return 0; } /* check if this pkg is unrequired */ - if(config->op_q_unrequired && !is_unrequired(pkg)) { + if(config->op_q_unrequired && !is_unrequired(pkg, config->op_q_unrequired)) { return 0; } /* check if this pkg is outdated */ -- cgit v1.2.3-70-g09d2