diff --git a/NEWS b/NEWS index 924b85f1..cc595bec 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ xbps-0.16 (???): + * Added support to put packages "on hold". Packages on hold + won't be updated by system upgrades even if there is a newer version. + The configuration string list "PackagesOnHold" in xbps.conf expects + a list of package names. + * xbps-repo(8): new target: 'clean'. This removes obsolete binpkgs from cachedir, either because the binpkg is not available in repository pool anymore or because its sha256 hash that doesn't match with the diff --git a/TODO b/TODO index 66f32a48..b5f6954b 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ libxbps: - conflicts: the object is there but is not handled yet (ETA 0.16) - - properties: (hold) still unimplemented (ETA 0.16) - properties: (update-first) still unimplemented. xbps-repo: diff --git a/etc/xbps.conf b/etc/xbps.conf index aaf0b343..f9e93242 100644 --- a/etc/xbps.conf +++ b/etc/xbps.conf @@ -56,6 +56,15 @@ repositories = { http://xbps.nopcode.org/repos/current/nonfree/x86_64 } +# Packages on hold. +# +# Packages that are put on hold won't be updated even if there is a +# newer version in repository pool. +# +# This expects package names and separated by commas. +# +#PackagesOnHold = { glibc, xbps } + # Virtual packages. # # The following syntax is used: diff --git a/include/xbps_api.h b/include/xbps_api.h index e0cecabb..d5dffb74 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -56,7 +56,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.4" -#define XBPS_API_VERSION "20120506-1" +#define XBPS_API_VERSION "20120508" #define XBPS_VERSION "0.16" /** diff --git a/lib/initend.c b/lib/initend.c index c453612a..f7fb3375 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -110,6 +110,7 @@ xbps_init(struct xbps_handle *xh) XBPS_TRANS_FLUSH, CFGF_NONE), CFG_BOOL(__UNCONST("syslog"), true, CFGF_NONE), CFG_STR_LIST(__UNCONST("repositories"), NULL, CFGF_MULTI), + CFG_STR_LIST(__UNCONST("PackagesOnHold"), NULL, CFGF_MULTI), CFG_SEC(__UNCONST("virtual-package"), vpkg_opts, CFGF_MULTI|CFGF_TITLE), CFG_FUNC(__UNCONST("include"), &cfg_include), diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c index d239d727..cd85c0b1 100644 --- a/lib/transaction_ops.c +++ b/lib/transaction_ops.c @@ -188,13 +188,23 @@ out: static int update_pkgs_cb(prop_object_t obj, void *arg, bool *done) { - const char *pkgname; + struct xbps_handle *xhp = xbps_handle_get(); + const char *pkgname, *holdpkgname; bool *newpkg_found = arg; int rv = 0; + size_t i; (void)done; prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); + for (i = 0; i < cfg_size(xhp->cfg, "PackagesOnHold"); i++) { + holdpkgname = cfg_getnstr(xhp->cfg, "PackagesOnHold", i); + if (strcmp(pkgname, holdpkgname) == 0) { + xbps_dbg_printf("[rpool] package %s on hold, " + "ignoring updates.\n", pkgname); + return 0; + } + } rv = xbps_transaction_update_pkg(pkgname); if (rv == 0) *newpkg_found = true;