From: Jo-Philipp Wich Date: Tue, 15 Jan 2019 07:46:15 +0000 (+0100) Subject: libopkg: consider provided packages in pkg_vec_mark_if_matches() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=34571bad205b44dc153a84b32e170e2726cd05d0;p=project%2Fopkg-lede.git libopkg: consider provided packages in pkg_vec_mark_if_matches() Also consider the list of provided abstract packages when testing the package vector for name matches. This fixes the "opkg whatdepends" command with abstract provided package arguments. Signed-off-by: Jo-Philipp Wich --- diff --git a/libopkg/pkg_vec.c b/libopkg/pkg_vec.c index ce098bc..a9e2e73 100644 --- a/libopkg/pkg_vec.c +++ b/libopkg/pkg_vec.c @@ -140,12 +140,24 @@ int pkg_vec_mark_if_matches(pkg_vec_t * vec, const char *pattern) pkg_t **pkgs = vec->pkgs; int npkgs = vec->len; int i; + abstract_pkg_t **providers, *provider; + for (i = 0; i < npkgs; i++) { pkg_t *pkg = pkgs[i]; if (fnmatch(pattern, pkg->name, 0) == 0) { pkg->state_flag |= SF_MARKED; matching_count++; } + else { + providers = pkg_get_ptr(pkg, PKG_PROVIDES); + while (providers && *providers) { + provider = *providers++; + if (fnmatch(pattern, provider->name, 0) == 0) { + pkg->state_flag |= SF_MARKED; + matching_count++; + } + } + } } return matching_count; }