diff --git a/NEWS b/NEWS index 0d6b0e6a..62ae9a97 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.18 (???): + * Shell wildcard patterns (fnmatch(3)) can now be used in the + PackagesOnHold configuration option. + * New utilities replacing xbps-bin(8) and xbps-repo(8): - xbps-install(8): to install and update packages. diff --git a/etc/xbps.conf b/etc/xbps.conf index 8df66478..68a593ce 100644 --- a/etc/xbps.conf +++ b/etc/xbps.conf @@ -55,11 +55,10 @@ repositories = { # Packages on hold. # # Packages that are put on hold won't be updated even if there is a -# newer version in repository pool. +# newer version in repository pool. Package names and shell wildcards +# can be specified. # -# This expects package names and separated by commas. -# -#PackagesOnHold = { glibc, xbps } +#PackagesOnHold = { "glibc-*" } # Virtual packages. # diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c index 71c6dce8..19be4b77 100644 --- a/lib/transaction_ops.c +++ b/lib/transaction_ops.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "xbps_api_impl.h" @@ -72,21 +73,11 @@ transaction_find_pkg(struct xbps_handle *xhp, assert(pkg != NULL); - if (action == TRANS_INSTALL) { - /* install */ - reason = "install"; - } else { - /* update */ - if ((pkg_pkgdb = xbps_pkgdb_get_pkgd(xhp, pkg, false)) == NULL) - return ENODEV; - - reason = "update"; - } - /* * Find out if the pkg has been found in repository pool. */ if (action == TRANS_INSTALL) { + reason = "install"; if (exact) { pkg_repod = xbps_rpool_find_pkg_exact(xhp, pkg); if (pkg_repod == NULL) { @@ -102,6 +93,10 @@ transaction_find_pkg(struct xbps_handle *xhp, } } } else { + if ((pkg_pkgdb = xbps_pkgdb_get_pkgd(xhp, pkg, false)) == NULL) + return ENODEV; + + reason = "update"; pkg_repod = xbps_rpool_find_pkg(xhp, pkg, false, true); if (pkg_repod == NULL) { /* not found */ @@ -202,7 +197,7 @@ int xbps_transaction_update_packages(struct xbps_handle *xhp) { prop_object_t obj; - const char *pkgname, *holdpkgname; + const char *pkgname, *holdpkg; bool foundhold = false, newpkg_found = false; int rv = 0; size_t i, x; @@ -213,11 +208,13 @@ xbps_transaction_update_packages(struct xbps_handle *xhp) for (i = 0; i < prop_array_count(xhp->pkgdb); i++) { obj = prop_array_get(xhp->pkgdb, i); prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); + for (x = 0; x < cfg_size(xhp->cfg, "PackagesOnHold"); x++) { - holdpkgname = cfg_getnstr(xhp->cfg, "PackagesOnHold", x); - if (strcmp(pkgname, holdpkgname) == 0) { - xbps_dbg_printf(xhp, "[rpool] package %s on hold, " - "ignoring updates.\n", pkgname); + holdpkg = cfg_getnstr(xhp->cfg, "PackagesOnHold", x); + if ((strcmp(holdpkg, pkgname) == 0) || + (fnmatch(holdpkg, pkgname, FNM_PERIOD) == 0)) { + xbps_dbg_printf(xhp, "[rpool] package `%s' " + "on hold, ignoring updates.\n", pkgname); foundhold = true; break; }