summaryrefslogtreecommitdiffstats
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2008-08-17 19:23:12 +0200
committerDan McGee <dan@archlinux.org>2008-08-23 16:50:40 +0200
commitbaf58525553db8f1e680de16793b147c88df59e2 (patch)
tree885014fda3855817a4468667a020052d60dc0463 /src/pacman/sync.c
parent8146f6f1c6bbd7bf642cb263ca1658234fb7e48a (diff)
downloadpacman-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/pacman/sync.c')
-rw-r--r--src/pacman/sync.c41
1 files changed, 25 insertions, 16 deletions
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) {