From aefb4e0fa54ad5b4140d6991f389b5a6fb4ead6d Mon Sep 17 00:00:00 2001 From: Nagy Gabor 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 Signed-off-by: Dan McGee --- lib/libalpm/package.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index ee0ff6f5..b63b5ec0 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -422,6 +422,13 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) return pkg->backup; } +alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg) +{ + ASSERT(pkg != NULL, return(NULL)); + + return(pkg->removes); +} + pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg) { /* Sanity checks */ @@ -842,6 +849,7 @@ void _alpm_pkg_free(pmpkg_t *pkg) alpm_list_free_inner(pkg->deltas, (alpm_list_fn_free)_alpm_delta_free); alpm_list_free(pkg->deltas); alpm_list_free(pkg->delta_path); + alpm_list_free(pkg->removes); if(pkg->origin == PKG_FROM_FILE) { FREE(pkg->origin_data.file); -- cgit v1.2.3-54-g00ecf