Added support to put packages "on hold".

This commit is contained in:
Juan RP
2012-05-08 09:19:43 +02:00
parent b7961ae611
commit 28767f2ea8
6 changed files with 27 additions and 3 deletions

View File

@@ -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),

View File

@@ -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;