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

5
NEWS
View File

@ -1,5 +1,10 @@
xbps-0.16 (???): 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 * xbps-repo(8): new target: 'clean'. This removes obsolete binpkgs
from cachedir, either because the binpkg is not available in repository from cachedir, either because the binpkg is not available in repository
pool anymore or because its sha256 hash that doesn't match with the pool anymore or because its sha256 hash that doesn't match with the

1
TODO
View File

@ -1,6 +1,5 @@
libxbps: libxbps:
- conflicts: the object is there but is not handled yet (ETA 0.16) - 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. - properties: (update-first) still unimplemented.
xbps-repo: xbps-repo:

View File

@ -56,6 +56,15 @@ repositories = {
http://xbps.nopcode.org/repos/current/nonfree/x86_64 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. # Virtual packages.
# #
# The following syntax is used: # The following syntax is used:

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.4" #define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120506-1" #define XBPS_API_VERSION "20120508"
#define XBPS_VERSION "0.16" #define XBPS_VERSION "0.16"
/** /**

View File

@ -110,6 +110,7 @@ xbps_init(struct xbps_handle *xh)
XBPS_TRANS_FLUSH, CFGF_NONE), XBPS_TRANS_FLUSH, CFGF_NONE),
CFG_BOOL(__UNCONST("syslog"), true, CFGF_NONE), CFG_BOOL(__UNCONST("syslog"), true, CFGF_NONE),
CFG_STR_LIST(__UNCONST("repositories"), NULL, CFGF_MULTI), CFG_STR_LIST(__UNCONST("repositories"), NULL, CFGF_MULTI),
CFG_STR_LIST(__UNCONST("PackagesOnHold"), NULL, CFGF_MULTI),
CFG_SEC(__UNCONST("virtual-package"), CFG_SEC(__UNCONST("virtual-package"),
vpkg_opts, CFGF_MULTI|CFGF_TITLE), vpkg_opts, CFGF_MULTI|CFGF_TITLE),
CFG_FUNC(__UNCONST("include"), &cfg_include), CFG_FUNC(__UNCONST("include"), &cfg_include),

View File

@ -188,13 +188,23 @@ out:
static int static int
update_pkgs_cb(prop_object_t obj, void *arg, bool *done) 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; bool *newpkg_found = arg;
int rv = 0; int rv = 0;
size_t i;
(void)done; (void)done;
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname); 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); rv = xbps_transaction_update_pkg(pkgname);
if (rv == 0) if (rv == 0)
*newpkg_found = true; *newpkg_found = true;