Fix -Sy and -Sp operations.

When the -Sy operation failed, the lock wasn't removed because
alpm_trans_release wasn't called. This is fixed now.

Also, after my last change in commit 52e7e6d747 ,
Sp didn't do anything anymore.
That's because needs_transaction returned false for -Sp, so the sync transaction
wasn't run. However, the current implementation of -Sp requires a sync transaction.

Also, since a transaction creates the lock file at the beginning, and releases it
at the end, this mean that -Sp requires root access anyway..

I think I understand now why Aaron found that the current -Sp implementation is hackish :)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
Chantry Xavier 2007-10-04 18:13:09 -05:00 committed by Aaron Griffin
parent 02ec82b8c6
commit 98bcd1f5b1
2 changed files with 3 additions and 3 deletions

View file

@ -414,7 +414,8 @@ int sync_trans(alpm_list_t *targets, int sync_only)
alpm_logaction("synchronizing package lists"); alpm_logaction("synchronizing package lists");
if(!sync_synctree(config->op_s_sync, sync_dbs)) { if(!sync_synctree(config->op_s_sync, sync_dbs)) {
fprintf(stderr, _("error: failed to synchronize any databases\n")); fprintf(stderr, _("error: failed to synchronize any databases\n"));
return(1); retval = 1;
goto cleanup;
} }
if(sync_only) { if(sync_only) {
goto cleanup; goto cleanup;

View file

@ -49,8 +49,7 @@ int needs_transaction()
{ {
if(config->op != PM_OP_MAIN && config->op != PM_OP_QUERY && config->op != PM_OP_DEPTEST) { if(config->op != PM_OP_MAIN && config->op != PM_OP_QUERY && config->op != PM_OP_DEPTEST) {
if((config->op == PM_OP_SYNC && !config->op_s_sync && if((config->op == PM_OP_SYNC && !config->op_s_sync &&
(config->op_s_search || config->group || config->op_q_list || config->op_q_info (config->op_s_search || config->group || config->op_q_list || config->op_q_info))
|| config->flags & PM_TRANS_FLAG_PRINTURIS))
|| config->op == PM_OP_DEPTEST) { || config->op == PM_OP_DEPTEST) {
/* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */ /* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */
return(0); return(0);