diff options
author | Nagy Gabor <ngaba@bibl.u-szeged.hu> | 2008-08-17 19:23:12 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-08-23 16:50:40 +0200 |
commit | baf58525553db8f1e680de16793b147c88df59e2 (patch) | |
tree | 885014fda3855817a4468667a020052d60dc0463 /src | |
parent | 8146f6f1c6bbd7bf642cb263ca1658234fb7e48a (diff) | |
download | pacman-baf58525553db8f1e680de16793b147c88df59e2.tar.gz pacman-baf58525553db8f1e680de16793b147c88df59e2.tar.xz |
Move -Sp implementation to the front-end
This patch kills one of our hackish pseudo transactions: PRINTURIS.
(The other one is -Sw)
From now on, front-end must not call trans_commit in case of -Sp,
it should print the uris of target packages "by hand" instead.
PRINTURIS flag was removed, NOCONFLICTS flag can be passed to skip
conflict checks.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/callback.c | 3 | ||||
-rw-r--r-- | src/pacman/conf.h | 1 | ||||
-rw-r--r-- | src/pacman/pacman.c | 3 | ||||
-rw-r--r-- | src/pacman/sync.c | 41 |
4 files changed, 28 insertions, 20 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 838e336a..3c98d398 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -226,9 +226,6 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) case PM_TRANS_EVT_SCRIPTLET_INFO: printf("%s", (char*)data1); break; - case PM_TRANS_EVT_PRINTURI: - printf("%s/%s\n", (char*)data1, (char*)data2); - break; case PM_TRANS_EVT_RETRIEVE_START: printf(_(":: Retrieving packages from %s...\n"), (char*)data1); break; diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 9d2318df..8ea66629 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -57,6 +57,7 @@ typedef struct __config_t { unsigned short op_s_sync; unsigned short op_s_search; unsigned short op_s_upgrade; + unsigned short op_s_printuris; unsigned short group; pmtransflag_t flags; diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 04b5e491..83e713a8 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -462,7 +462,8 @@ static int parseargs(int argc, char *argv[]) case 'o': config->op_q_owns = 1; break; case 'p': config->op_q_isfile = 1; - config->flags |= PM_TRANS_FLAG_PRINTURIS; + config->op_s_printuris = 1; + config->flags |= PM_TRANS_FLAG_NOCONFLICTS; break; case 'q': config->quiet = 1; diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 99cebf6d..e8507143 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -666,23 +666,32 @@ static int sync_trans(alpm_list_t *targets) goto cleanup; } - if(!(alpm_trans_get_flags() & PM_TRANS_FLAG_PRINTURIS)) { - int confirm; + /* Step 3: actually perform the operation */ + if(config->op_s_printuris) { + /* print uris */ + alpm_list_t *i; + for(i = packages; i; i = alpm_list_next(i)) { + pmpkg_t *pkg = alpm_sync_get_pkg((pmsyncpkg_t *)alpm_list_getdata(i)); + pmdb_t *db = alpm_pkg_get_db(pkg); + printf("%s/%s\n", alpm_db_get_url(db), alpm_pkg_get_filename(pkg)); + } + /* we are done */ + goto cleanup; + } - display_synctargets(packages); - printf("\n"); + display_synctargets(packages); + printf("\n"); - if(config->op_s_downloadonly) { - confirm = yesno(_("Proceed with download?")); - } else { - confirm = yesno(_("Proceed with installation?")); - } - if(!confirm) { - goto cleanup; - } - }/* else 'print uris' requested. We're done at this point */ + int confirm; + if(config->op_s_downloadonly) { + confirm = yesno(_("Proceed with download?")); + } else { + confirm = yesno(_("Proceed with installation?")); + } + if(!confirm) { + goto cleanup; + } - /* Step 3: actually perform the installation */ if(alpm_trans_commit(&data) == -1) { pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerrorlast()); @@ -739,7 +748,7 @@ int pacman_sync(alpm_list_t *targets) alpm_list_t *sync_dbs = NULL; /* Display only errors with -Sp and -Sw operations */ - if(config->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS)) { + if((config->flags & PM_TRANS_FLAG_DOWNLOADONLY) || config->op_s_printuris) { config->logmask &= ~PM_LOG_WARNING; } @@ -811,7 +820,7 @@ int pacman_sync(alpm_list_t *targets) } alpm_list_t *targs = alpm_list_strdup(targets); - if(!(config->flags & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) { + if(!(config->flags & PM_TRANS_FLAG_DOWNLOADONLY) && !config->op_s_printuris) { /* check for newer versions of packages to be upgraded first */ alpm_list_t *packages = syncfirst(); if(packages) { |