summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.h6
-rw-r--r--lib/libalpm/sync.c47
-rw-r--r--src/pacman/callback.c3
-rw-r--r--src/pacman/conf.h1
-rw-r--r--src/pacman/pacman.c3
-rw-r--r--src/pacman/sync.c41
6 files changed, 48 insertions, 53 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 7ef02062..cdceaf01 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -283,7 +283,7 @@ typedef enum _pmtransflag_t {
PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
PM_TRANS_FLAG_NOCONFLICTS = 0x800,
- PM_TRANS_FLAG_PRINTURIS = 0x1000,
+ /* 0x1000 flag can go here */
PM_TRANS_FLAG_NEEDED = 0x2000,
PM_TRANS_FLAG_ALLEXPLICIT = 0x4000,
PM_TRANS_FLAG_UNNEEDED = 0x8000,
@@ -365,10 +365,6 @@ typedef enum _pmtransevt_t {
* A line of text is passed to the callback.
*/
PM_TRANS_EVT_SCRIPTLET_INFO,
- /** Print URI.
- * The database's URI and the package's filename are passed to the callback.
- */
- PM_TRANS_EVT_PRINTURI,
/** Files will be downloaded from a repository.
* The repository's tree name is passed to the callback.
*/
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 4a705b57..22b391bc 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -497,8 +497,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
}
- /* We don't care about conflicts if we're just printing uris */
- if(!(trans->flags & (PM_TRANS_FLAG_NOCONFLICTS | PM_TRANS_FLAG_PRINTURIS))) {
+ if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) {
/* check for inter-conflicts and whatnot */
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
@@ -838,32 +837,27 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
fname = alpm_pkg_get_filename(spkg);
ASSERT(fname != NULL, RET_ERR(PM_ERR_PKG_INVALID_NAME, -1));
- if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
- EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current),
- (char *)fname);
- } else {
- if(spkg->download_size != 0) {
- alpm_list_t *delta_path = spkg->delta_path;
- if(delta_path) {
- alpm_list_t *dlts = NULL;
-
- for(dlts = delta_path; dlts; dlts = dlts->next) {
- pmdelta_t *d = dlts->data;
-
- if(d->download_size != 0) {
- /* add the delta filename to the download list if
- * it's not in the cache */
- files = alpm_list_add(files, strdup(d->delta));
- }
-
- /* keep a list of the delta files for md5sums */
- deltas = alpm_list_add(deltas, d);
+ if(spkg->download_size != 0) {
+ alpm_list_t *delta_path = spkg->delta_path;
+ if(delta_path) {
+ alpm_list_t *dlts = NULL;
+
+ for(dlts = delta_path; dlts; dlts = dlts->next) {
+ pmdelta_t *d = dlts->data;
+
+ if(d->download_size != 0) {
+ /* add the delta filename to the download list if
+ * it's not in the cache */
+ files = alpm_list_add(files, strdup(d->delta));
}
- } else {
- /* not using deltas, so add the file to the download list */
- files = alpm_list_add(files, strdup(fname));
+ /* keep a list of the delta files for md5sums */
+ deltas = alpm_list_add(deltas, d);
}
+
+ } else {
+ /* not using deltas, so add the file to the download list */
+ files = alpm_list_add(files, strdup(fname));
}
}
}
@@ -880,9 +874,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
FREELIST(files);
}
}
- if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
- return(0);
- }
/* clear out value to let callback know we are done */
if(handle->totaldlcb) {
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) {