Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=eef25018839d7141f7a4beaf3d45eb0b19dafc1a
commit eef25018839d7141f7a4beaf3d45eb0b19dafc1a Author: Michel Hermier <[email protected]> Date: Mon Sep 22 10:58:23 2014 +0200 libpacman: Add pmtrans_t::packages() which allways construct a new package list compatible with the old code. diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp index 6feb61d..319ea9c 100644 --- a/lib/libpacman/trans.cpp +++ b/lib/libpacman/trans.cpp @@ -828,18 +828,7 @@ cleanup: } } else { - m_packages.clear(); - for(auto i = syncpkgs.begin(), end = syncpkgs.end(); i != end; ++i) { - pmsyncpkg_t *syncpkg = *i; - switch(syncpkg->type) { - case PM_TRANS_TYPE_ADD: - case PM_TRANS_TYPE_UPGRADE: - m_packages.add(syncpkg->pkg_new); - break; - case PM_TRANS_TYPE_REMOVE: - m_packages.add(syncpkg->pkg_local); - } - } + m_packages = packages(); if(!(flags & PM_TRANS_FLAG_NODEPS)) { /* Check dependencies @@ -1900,4 +1889,22 @@ bool __pmtrans_t::empty() const return syncpkgs.empty(); } +FList<Package *> pmtrans_t::packages() const +{ + FList<Package *> ret; + + for(auto i = syncpkgs.begin(), end = syncpkgs.end(); i != end; ++i) { + pmsyncpkg_t *syncpkg = *i; + switch(syncpkg->type) { + case PM_TRANS_TYPE_ADD: + case PM_TRANS_TYPE_UPGRADE: + ret.add(syncpkg->pkg_new); + break; + case PM_TRANS_TYPE_REMOVE: + ret.add(syncpkg->pkg_local); + } + } + return ret; +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h index 9ff664a..7f7bfff 100644 --- a/lib/libpacman/trans.h +++ b/lib/libpacman/trans.h @@ -71,6 +71,9 @@ struct __pmtrans_t FPtrList find_conflicts(); int resolvedeps(libpacman::Package *syncpkg, FList<libpacman::Package *> &list, FList<libpacman::Package *> &trail, FPtrList **data); + /* Compatibility */ + FList<libpacman::Package *> packages() const; + /* Capacity */ bool empty() const; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
