summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-20 22:49:39 +0200
committerAurelien Foret <aurelien@archlinux.org>2005-04-20 22:49:39 +0200
commit2a3968b8bc27ee10fddd1d5492d010f1af2d486d (patch)
tree3a906bc5aea0053bb15bc460fdbd88c97b842ea0
parent406f3831927911643898f222cdc45ac8f1a6f6f6 (diff)
downloadpacman-2a3968b8bc27ee10fddd1d5492d010f1af2d486d.tar.gz
pacman-2a3968b8bc27ee10fddd1d5492d010f1af2d486d.tar.xz
display the list of targets to be removed before trans_commit() call
-rw-r--r--src/pacman/sync.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index c824d61b..76183bf5 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -516,15 +516,21 @@ int pacman_sync(list_t *targets)
unsigned long totalsize = 0;
double mb;
- /* ORE
- for(i = rmtargs; i; i = i->next) {
- list = list_add(list, strdup(i->data));
+ packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
+ if(packages == NULL) {
+ retval = 0;
+ goto cleanup;
}
- for(i = final; i; i = i->next) {
- syncpkg_t *s = (syncpkg_t*)i->data;
- for(j = s->replaces; j; j = j->next) {
- pkginfo_t *p = (pkginfo_t*)j->data;
- list = list_add(list, strdup(p->name));
+
+ for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
+ PM_SYNCPKG *sync = alpm_list_getdata(lp);
+ if((int)alpm_sync_getinfo(sync, PM_SYNC_TYPE) == PM_SYNC_TYPE_REPLACE) {
+ PM_LIST *j, *data;
+ data = alpm_sync_getinfo(sync, PM_SYNC_DATA);
+ for(j = alpm_list_first(data); j; j = alpm_list_next(j)) {
+ PM_PKG *p = alpm_list_getdata(j);
+ list = list_add(list, strdup((char *)alpm_pkg_getinfo(p, PM_PKG_NAME)));
+ }
}
}
if(list) {
@@ -534,11 +540,6 @@ int pacman_sync(list_t *targets)
printf("\n");
FREELIST(list);
FREE(str);
- }*/
- packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
- if(packages == NULL) {
- retval = 0;
- goto cleanup;
}
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
char *pkgname, *pkgver;
@@ -548,8 +549,7 @@ int pacman_sync(list_t *targets)
pkgname = alpm_pkg_getinfo(pkg, PM_PKG_NAME);
pkgver = alpm_pkg_getinfo(pkg, PM_PKG_VERSION);
- MALLOC(str, strlen(pkgname)+strlen(pkgver)+2);
- sprintf(str, "%s-%s", pkgname, pkgver);
+ asprintf(&str, "%s-%s", pkgname, pkgver);
list = list_add(list, str);
totalsize += (int)alpm_pkg_getinfo(pkg, PM_PKG_SIZE);