From 2a3968b8bc27ee10fddd1d5492d010f1af2d486d Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 20 Apr 2005 20:49:39 +0000 Subject: display the list of targets to be removed before trans_commit() call --- src/pacman/sync.c | 30 +++++++++++++++--------------- 1 file 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); -- cgit v1.2.3-2-g168b