API break: simplify xbps_repository_pool_find_virtualpkg().
This commit is contained in:
parent
454e164116
commit
dfc7ff4232
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -49,7 +49,7 @@ show_pkg_info_from_repolist(const char *pkgname, const char *option)
|
|||||||
{
|
{
|
||||||
prop_dictionary_t pkgd;
|
prop_dictionary_t pkgd;
|
||||||
|
|
||||||
pkgd = xbps_repository_pool_find_virtualpkg(pkgname, false, false);
|
pkgd = xbps_repository_pool_find_virtualpkg(pkgname, false);
|
||||||
if (pkgd == NULL) {
|
if (pkgd == NULL) {
|
||||||
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
||||||
if (pkgd == NULL)
|
if (pkgd == NULL)
|
||||||
@ -72,7 +72,7 @@ show_pkg_deps_from_repolist(const char *pkgname)
|
|||||||
prop_dictionary_t pkgd;
|
prop_dictionary_t pkgd;
|
||||||
const char *ver, *repoloc;
|
const char *ver, *repoloc;
|
||||||
|
|
||||||
pkgd = xbps_repository_pool_find_virtualpkg(pkgname, false, false);
|
pkgd = xbps_repository_pool_find_virtualpkg(pkgname, false);
|
||||||
if (pkgd == NULL) {
|
if (pkgd == NULL) {
|
||||||
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
||||||
if (pkgd == NULL)
|
if (pkgd == NULL)
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX_VERSION "1.3"
|
#define XBPS_PKGINDEX_VERSION "1.3"
|
||||||
|
|
||||||
#define XBPS_API_VERSION "20120117-2"
|
#define XBPS_API_VERSION "20120118"
|
||||||
#define XBPS_VERSION "0.12"
|
#define XBPS_VERSION "0.12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1441,7 +1441,8 @@ int xbps_repository_pool_foreach(
|
|||||||
* account virtual packages set in configuration file.
|
* account virtual packages set in configuration file.
|
||||||
*
|
*
|
||||||
* @param[in] pkg Package pattern or name.
|
* @param[in] pkg Package pattern or name.
|
||||||
* @param[in] bypattern True if \a pkg is a pattern, false if it is a pkgname.
|
* @param[in] bypattern Set it to true if \a pkg is a pkgpattern (foo>=0),
|
||||||
|
* false if it is a pkgname.
|
||||||
* @param[in] best True to find the best version available in repo, false to
|
* @param[in] best True to find the best version available in repo, false to
|
||||||
* fetch the first package found matching its pkgname.
|
* fetch the first package found matching its pkgname.
|
||||||
*
|
*
|
||||||
@ -1469,18 +1470,16 @@ prop_dictionary_t xbps_repository_pool_find_pkg_exact(const char *pkgver);
|
|||||||
* package pattern or a package name. Only virtual packages set in
|
* package pattern or a package name. Only virtual packages set in
|
||||||
* configuration file will be matched.
|
* configuration file will be matched.
|
||||||
*
|
*
|
||||||
* @param[in] pkg Virtual package pattern or name.
|
* @param[in] pkg Virtual package pattern or name to match.
|
||||||
* @param[in] bypattern True if \a pkg is a pattern, false if it is a pkgname.
|
* @param[in] bypattern Set it to true if \a pkg is a pkgpattern (foo>=0),
|
||||||
* @param[in] best True to find the best version available in repo, false to
|
* false if it is a pkgname.
|
||||||
* fetch the first package found matching its pkgname.
|
|
||||||
*
|
*
|
||||||
* @return The package dictionary if found, NULL otherwise.
|
* @return The package dictionary if found, NULL otherwise.
|
||||||
* @note When returned dictionary is no longer needed, you must release it
|
* @note When returned dictionary is no longer needed, you must release it
|
||||||
* with prop_object_release(3).
|
* with prop_object_release(3).
|
||||||
*/
|
*/
|
||||||
prop_dictionary_t
|
prop_dictionary_t
|
||||||
xbps_repository_pool_find_virtualpkg(const char *pkg,
|
xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern);
|
||||||
bool bypattern, bool best);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate over the the repository pool and search for a metadata plist
|
* Iterate over the the repository pool and search for a metadata plist
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2011 Juan Romero Pardines.
|
* Copyright (c) 2008-2012 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -362,7 +362,7 @@ find_repo_deps(prop_dictionary_t transd, /* transaction dictionary */
|
|||||||
* Pass 3: if required dependency is not in repository,
|
* Pass 3: if required dependency is not in repository,
|
||||||
* add pkg into the missing deps array and pass to next one.
|
* add pkg into the missing deps array and pass to next one.
|
||||||
*/
|
*/
|
||||||
curpkgd = xbps_repository_pool_find_virtualpkg(reqpkg, true, false);
|
curpkgd = xbps_repository_pool_find_virtualpkg(reqpkg, true);
|
||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
curpkgd = xbps_repository_pool_find_pkg(reqpkg, true, false);
|
curpkgd = xbps_repository_pool_find_pkg(reqpkg, true, false);
|
||||||
if (curpkgd == NULL) {
|
if (curpkgd == NULL) {
|
||||||
|
@ -234,14 +234,14 @@ repo_find_pkg(const char *pkg, bool bypattern, bool best, bool exact,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prop_dictionary_t
|
prop_dictionary_t
|
||||||
xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern, bool best)
|
xbps_repository_pool_find_virtualpkg(const char *pkg, bool bypattern)
|
||||||
{
|
{
|
||||||
struct repo_pool_fpkg *rpf;
|
struct repo_pool_fpkg *rpf;
|
||||||
prop_dictionary_t pkgd = NULL;
|
prop_dictionary_t pkgd = NULL;
|
||||||
|
|
||||||
assert(pkg != NULL);
|
assert(pkg != NULL);
|
||||||
|
|
||||||
rpf = repo_find_pkg(pkg, bypattern, best, false, true);
|
rpf = repo_find_pkg(pkg, bypattern, false, false, true);
|
||||||
if (prop_object_type(rpf->pkgd) == PROP_TYPE_DICTIONARY)
|
if (prop_object_type(rpf->pkgd) == PROP_TYPE_DICTIONARY)
|
||||||
pkgd = prop_dictionary_copy(rpf->pkgd);
|
pkgd = prop_dictionary_copy(rpf->pkgd);
|
||||||
free(rpf);
|
free(rpf);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
* Copyright (c) 2009-2012 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -92,10 +92,8 @@ transaction_find_pkg(const char *pattern, int action)
|
|||||||
pkg_repod = xbps_repository_pool_find_pkg(pattern,
|
pkg_repod = xbps_repository_pool_find_pkg(pattern,
|
||||||
bypattern, bestpkg);
|
bypattern, bestpkg);
|
||||||
if (pkg_repod == NULL) {
|
if (pkg_repod == NULL) {
|
||||||
if (!bestpkg) {
|
pkg_repod =
|
||||||
pkg_repod = xbps_repository_pool_find_virtualpkg(
|
xbps_repository_pool_find_virtualpkg(pattern, bypattern);
|
||||||
pattern, bypattern, bestpkg);
|
|
||||||
}
|
|
||||||
if (pkg_repod == NULL) {
|
if (pkg_repod == NULL) {
|
||||||
/* not found */
|
/* not found */
|
||||||
rv = errno;
|
rv = errno;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user