From b86479cf9b584c62dbda967902cee2a81678c9ef Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 27 Sep 2007 23:04:00 -0500 Subject: Allow --refresh specified for most -S options Included options are -g, -i, -s, and -l All of these will sync the DB if -y is specified and permissions are appropriate. Signed-off-by: Aaron Griffin --- src/pacman/sync.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 11941eb3..0d10d70a 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -407,28 +407,6 @@ int pacman_sync(alpm_list_t *targets) return(1); } - /* First: operations that do not require targets */ - - /* search for a package */ - if(config->op_s_search) { - return(sync_search(sync_dbs, targets)); - } - - /* look for groups */ - if(config->group) { - return(sync_group(config->group, sync_dbs, targets)); - } - - /* get package info */ - if(config->op_s_info) { - return(sync_info(sync_dbs, targets)); - } - - /* get a listing of files in sync DBs */ - if(config->op_q_list) { - return(sync_list(sync_dbs, targets)); - } - /* don't proceed here unless we have an operation that doesn't require * a target list */ if(targets == NULL && !(config->op_s_sync || config->op_s_upgrade)) { @@ -437,8 +415,9 @@ int pacman_sync(alpm_list_t *targets) } /* Step 1: create a new transaction... */ - if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, - cb_trans_conv, cb_trans_progress) == -1) { + if(needs_transaction() && + alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, + cb_trans_conv, cb_trans_progress) == -1) { fprintf(stderr, _("error: failed to init transaction (%s)\n"), alpm_strerrorlast()); if(pm_errno == PM_ERR_HANDLE_LOCK) { @@ -458,6 +437,30 @@ int pacman_sync(alpm_list_t *targets) } } + /* search for a package */ + if(config->op_s_search) { + retval = sync_search(sync_dbs, targets); + goto cleanup; + } + + /* look for groups */ + if(config->group) { + retval = sync_group(config->group, sync_dbs, targets); + goto cleanup; + } + + /* get package info */ + if(config->op_s_info) { + retval = sync_info(sync_dbs, targets); + goto cleanup; + } + + /* get a listing of files in sync DBs */ + if(config->op_q_list) { + retval = sync_list(sync_dbs, targets); + goto cleanup; + } + if(config->op_s_upgrade) { alpm_list_t *pkgs, *i; -- cgit v1.2.3-24-g4f1b