xbps_repository_pool_dictionary_metadata_plist: make it accept a pkgpattern.

This commit is contained in:
Juan RP 2012-02-16 08:55:07 +01:00
parent a5c0513686
commit 6e50919d2b
2 changed files with 16 additions and 15 deletions

View File

@ -56,7 +56,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120214"
#define XBPS_API_VERSION "20120214-1"
#define XBPS_VERSION "0.12"
/**
@ -1524,16 +1524,14 @@ prop_dictionary_t
/**
* Iterate over the the repository pool and search for a metadata plist
* file in a binary package named 'pkgname'. If a package is matched by
* \a pkgname, the plist file \a plistf will be internalized into a
* proplib dictionary.
* file in a binary package matching `pattern'. If a package is matched
* the plist file \a plistf will be internalized into a proplib dictionary.
*
* The first repository that has it wins and the loop is stopped.
* This will work locally and remotely, thanks to libarchive and
* libfetch!
* When \a pattern is a pkgname, the newest package available in repositories
* will be used. Otherwise the first repository matching \a pattern.
*
* @param[in] pkgname Package name to match.
* @param[in] plistf Plist file name to match.
* @param[in] pattern Package name or package pattern to match, i.e `foo>=1.0'.
* @param[in] plistf Plist file name to match, i.e XBPS_PKGPROPS or XBPS_PKGFILES.
*
* @return An internalized proplib dictionary of \a plistf, otherwise NULL
* and errno is set appropiately.
@ -1543,7 +1541,7 @@ prop_dictionary_t
* be found.
*/
prop_dictionary_t
xbps_repository_pool_dictionary_metadata_plist(const char *pkgname,
xbps_repository_pool_dictionary_metadata_plist(const char *pattern,
const char *plistf);
/*@}*/

View File

@ -282,26 +282,29 @@ xbps_repository_pool_find_pkg_exact(const char *pkgver)
}
prop_dictionary_t
xbps_repository_pool_dictionary_metadata_plist(const char *pkgname,
xbps_repository_pool_dictionary_metadata_plist(const char *pattern,
const char *plistf)
{
prop_dictionary_t pkgd = NULL, plistd = NULL;
const char *repoloc;
char *url;
assert(pkgname != NULL);
assert(pattern != NULL);
assert(plistf != NULL);
/*
* Iterate over the the repository pool and search for a plist file
* in the binary package named 'pkgname'. The plist file will be
* in the binary package matching `pattern'. The plist file will be
* internalized to a proplib dictionary.
*
* The first repository that has it wins and the loop is stopped.
* This will work locally and remotely, thanks to libarchive and
* libfetch!
*/
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
if (xbps_pkgpattern_version(pattern))
pkgd = xbps_repository_pool_find_pkg(pattern, true, false);
else
pkgd = xbps_repository_pool_find_pkg(pattern, false, true);
if (pkgd == NULL)
goto out;