2011-02-05 16:36:03 +05:30
|
|
|
/*-
|
2020-04-29 17:42:10 +05:30
|
|
|
* Copyright (c) 2008-2016 Juan Romero Pardines.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2011-02-05 16:36:03 +05:30
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
2013-06-14 13:30:33 +05:30
|
|
|
#include <fcntl.h>
|
|
|
|
#include <dirent.h>
|
2013-06-14 16:01:43 +05:30
|
|
|
#include <pthread.h>
|
2011-02-05 16:36:03 +05:30
|
|
|
|
|
|
|
#include "xbps_api_impl.h"
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
static xbps_dictionary_t
|
2020-02-21 13:38:22 +05:30
|
|
|
get_pkg_in_array(xbps_array_t array, const char *str, xbps_trans_type_t tt, bool virtual)
|
2011-02-05 16:36:03 +05:30
|
|
|
{
|
2020-02-21 13:38:22 +05:30
|
|
|
xbps_object_t obj;
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_object_iterator_t iter;
|
2020-02-21 13:38:22 +05:30
|
|
|
xbps_trans_type_t ttype;
|
2012-11-30 11:41:51 +05:30
|
|
|
bool found = false;
|
2012-06-05 02:52:33 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
assert(array);
|
|
|
|
assert(str);
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
iter = xbps_array_iterator(array);
|
2020-02-21 13:38:22 +05:30
|
|
|
if (!iter)
|
|
|
|
return NULL;
|
2012-11-30 14:19:09 +05:30
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
while ((obj = xbps_object_iterator_next(iter))) {
|
2020-02-24 14:52:52 +05:30
|
|
|
const char *pkgver = NULL;
|
|
|
|
char pkgname[XBPS_NAME_SIZE] = {0};
|
2014-09-14 16:20:17 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
if (!xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver)) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-04-12 15:27:21 +05:30
|
|
|
if (virtual) {
|
|
|
|
/*
|
|
|
|
* Check if package pattern matches
|
|
|
|
* any virtual package version in dictionary.
|
|
|
|
*/
|
2014-04-20 20:24:50 +05:30
|
|
|
found = xbps_match_virtual_pkg_in_dict(obj, str);
|
2012-11-30 11:41:51 +05:30
|
|
|
if (found)
|
2012-04-12 15:27:21 +05:30
|
|
|
break;
|
2012-11-30 11:41:51 +05:30
|
|
|
} else if (xbps_pkgpattern_version(str)) {
|
2013-06-27 19:56:19 +05:30
|
|
|
/* match by pattern against pkgver */
|
2012-11-30 11:41:51 +05:30
|
|
|
if (xbps_pkgpattern_match(pkgver, str)) {
|
|
|
|
found = true;
|
2011-02-05 16:36:03 +05:30
|
|
|
break;
|
2012-11-30 11:41:51 +05:30
|
|
|
}
|
|
|
|
} else if (xbps_pkg_version(str)) {
|
|
|
|
/* match by exact pkgver */
|
|
|
|
if (strcmp(str, pkgver) == 0) {
|
|
|
|
found = true;
|
2011-02-05 16:36:03 +05:30
|
|
|
break;
|
2012-06-05 14:28:39 +05:30
|
|
|
}
|
2012-11-30 11:41:51 +05:30
|
|
|
} else {
|
2020-02-24 14:52:52 +05:30
|
|
|
if (!xbps_pkg_name(pkgname, sizeof(pkgname), pkgver)) {
|
|
|
|
abort();
|
|
|
|
}
|
2012-11-30 11:41:51 +05:30
|
|
|
/* match by pkgname */
|
2020-02-21 13:38:22 +05:30
|
|
|
if (strcmp(pkgname, str) == 0) {
|
2012-11-30 11:41:51 +05:30
|
|
|
found = true;
|
2011-06-04 17:07:53 +05:30
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-02-05 16:36:03 +05:30
|
|
|
}
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_object_iterator_release(iter);
|
2012-11-30 14:19:09 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
ttype = xbps_transaction_pkg_type(obj);
|
|
|
|
if (found && tt && (ttype != tt)) {
|
|
|
|
found = false;
|
2014-09-14 16:20:17 +05:30
|
|
|
}
|
2014-05-17 16:06:02 +05:30
|
|
|
if (!found) {
|
|
|
|
errno = ENOENT;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return obj;
|
2012-01-19 16:56:40 +05:30
|
|
|
}
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t HIDDEN
|
2020-02-21 13:38:22 +05:30
|
|
|
xbps_find_pkg_in_array(xbps_array_t a, const char *s, xbps_trans_type_t tt)
|
2011-02-05 16:36:03 +05:30
|
|
|
{
|
2013-06-20 13:56:12 +05:30
|
|
|
assert(xbps_object_type(a) == XBPS_TYPE_ARRAY);
|
2012-11-30 11:41:51 +05:30
|
|
|
assert(s);
|
2011-07-15 21:52:58 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
return get_pkg_in_array(a, s, tt, false);
|
2011-02-05 16:36:03 +05:30
|
|
|
}
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t HIDDEN
|
2012-11-30 11:41:51 +05:30
|
|
|
xbps_find_virtualpkg_in_array(struct xbps_handle *x,
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_array_t a,
|
2014-09-14 16:20:17 +05:30
|
|
|
const char *s,
|
2020-02-21 13:38:22 +05:30
|
|
|
xbps_trans_type_t tt)
|
2011-02-05 16:36:03 +05:30
|
|
|
{
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t pkgd;
|
2012-11-30 11:41:51 +05:30
|
|
|
const char *vpkg;
|
2011-02-05 16:36:03 +05:30
|
|
|
|
2012-11-30 11:41:51 +05:30
|
|
|
assert(x);
|
2013-06-20 13:56:12 +05:30
|
|
|
assert(xbps_object_type(a) == XBPS_TYPE_ARRAY);
|
2012-11-30 11:41:51 +05:30
|
|
|
assert(s);
|
2011-02-05 16:36:03 +05:30
|
|
|
|
2016-03-24 14:53:20 +05:30
|
|
|
if ((vpkg = vpkg_user_conf(x, s, false))) {
|
2020-02-21 13:38:22 +05:30
|
|
|
if ((pkgd = get_pkg_in_array(a, vpkg, tt, true)))
|
2012-11-30 11:41:51 +05:30
|
|
|
return pkgd;
|
2011-02-05 16:36:03 +05:30
|
|
|
}
|
2011-06-04 17:07:53 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
return get_pkg_in_array(a, s, tt, true);
|
2011-07-15 21:52:58 +05:30
|
|
|
}
|
2013-03-05 08:38:42 +05:30
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
static xbps_dictionary_t
|
|
|
|
match_pkg_by_pkgver(xbps_dictionary_t repod, const char *p)
|
2013-03-05 08:38:42 +05:30
|
|
|
{
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t d = NULL;
|
2019-06-27 20:39:43 +05:30
|
|
|
const char *pkgver = NULL;
|
2020-02-21 13:38:22 +05:30
|
|
|
char pkgname[XBPS_NAME_SIZE] = {0};
|
|
|
|
|
|
|
|
assert(repod);
|
|
|
|
assert(p);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
|
|
|
/* exact match by pkgver */
|
2020-02-09 00:01:29 +05:30
|
|
|
if (!xbps_pkg_name(pkgname, sizeof(pkgname), p))
|
2013-03-05 08:38:42 +05:30
|
|
|
return NULL;
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
d = xbps_dictionary_get(repod, pkgname);
|
2013-03-05 08:38:42 +05:30
|
|
|
if (d) {
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
2014-05-17 16:06:02 +05:30
|
|
|
if (strcmp(pkgver, p)) {
|
2013-03-05 08:38:42 +05:30
|
|
|
d = NULL;
|
2014-05-17 16:06:02 +05:30
|
|
|
errno = ENOENT;
|
|
|
|
}
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
static xbps_dictionary_t
|
|
|
|
match_pkg_by_pattern(xbps_dictionary_t repod, const char *p)
|
2013-03-05 08:38:42 +05:30
|
|
|
{
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t d = NULL;
|
2019-06-27 20:39:43 +05:30
|
|
|
const char *pkgver = NULL;
|
2020-02-21 13:38:22 +05:30
|
|
|
char pkgname[XBPS_NAME_SIZE] = {0};
|
|
|
|
|
|
|
|
assert(repod);
|
|
|
|
assert(p);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
|
|
|
/* match by pkgpattern in pkgver */
|
2020-02-09 00:01:29 +05:30
|
|
|
if (!xbps_pkgpattern_name(pkgname, sizeof(pkgname), p)) {
|
|
|
|
if (xbps_pkg_name(pkgname, sizeof(pkgname), p)) {
|
2013-03-05 08:38:42 +05:30
|
|
|
return match_pkg_by_pkgver(repod, p);
|
2013-08-29 15:21:42 +05:30
|
|
|
}
|
2013-03-05 08:38:42 +05:30
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
d = xbps_dictionary_get(repod, pkgname);
|
2013-03-05 08:38:42 +05:30
|
|
|
if (d) {
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_get_cstring_nocopy(d, "pkgver", &pkgver);
|
2013-03-05 08:38:42 +05:30
|
|
|
assert(pkgver);
|
2014-05-17 16:06:02 +05:30
|
|
|
if (!xbps_pkgpattern_match(pkgver, p)) {
|
2013-03-05 08:38:42 +05:30
|
|
|
d = NULL;
|
2014-05-17 16:06:02 +05:30
|
|
|
errno = ENOENT;
|
|
|
|
}
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char HIDDEN *
|
2016-03-24 14:53:20 +05:30
|
|
|
vpkg_user_conf(struct xbps_handle *xhp, const char *vpkg, bool only_conf)
|
2013-03-05 08:38:42 +05:30
|
|
|
{
|
2016-03-24 14:53:20 +05:30
|
|
|
xbps_dictionary_t d;
|
2014-02-25 21:12:52 +05:30
|
|
|
xbps_object_t obj;
|
|
|
|
xbps_object_iterator_t iter;
|
2014-12-31 13:21:45 +05:30
|
|
|
const char *pkg = NULL;
|
2014-02-25 23:13:33 +05:30
|
|
|
bool found = false;
|
2013-03-05 08:38:42 +05:30
|
|
|
|
2020-02-21 13:38:22 +05:30
|
|
|
assert(xhp);
|
|
|
|
assert(vpkg);
|
|
|
|
|
2016-03-24 14:53:20 +05:30
|
|
|
if (only_conf) {
|
|
|
|
d = xhp->vpkgd_conf;
|
|
|
|
} else {
|
|
|
|
d = xhp->vpkgd;
|
|
|
|
/* init pkgdb just in case to detect vpkgs */
|
|
|
|
(void)xbps_pkgdb_init(xhp);
|
|
|
|
}
|
2014-12-31 13:21:45 +05:30
|
|
|
|
2016-03-24 14:53:20 +05:30
|
|
|
if (d == NULL)
|
2013-03-05 08:38:42 +05:30
|
|
|
return NULL;
|
|
|
|
|
2016-03-24 14:53:20 +05:30
|
|
|
iter = xbps_dictionary_iterator(d);
|
2014-02-25 21:12:52 +05:30
|
|
|
assert(iter);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
2014-02-25 21:12:52 +05:30
|
|
|
while ((obj = xbps_object_iterator_next(iter))) {
|
2014-12-31 13:21:45 +05:30
|
|
|
xbps_string_t rpkg;
|
2020-02-21 13:38:22 +05:30
|
|
|
char buf[XBPS_NAME_SIZE] = {0};
|
2020-02-24 14:52:52 +05:30
|
|
|
char *vpkgver = NULL, *vpkgname = NULL;
|
|
|
|
const char *vpkg_conf = NULL;
|
2014-12-31 13:21:45 +05:30
|
|
|
|
|
|
|
vpkg_conf = xbps_dictionary_keysym_cstring_nocopy(obj);
|
2014-02-25 21:12:52 +05:30
|
|
|
rpkg = xbps_dictionary_get_keysym(xhp->vpkgd, obj);
|
|
|
|
pkg = xbps_string_cstring_nocopy(rpkg);
|
|
|
|
|
2015-01-05 20:34:22 +05:30
|
|
|
if (xbps_pkg_version(vpkg_conf)) {
|
2020-02-24 14:52:52 +05:30
|
|
|
if (!xbps_pkg_name(buf, sizeof(buf), vpkg_conf)) {
|
2020-02-09 00:01:29 +05:30
|
|
|
abort();
|
|
|
|
}
|
2020-02-24 14:52:52 +05:30
|
|
|
vpkgname = strdup(buf);
|
2014-02-25 21:12:52 +05:30
|
|
|
} else {
|
2020-02-24 14:52:52 +05:30
|
|
|
vpkgname = strdup(vpkg_conf);
|
2015-01-05 20:34:22 +05:30
|
|
|
}
|
2020-02-09 00:01:29 +05:30
|
|
|
assert(vpkgname);
|
2015-01-05 20:34:22 +05:30
|
|
|
|
|
|
|
if (xbps_pkgpattern_version(vpkg)) {
|
2014-12-31 13:21:45 +05:30
|
|
|
if (xbps_pkg_version(vpkg_conf)) {
|
2015-01-05 20:34:22 +05:30
|
|
|
if (!xbps_pkgpattern_match(vpkg_conf, vpkg)) {
|
2020-02-24 14:52:52 +05:30
|
|
|
free(vpkgname);
|
2014-12-31 13:21:45 +05:30
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
2015-01-05 20:34:22 +05:30
|
|
|
vpkgver = xbps_xasprintf("%s-999999_1", vpkg_conf);
|
|
|
|
if (!xbps_pkgpattern_match(vpkgver, vpkg)) {
|
|
|
|
free(vpkgver);
|
2020-02-24 14:52:52 +05:30
|
|
|
free(vpkgname);
|
2014-12-31 13:21:45 +05:30
|
|
|
continue;
|
|
|
|
}
|
2015-01-05 20:34:22 +05:30
|
|
|
free(vpkgver);
|
|
|
|
}
|
|
|
|
} else if (xbps_pkg_version(vpkg)) {
|
2020-02-24 14:52:52 +05:30
|
|
|
if (!xbps_pkg_name(buf, sizeof(buf), vpkg)) {
|
2020-02-09 00:01:29 +05:30
|
|
|
abort();
|
|
|
|
}
|
|
|
|
if (strcmp(buf, vpkgname)) {
|
2020-02-24 14:52:52 +05:30
|
|
|
free(vpkgname);
|
2015-01-05 20:34:22 +05:30
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (strcmp(vpkg, vpkgname)) {
|
2020-02-24 14:52:52 +05:30
|
|
|
free(vpkgname);
|
2015-01-05 20:34:22 +05:30
|
|
|
continue;
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
}
|
2020-02-24 14:52:52 +05:30
|
|
|
xbps_dbg_printf(xhp, "%s: vpkg_conf %s pkg %s vpkgname %s\n", __func__, vpkg_conf, pkg, vpkgname);
|
|
|
|
free(vpkgname);
|
2014-02-25 23:13:33 +05:30
|
|
|
found = true;
|
2014-02-25 21:12:52 +05:30
|
|
|
break;
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
2014-02-25 21:12:52 +05:30
|
|
|
xbps_object_iterator_release(iter);
|
|
|
|
|
2014-02-25 23:13:33 +05:30
|
|
|
return found ? pkg : NULL;
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
|
2016-03-23 17:16:52 +05:30
|
|
|
xbps_dictionary_t HIDDEN
|
|
|
|
xbps_find_virtualpkg_in_conf(struct xbps_handle *xhp,
|
|
|
|
xbps_dictionary_t d,
|
|
|
|
const char *pkg)
|
2013-03-05 08:38:42 +05:30
|
|
|
{
|
2016-03-23 17:16:52 +05:30
|
|
|
xbps_dictionary_t pkgd;
|
2013-03-05 08:38:42 +05:30
|
|
|
const char *vpkg;
|
|
|
|
|
|
|
|
/* Try matching vpkg from configuration files */
|
2016-03-24 14:53:20 +05:30
|
|
|
vpkg = vpkg_user_conf(xhp, pkg, true);
|
2013-03-05 08:38:42 +05:30
|
|
|
if (vpkg != NULL) {
|
|
|
|
if (xbps_pkgpattern_version(vpkg))
|
|
|
|
pkgd = match_pkg_by_pattern(d, vpkg);
|
|
|
|
else if (xbps_pkg_version(vpkg))
|
|
|
|
pkgd = match_pkg_by_pkgver(d, vpkg);
|
|
|
|
else
|
2013-06-20 13:56:12 +05:30
|
|
|
pkgd = xbps_dictionary_get(d, vpkg);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
2013-08-29 15:21:42 +05:30
|
|
|
if (pkgd)
|
|
|
|
return pkgd;
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
|
2016-03-23 17:16:52 +05:30
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
xbps_dictionary_t HIDDEN
|
|
|
|
xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
|
|
|
|
xbps_dictionary_t d,
|
|
|
|
const char *pkg)
|
|
|
|
{
|
|
|
|
xbps_object_t obj;
|
|
|
|
xbps_object_iterator_t iter;
|
|
|
|
xbps_dictionary_t pkgd = NULL;
|
2016-03-24 14:53:20 +05:30
|
|
|
const char *vpkg;
|
2016-03-23 17:16:52 +05:30
|
|
|
|
2020-01-18 17:20:59 +05:30
|
|
|
/* Try matching vpkg via xhp->vpkgd */
|
2016-03-24 14:53:20 +05:30
|
|
|
vpkg = vpkg_user_conf(xhp, pkg, false);
|
|
|
|
if (vpkg != NULL) {
|
|
|
|
if (xbps_pkgpattern_version(vpkg))
|
|
|
|
pkgd = match_pkg_by_pattern(d, vpkg);
|
|
|
|
else if (xbps_pkg_version(vpkg))
|
|
|
|
pkgd = match_pkg_by_pkgver(d, vpkg);
|
|
|
|
else
|
|
|
|
pkgd = xbps_dictionary_get(d, vpkg);
|
2016-03-23 17:16:52 +05:30
|
|
|
|
2016-03-24 14:53:20 +05:30
|
|
|
if (pkgd)
|
|
|
|
return pkgd;
|
|
|
|
}
|
2013-03-05 08:38:42 +05:30
|
|
|
/* ... otherwise match the first one in dictionary */
|
2013-06-20 13:56:12 +05:30
|
|
|
iter = xbps_dictionary_iterator(d);
|
2013-03-05 08:38:42 +05:30
|
|
|
assert(iter);
|
|
|
|
|
2013-06-20 13:56:12 +05:30
|
|
|
while ((obj = xbps_object_iterator_next(iter))) {
|
|
|
|
pkgd = xbps_dictionary_get_keysym(d, obj);
|
2014-04-20 20:24:50 +05:30
|
|
|
if (xbps_match_virtual_pkg_in_dict(pkgd, pkg)) {
|
2013-08-29 15:21:42 +05:30
|
|
|
xbps_object_iterator_release(iter);
|
|
|
|
return pkgd;
|
2013-03-05 08:38:42 +05:30
|
|
|
}
|
|
|
|
}
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_object_iterator_release(iter);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-03-23 17:16:52 +05:30
|
|
|
xbps_dictionary_t HIDDEN
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_find_pkg_in_dict(xbps_dictionary_t d, const char *pkg)
|
2013-03-05 08:38:42 +05:30
|
|
|
{
|
2013-06-20 13:56:12 +05:30
|
|
|
xbps_dictionary_t pkgd = NULL;
|
2013-03-05 08:38:42 +05:30
|
|
|
|
|
|
|
if (xbps_pkgpattern_version(pkg))
|
|
|
|
pkgd = match_pkg_by_pattern(d, pkg);
|
|
|
|
else if (xbps_pkg_version(pkg))
|
|
|
|
pkgd = match_pkg_by_pkgver(d, pkg);
|
|
|
|
else
|
2013-06-20 13:56:12 +05:30
|
|
|
pkgd = xbps_dictionary_get(d, pkg);
|
2013-03-05 08:38:42 +05:30
|
|
|
|
|
|
|
return pkgd;
|
|
|
|
}
|