Do not silently update xbps on any install/update transaction.
When there's a new xbps update, xbps-install(1) will now return EBUSY (16) and a message (if dry-run disabled) explaining how to proceed. If there's an update and transaction does not contain xbps, it will error out unless the 'xbps' pkg is the only target pkg, i.e: # xbps-install -Su # echo $? 16 To update xbps, the only way to proceed is to explicitly declare it as an update, i.e: # xbps-install -u xbps The dry-run mode will still show there's an xbps update. Modified the existing test cases to satisfy the new behaviour. Closes #166 Closes #142
This commit is contained in:
@@ -297,8 +297,8 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
|
||||
rv = xbps_autoupdate(xhp);
|
||||
switch (rv) {
|
||||
case 1:
|
||||
/* xbps needs to be updated, don't add any other package */
|
||||
return 0;
|
||||
/* xbps needs to be updated, don't allow any other update */
|
||||
return EBUSY;
|
||||
case -1:
|
||||
/* error */
|
||||
return EINVAL;
|
||||
@@ -349,7 +349,9 @@ xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg)
|
||||
xbps_dbg_printf(xhp, "%s: xbps_autoupdate %d\n", __func__, rv);
|
||||
switch (rv) {
|
||||
case 1:
|
||||
/* xbps needs to be updated, don't add any other package */
|
||||
/* xbps needs to be updated, only allow xbps to be updated */
|
||||
if (strcmp(pkg, "xbps"))
|
||||
return EBUSY;
|
||||
return 0;
|
||||
case -1:
|
||||
/* error */
|
||||
@@ -388,7 +390,9 @@ xbps_transaction_install_pkg(struct xbps_handle *xhp, const char *pkg,
|
||||
rv = xbps_autoupdate(xhp);
|
||||
switch (rv) {
|
||||
case 1:
|
||||
/* xbps needs to be updated, don't add any other package */
|
||||
/* xbps needs to be updated, only allow xbps to be updated */
|
||||
if (strcmp(pkg, "xbps"))
|
||||
return EBUSY;
|
||||
return 0;
|
||||
case -1:
|
||||
/* error */
|
||||
|
Reference in New Issue
Block a user