Introduce xbps_repo_get_pkg_plist() and use it in xbps-query -R.

This commit is contained in:
Juan RP 2013-06-14 10:22:10 +02:00
parent 2c03e1c9a8
commit 3abe48b68a
3 changed files with 32 additions and 2 deletions

View File

@ -299,7 +299,7 @@ repo_show_pkg_info(struct xbps_handle *xhp,
((ipkgd = xbps_rpool_get_virtualpkg(xhp, pattern)) == NULL))
return errno;
if ((bpkgd = xbps_rpool_get_pkg_plist(xhp, pattern, "./props.plist")) == NULL)
if ((bpkgd = xbps_repo_get_pkg_plist(xhp, ipkgd, "./props.plist")) == NULL)
return errno;
prop_dictionary_set(bpkgd, "filename-sha256",

View File

@ -41,7 +41,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20130614"
#define XBPS_API_VERSION "20130614-1"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@ -1322,6 +1322,20 @@ prop_dictionary_t xbps_repo_get_pkg(struct xbps_repo *repo, const char *pkg);
prop_dictionary_t xbps_repo_get_virtualpkg(struct xbps_repo *repo,
const char *pkg);
/**
* Returns a pkg dictionary of the matching \a plist file from a binary package,
* by looking at its package dictionary (\a pkgd) returned by a repository or rpool.
*
* @param[in] xhp Pointer to the xbps_handle struct.
* @param[in] pkgd Package dictionary returned by xbps_{repo,rpool}_get_xxxpkg().
* @param[in] plist Plist filename to internalize from matching binary package.
*
* @return The pkg dictionary on success, NULL otherwise.
*/
prop_dictionary_t xbps_repo_get_pkg_plist(struct xbps_handle *xhp,
prop_dictionary_t pkgd,
const char *plist);
/**
* Returns a proplib array of strings with reverse dependencies from
* repository \a repo matching the expression \a pkg.

View File

@ -190,6 +190,22 @@ xbps_repo_get_pkg(struct xbps_repo *repo, const char *pkg)
return NULL;
}
prop_dictionary_t
xbps_repo_get_pkg_plist(struct xbps_handle *xhp, prop_dictionary_t pkgd,
const char *plist)
{
prop_dictionary_t bpkgd;
char *url;
url = xbps_repository_pkg_path(xhp, pkgd);
if (url == NULL)
return NULL;
bpkgd = xbps_get_pkg_plist_from_binpkg(url, plist);
free(url);
return bpkgd;
}
static prop_array_t
revdeps_match(struct xbps_repo *repo, prop_dictionary_t tpkgd, const char *str)
{