[pacman-dev] [PATCH 2/2] Print warning on removal of indirect optdepend

Chirantan Ekbote chirantan.ekbote at gmail.com
Fri Dec 20 14:10:20 EST 2013


Print a warning when a package that satisfies an optional dependency
for another package through its provides array is removed.

Fixes FS#37669

Signed-off-by: Chirantan Ekbote <chirantan.ekbote at gmail.com>
---
This is the simplest solution, although the downside is that the
warning prints the name of the optdepend rather than the name of the
package being removed.

An alternative solution would be to modify the signature of the event
so that the second parameter is an alpm_pkg_t rather than an
alpm_depend_t.

The best solution would be one where the warning prints the optdepend
as well as the package that satisfies it.  Something like:

:: coffee optionally requires sugar (provided by brown-sugar-1.0-1)

but I don't see a good way of doing this without adding a third
parameter to all events...

 lib/libalpm/remove.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 9417a61..b3d1f1d 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -178,7 +178,7 @@ static void remove_notify_needed_optdepends(alpm_handle_t *handle, alpm_list_t *
 			alpm_list_t *j;
 			for(j = optdeps; j; j = alpm_list_next(j)) {
 				alpm_depend_t *optdep = j->data;
-				if(alpm_pkg_find(lp, optdep->name)) {
+				if(alpm_find_satisfier(lp, optdep->name)) {
 					EVENT(handle, ALPM_EVENT_OPTDEP_REQUIRED, pkg, optdep);
 				}
 			}
-- 
1.8.5.1



More information about the pacman-dev mailing list