Add the ability to ignore packages

The previous idea was to use virtual packages in the users configuration
to satisfy dependencies by mapping them to existing installed packages.
Using virtual packages for it doesn't work as expected and trying to make
it work would break other functionalities of virtual packages, like the
version satisfaction checks for `provides` and the ability to replace
virtual packages with real packages. The virtual package functionality
should be used exclusively for virtual packages.

This allows users to specify packages packages that should be ignored.
Ignored packages in dependencies are always satisfied without installing
the package, while updating or installing a package that depends on an
ignored package.

This does NOT ignore the shlib checks, ignoring a package that provides
required shared libraries will abort the transaction as if there was no
package that provides the required shared library.
This commit is contained in:
Duncaen
2019-03-05 16:45:29 +01:00
parent 9f52a7837f
commit d1667fd931
9 changed files with 134 additions and 1 deletions

View File

@ -86,6 +86,28 @@ xbps_pkg_is_installed(struct xbps_handle *xhp, const char *pkg)
return 0; /* not fully installed */
}
bool
xbps_pkg_is_ignored(struct xbps_handle *xhp, const char *pkg)
{
char *pkgname;
bool rv = false;
assert(xhp);
assert(pkg);
if (!xhp->ignored_pkgs)
return false;
if ((pkgname = xbps_pkgpattern_name(pkg)) != NULL ||
(pkgname = xbps_pkg_name(pkg)) != NULL) {
rv = xbps_match_string_in_array(xhp->ignored_pkgs, pkgname);
free(pkgname);
return rv;
}
return xbps_match_string_in_array(xhp->ignored_pkgs, pkg);
}
const char *
xbps_pkg_version(const char *pkg)
{