Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=499d4cab974d5c5663bfae01fce18e5d526801d1
commit 499d4cab974d5c5663bfae01fce18e5d526801d1 Author: Michel Hermier <[email protected]> Date: Tue Sep 23 08:20:40 2014 +0200 libpacman: Remove a bunch m_packages usage. diff --git a/lib/libpacman/conflict.cpp b/lib/libpacman/conflict.cpp index 6b8ef30..a17fb6c 100644 --- a/lib/libpacman/conflict.cpp +++ b/lib/libpacman/conflict.cpp @@ -250,16 +250,16 @@ FPtrList pmtrans_t::find_conflicts() if(db_local == NULL || empty() || root == NULL) { return conflicts; } - howmany = m_packages.size(); + howmany = syncpkgs.size(); /* CHECK 1: check every target against every target */ - for(auto i = m_packages.begin(), end = m_packages.end(); i != end; ++i) { - Package *p1 = *i; + for(auto i = syncpkgs.begin(), end = syncpkgs.end(); i != end; ++i) { + Package *p1 = (*i)->pkg_new; remain = flib::count(i, end); percent = (double)(howmany - remain + 1) / howmany; PROGRESS(this, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent * 100), howmany, howmany - remain + 1); for(auto j = i; j != end; ++j) { - Package *p2 = *j; + Package *p2 = (*j)->pkg_new; if(strcmp(p1->name(), p2->name())) { auto ret = chk_fileconflicts(p1->files(), p2->files()); for(auto k = ret.begin(), k_end = ret.end(); k != k_end; ++k) { @@ -277,7 +277,7 @@ FPtrList pmtrans_t::find_conflicts() } /* CHECK 2: check every target against the filesystem */ - p = *i; + p = (*i)->pkg_new; dbpkg = NULL; auto &files = p->files(); for(auto j = files.begin(), j_end = files.end(); j != j_end; ++j) { diff --git a/lib/libpacman/deps.cpp b/lib/libpacman/deps.cpp index 84a125b..63fcbd0 100644 --- a/lib/libpacman/deps.cpp +++ b/lib/libpacman/deps.cpp @@ -402,13 +402,12 @@ out: */ void pmtrans_t::removedeps() { - FList<Package *> &targs = m_packages; Database *db = m_handle->db_local; bool again = false; - for(auto i = targs.begin(), end = targs.end(); i != end; i = again ? targs.begin() : i.next()) { + for(auto i = syncpkgs.begin(), end = syncpkgs.end(); i != end; i = again ? syncpkgs.begin() : i.next()) { again = false; - auto &depends = (*i)->depends(); + auto &depends = (*i)->pkg_local->depends(); for(auto j = depends.begin(), j_end = depends.end(); j != j_end; ++j) { pmdepend_t depend; Package *dep; @@ -433,7 +432,7 @@ void pmtrans_t::removedeps() continue; } } - if(_pacman_pkg_isin(dep->name(), targs)) { + if(find(dep->name())) { continue; } @@ -447,24 +446,18 @@ void pmtrans_t::removedeps() auto &requiredby = dep->requiredby(); for(auto k = requiredby.begin(), k_end = requiredby.end(); k != k_end && !needed; ++k) { Package *dummy = db->find((const char *)*k); - if(!_pacman_pkg_isin(dummy->name(), targs)) { + if(!find(dummy->name())) { needed = 1; } } if(!needed) { - Package *pkg = new Package(dep->name(), dep->version()); - if(pkg == NULL) { - continue; - } /* add it to the target list */ - _pacman_log(PM_LOG_DEBUG, _("loading ALL info for '%s'"), pkg->name()); - pkg->read(INFRQ_ALL); - targs.add(pkg); - _pacman_log(PM_LOG_FLOW2, _("adding '%s' to the targets"), pkg->name()); + add(dep->name(), PM_TRANS_TYPE_REMOVE, 0); again = true; } } } + m_packages = packages(); } /* populates *list with packages that need to be installed to satisfy all diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp index 55c18f8..34259ba 100644 --- a/lib/libpacman/trans.cpp +++ b/lib/libpacman/trans.cpp @@ -1727,7 +1727,7 @@ int __pmtrans_t::commit(FPtrList **data) * its requiredby info: it is in the process of being removed (if not * already done!) */ - if(_pacman_pkg_isin(depend.name, m_packages)) { + if(find(depend.name)) { continue; } depinfo = db_local->find(depend.name); _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
