32 #include "xbps_api_impl.h"
40 prop_dictionary_t pkgd;
42 const char *bestpkgver;
47 find_virtualpkg_cb(
struct xbps_rindex *rpi,
void *arg,
bool *done)
49 struct rpool_fpkg *rpf = arg;
62 find_pkg_cb(
struct xbps_rindex *rpi,
void *arg,
bool *done)
64 struct rpool_fpkg *rpf = arg;
77 find_best_pkg_cb(
struct xbps_rindex *rpi,
void *arg,
bool *done)
79 struct rpool_fpkg *rpf = arg;
80 prop_dictionary_t pkgd;
81 const char *repopkgver;
87 if (errno && errno != ENOENT)
90 xbps_dbg_printf(rpi->
xhp,
91 "[rpool] Package '%s' not found in repository "
92 "'%s'.\n", rpf->pattern, rpi->
uri);
95 prop_dictionary_get_cstring_nocopy(pkgd,
96 "pkgver", &repopkgver);
97 if (rpf->bestpkgver == NULL) {
98 xbps_dbg_printf(rpi->
xhp,
99 "[rpool] Found best match '%s' (%s).\n",
100 repopkgver, rpi->
uri);
102 prop_dictionary_set_cstring_nocopy(rpf->pkgd,
103 "repository", rpi->
uri);
104 rpf->bestpkgver = repopkgver;
111 if (
xbps_cmpver(repopkgver, rpf->bestpkgver) == 1) {
112 xbps_dbg_printf(rpi->
xhp,
113 "[rpool] Found best match '%s' (%s).\n",
114 repopkgver, rpi->
uri);
116 prop_dictionary_set_cstring_nocopy(rpf->pkgd,
117 "repository", rpi->
uri);
118 rpf->bestpkgver = repopkgver;
129 static prop_dictionary_t
132 pkg_repo_type_t type)
134 struct rpool_fpkg rpf;
139 rpf.bestpkgver = NULL;
175 return repo_find_pkg(xhp, pkg, VIRTUAL_PKG);
185 return repo_find_pkg(xhp, pkg, BEST_PKG);
187 return repo_find_pkg(xhp, pkg, REAL_PKG);
195 prop_dictionary_t pkgd = NULL, plistd = NULL;
199 assert(plistf != NULL);
213 url = xbps_repository_pkg_path(xhp, pkgd);