From aefb4e0fa54ad5b4140d6991f389b5a6fb4ead6d Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Sat, 7 Mar 2009 19:44:34 +0100
Subject: Remove pmsyncpkg_t

pmsyncpkg_t data sructure was removed:
1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target
packages come from sync repos, so we can use this field without any
problems. Upgrade transaction also uses this field to store this info.)
2. pmsyncpkg_t.removes was moved to pmpkg_t.removes.
This step requires careful programming, because we don't duplicate packages
when we add them to trans->packages. So we modify sync pkgcache when we
add this transaction-only info to our package. Hence it is important to
free this list when we remove any package from the target list
(remove_unresolvable, remove_conflicts, trans_free), otherwise this could
confuse the new sync transactions (with non-pacman GUI).

Overall, our code became ~100 line shorter, and we can call our helper
functions directly on trans->packages in sync.c, we don't need to maintain
parallel package lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
---
 src/pacman/sync.c | 2 +-
 src/pacman/util.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

(limited to 'src')

diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 0e193551..68fb81a9 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -673,7 +673,7 @@ static int sync_trans(alpm_list_t *targets)
 		/* 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));
+			pmpkg_t *pkg = 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));
 		}
diff --git a/src/pacman/util.c b/src/pacman/util.c
index b80b09ad..a2802527 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -579,7 +579,7 @@ void display_targets(const alpm_list_t *pkgs, int install)
 }
 
 /* Display a list of transaction targets.
- * `pkgs` should be a list of pmsyncpkg_t's,
+ * `pkgs` should be a list of pmpkg_t's,
  * retrieved from a transaction object
  */
 void display_synctargets(const alpm_list_t *syncpkgs)
@@ -588,13 +588,12 @@ void display_synctargets(const alpm_list_t *syncpkgs)
 	alpm_list_t *pkglist = NULL, *rpkglist = NULL;
 
 	for(i = syncpkgs; i; i = alpm_list_next(i)) {
-		pmsyncpkg_t *sync = alpm_list_getdata(i);
-		pmpkg_t *pkg = alpm_sync_get_pkg(sync);
+		pmpkg_t *pkg = alpm_list_getdata(i);
 		pkglist = alpm_list_add(pkglist, pkg);
 
 		/* The removes member contains a list of packages to be removed
 		 * due to the package that is being installed. */
-		alpm_list_t *to_replace = alpm_sync_get_removes(sync);
+		alpm_list_t *to_replace = alpm_pkg_get_removes(pkg);
 
 		for(j = to_replace; j; j = alpm_list_next(j)) {
 			pmpkg_t *rp = alpm_list_getdata(j);
-- 
cgit v1.2.3-70-g09d2