diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-09-28 06:04:00 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2007-09-28 07:25:57 +0200 |
commit | b86479cf9b584c62dbda967902cee2a81678c9ef (patch) | |
tree | d19946d84ca2c55570f08eb1014aacf1b3482e3d /src | |
parent | 4942d216323cbe2f099c43893cc95368a3cd1197 (diff) | |
download | pacman-b86479cf9b584c62dbda967902cee2a81678c9ef.tar.gz pacman-b86479cf9b584c62dbda967902cee2a81678c9ef.tar.xz |
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 <aaronmgriffin@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/sync.c | 51 |
1 files changed, 27 insertions, 24 deletions
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; |