From 7d1ea0b814723d6a422c5569df19513c40bf99fe Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Sat, 2 Apr 2016 16:05:55 +1000
Subject: Handle provides with -Q

It is useful to be able to use "pacman -Qi" on any dependency, even if that
dependency is a provide.  For example, on Arch Linux systems, "sh" is provided
by the "bash" package, and many packages depend on "sh". Querying the
package that provides the "sh" dependency currently requires first searching
for "sh".

This patch allows the use of "pacman -Qi" on a provide.

Fixes FS#20650.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
 src/pacman/query.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/pacman')

diff --git a/src/pacman/query.c b/src/pacman/query.c
index 1d102a9e..34d7fcbe 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -468,6 +468,9 @@ int pacman_query(alpm_list_t *targets)
 			}
 		} else {
 			pkg = alpm_db_get_pkg(db_local, strname);
+			if(pkg == NULL) {
+				pkg = alpm_find_satisfier(alpm_db_get_pkgcache(db_local), strname);
+			}
 
 			if(pkg == NULL) {
 				pm_printf(ALPM_LOG_ERROR,
-- 
cgit v1.2.3-70-g09d2