Remove PackagesOnHold from xbps.conf; use xbps-pkgdb -m hold|unhold instead.

To put a package on hold mode:
	$ xbps-pkgdb -m hold foo

To unhold the package:
	$ xbps-pkgdb -m unhold foo

To list packages on hold mode:
	$ xbps-query -H

This also close #12 from github.
This commit is contained in:
Juan RP
2013-08-12 14:46:54 +02:00
parent 9c9d5b58dd
commit 776b94e6bc
11 changed files with 96 additions and 60 deletions

View File

@@ -127,7 +127,6 @@ xbps_init(struct xbps_handle *xhp)
XBPS_FETCH_TIMEOUT, 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

@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2012 Juan Romero Pardines.
* Copyright (c) 2008-2013 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -237,12 +237,18 @@ find_repo_deps(struct xbps_handle *xhp,
if (rv == 0) {
/*
* Package is installed but does not match
* the dependency pattern, update pkg.
* the dependency pattern, update pkg if it's not
* on hold state.
*/
xbps_dbg_printf_append(xhp,
"installed `%s', "
"must be updated.\n", pkgver_q);
reason = "update";
"must be updated.", pkgver_q);
if (xbps_dictionary_get(tmpd, "hold"))
xbps_dbg_printf_append(xhp, " on hold state! ignoring update.\n");
else {
xbps_dbg_printf_append(xhp, "\n");
reason = "update";
}
} else if (rv == 1) {
rv = 0;
if (state == XBPS_PKG_STATE_UNPACKED) {

View File

@@ -189,11 +189,10 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
xbps_dictionary_t pkgd;
xbps_object_t obj;
xbps_object_iterator_t iter;
const char *pkgver, *holdpkg;
char *pkgname;
bool foundhold = false, newpkg_found = false;
const char *pkgver;
char *pkgname = NULL;
bool hold, newpkg_found = false;
int rv = 0;
unsigned int x;
if ((rv = xbps_pkgdb_init(xhp)) != 0)
return rv;
@@ -204,23 +203,15 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
while ((obj = xbps_object_iterator_next(iter))) {
pkgd = xbps_dictionary_get_keysym(xhp->pkgdb, obj);
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
for (x = 0; x < cfg_size(xhp->cfg, "PackagesOnHold"); x++) {
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;
}
}
if (foundhold) {
foundhold = false;
hold = false;
xbps_dictionary_get_bool(pkgd, "hold", &hold);
if (hold) {
xbps_dbg_printf(xhp, "[rpool] package `%s' "
"on hold, ignoring updates.\n", pkgver);
continue;
}
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
rv = trans_find_pkg(xhp, pkgname, TRANS_UPDATE);
if (rv == 0)
newpkg_found = true;