Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=b1f145458310b44069e0dee4c5edee9899248819

commit b1f145458310b44069e0dee4c5edee9899248819
Author: Michel Hermier <[email protected]>
Date:   Mon Sep 22 10:30:48 2014 +0200

libpacman: Make _pacman_db_find_conflicts part of pmtrans_t::members.

diff --git a/lib/libpacman/conflict.cpp b/lib/libpacman/conflict.cpp
index 90fa10a..f2bd57a 100644
--- a/lib/libpacman/conflict.cpp
+++ b/lib/libpacman/conflict.cpp
@@ -231,7 +231,7 @@ static FStringList chk_fileconflicts(const FStringList 
&filesA, const FStringLis
return ret;
}

-FPtrList _pacman_db_find_conflicts(pmtrans_t *trans)
+FPtrList pmtrans_t::find_conflicts()
{
char path[PATH_MAX+1];
struct stat buf;
@@ -239,20 +239,20 @@ FPtrList _pacman_db_find_conflicts(pmtrans_t *trans)
Package *p, *dbpkg;
double percent;
int howmany, remain;
-       Database *db_local = trans->m_handle->db_local;
-       const char *root = trans->m_handle->root;
+       Database *db_local = m_handle->db_local;
+       const char *root = m_handle->root;

-       if(db_local == NULL || trans->empty() || root == NULL) {
+       if(db_local == NULL || empty() || root == NULL) {
return conflicts;
}
-       howmany = trans->packages.size();
+       howmany = packages.size();

/* CHECK 1: check every target against every target */
-       for(auto i = trans->packages.begin(), end = trans->packages.end(); i != 
end; ++i) {
+       for(auto i = packages.begin(), end = packages.end(); i != end; ++i) {
Package *p1 = (Package*)*i;
remain = flib::count(i, end);
percent = (double)(howmany - remain + 1) / howmany;
-               PROGRESS(trans, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent 
* 100), howmany, howmany - remain + 1);
+               PROGRESS(this, PM_TRANS_PROGRESS_CONFLICTS_START, "", (percent 
* 100), howmany, howmany - remain + 1);
for(auto j = i; j != end; ++j) {
Package *p2 = (Package*)*j;
if(strcmp(p1->name(), p2->name())) {
@@ -303,8 +303,8 @@ FPtrList _pacman_db_find_conflicts(pmtrans_t *trans)
/* Check if the conflicting file has been moved to another package/target */
if(!ok) {
/* Look at all the targets */
-                                               for(auto k = 
trans->packages.begin(), k_end = trans->packages.end(); k != k_end && !ok; ++k) 
{
-                                                       Package *p2 = (Package 
*)*k;
+                                               for(auto k = packages.begin(), 
k_end = packages.end(); k != k_end && !ok; ++k) {
+                                                       Package *p2 = *k;
/* As long as they're not the current package */
if(strcmp(p2->name(), p->name())) {
Package *dbpkg2 = NULL;
@@ -332,7 +332,7 @@ FPtrList _pacman_db_find_conflicts(pmtrans_t *trans)
* Our workaround is to scan through all "old" packages and all "new"
* ones, looking for files that jump to different packages.
*/
-                                                                       
trans->skiplist.add(filestr);
+                                                                       
skiplist.add(filestr);
}
}
}
diff --git a/lib/libpacman/conflict.h b/lib/libpacman/conflict.h
index d62b6e0..6b3ddd5 100644
--- a/lib/libpacman/conflict.h
+++ b/lib/libpacman/conflict.h
@@ -34,7 +34,6 @@ struct __pmconflict_t {
};

FPtrList _pacman_checkconflicts(pmtrans_t *trans, const 
FList<libpacman::Package *> &packages);
-FPtrList _pacman_db_find_conflicts(pmtrans_t *trans);

#endif /* _PACMAN_CONFLICT_H */

diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp
index 9b9e15d..269b5dd 100644
--- a/lib/libpacman/trans.cpp
+++ b/lib/libpacman/trans.cpp
@@ -928,7 +928,7 @@ cleanup:
EVENT(this, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);

_pacman_log(PM_LOG_FLOW1, _("looking for file conflicts"));
-                       lp = _pacman_db_find_conflicts(this);
+                       lp = find_conflicts();
if(!lp.empty()) {
if(data) {
lp.swap(**data);
diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h
index d0d7b2c..c353e69 100644
--- a/lib/libpacman/trans.h
+++ b/lib/libpacman/trans.h
@@ -68,6 +68,7 @@ struct __pmtrans_t
int add(const char *target, pmtranstype_t type, int flags, pmsyncpkg_t 
**syncpkg = NULL);

FPtrList checkdeps(unsigned char op, const FList<libpacman::Package *> 
&packages);
+       FPtrList find_conflicts();
int resolvedeps(libpacman::Package *syncpkg, FList<libpacman::Package *> &list, 
FList<libpacman::Package *> &trail, FPtrList **data);

/* Capacity */
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to