xbps.d(5): 'virtualpkg' can now be used to map any pkg to another.

See NEWS for more information.
This commit is contained in:
Juan RP 2016-03-23 12:46:52 +01:00
parent 897ac238c4
commit 29765271e9
4 changed files with 39 additions and 10 deletions

10
NEWS
View File

@ -1,8 +1,16 @@
xbps-0.52 (???):
* xbps.d(5): the 'virtualpkg' keyword can now be used to map any pkg
to another, even if there's an existing real package. Example:
virtualpkg=wifi-firmware:base-system
Any request to the `wifi-firmware` pkg will be resolved to the
`base-system` pkg.
* libxbps: fixed some missing or incorrect printf format arguments
found by using __attribute__((format,printf). Patch provided by
Michael Ghering in #148. See https://github.com/voidlinux/xbps/issues/148
Michael Gehring in #148. See https://github.com/voidlinux/xbps/issues/148
* libxbps: ignore updates for packages that have held dependencies.
Fixes #143. See https://github.com/voidlinux/xbps/issues/143

View File

@ -117,6 +117,8 @@ int HIDDEN xbps_entry_install_conf_file(struct xbps_handle *, xbps_dictionary_t,
const char *);
int HIDDEN xbps_repository_find_deps(struct xbps_handle *, xbps_array_t,
xbps_dictionary_t);
xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_conf(struct xbps_handle *,
xbps_dictionary_t, const char *);
xbps_dictionary_t HIDDEN xbps_find_pkg_in_dict(xbps_dictionary_t, const char *);
xbps_dictionary_t HIDDEN xbps_find_virtualpkg_in_dict(struct xbps_handle *,
xbps_dictionary_t, const char *);

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2014 Juan Romero Pardines.
* Copyright (c) 2008-2016 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -263,14 +263,12 @@ vpkg_user_conf(struct xbps_handle *xhp, const char *vpkg)
return found ? pkg : NULL;
}
xbps_dictionary_t
xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
xbps_dictionary_t HIDDEN
xbps_find_virtualpkg_in_conf(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;
xbps_dictionary_t pkgd;
const char *vpkg;
/* Try matching vpkg from configuration files */
@ -287,6 +285,22 @@ xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
return pkgd;
}
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;
/* Try matching vpkg from configuration files */
if ((pkgd = xbps_find_virtualpkg_in_conf(xhp, d, pkg)))
return pkgd;
/* ... otherwise match the first one in dictionary */
iter = xbps_dictionary_iterator(d);
assert(iter);
@ -303,7 +317,7 @@ xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
return NULL;
}
xbps_dictionary_t
xbps_dictionary_t HIDDEN
xbps_find_pkg_in_dict(xbps_dictionary_t d, const char *pkg)
{
xbps_dictionary_t pkgd = NULL;

View File

@ -340,6 +340,11 @@ xbps_repo_get_pkg(struct xbps_repo *repo, const char *pkg)
if (repo->idx == NULL)
return NULL;
/* Try matching vpkg from configuration files */
if ((pkgd = xbps_find_virtualpkg_in_conf(repo->xhp, repo->idx, pkg)))
return pkgd;
/* ... otherwise match a real pkg */
pkgd = xbps_find_pkg_in_dict(repo->idx, pkg);
if (pkgd) {
xbps_dictionary_set_cstring_nocopy(pkgd,