Multiple changes to pkgs on hold mode.

- Added transaction stats for pkgs on hold.

- Always add packages on hold to the transaction dictionary,
  its type will be set to XBPS_TRANS_HOLD.

- Changed xbps_transaction_update_pkg() to have a new "force"
  bool argument to force an update with a pkg on hold.

- As discussed in #274 with @Duncaen the only way to update a
  pkg on hold is by using `-f`, i.e `xbps-install -f foo`.

Closes #265
Closes #274
This commit is contained in:
Juan RP
2020-04-23 06:03:56 +02:00
parent 6b6b394686
commit 7d8247ae56
9 changed files with 127 additions and 108 deletions

View File

@@ -51,7 +51,7 @@
*
* This header documents the full API for the XBPS Library.
*/
#define XBPS_API_VERSION "20200414"
#define XBPS_API_VERSION "20200423"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@@ -1186,8 +1186,8 @@ xbps_object_iterator_t xbps_array_iter_from_dict(xbps_dictionary_t dict, const c
* @param[in] xhp Pointer to the xbps_handle struct.
* @param[in] pkg Package name, package/version or package pattern to match, i.e
* `foo', `foo-1.0_1' or `foo>=1.2'.
* @param[in] reinstall If true, package will be queued (if \a str matches)
* even if package is already installed.
* @param[in] Force If true, package will be queued (if \a str matches)
* even if package is already installed or in hold mode.
*
* @return 0 on success, otherwise an errno value.
* @retval EEXIST Package is already installed (reinstall wasn't enabled).
@@ -1197,7 +1197,7 @@ xbps_object_iterator_t xbps_array_iter_from_dict(xbps_dictionary_t dict, const c
* @retval EINVAL Any other error ocurred in the process.
* @retval EBUSY The xbps package must be updated.
*/
int xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall);
int xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, bool force);
/**
* Marks a package as "going to be updated" in the transaction dictionary.
@@ -1210,6 +1210,8 @@ int xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, bool
*
* @param[in] xhp Pointer to the xbps_handle struct.
* @param[in] pkgname The package name to update.
* @param[in] force If true, package will be queued (if \a str matches)
* even if package is already installed or in hold mode.
*
* @return 0 on success, otherwise an errno value.
* @retval EEXIST Package is already up-to-date.
@@ -1219,7 +1221,7 @@ int xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg, bool
* @retval EINVAL Any other error ocurred in the process.
* @retval EBUSY The xbps package must be updated.
*/
int xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkgname);
int xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkgname, bool force);
/**
* Finds newer versions for all installed packages by looking at the