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

commit 9f6bccff541f35e3fb08e4dd710b59e433db3397
Author: Michel Hermier <[email protected]>
Date:   Tue Sep 23 15:52:56 2014 +0200

libpacman: Make pmtrans_t::checkconflicts interface simplier.

diff --git a/lib/libpacman/conflict.cpp b/lib/libpacman/conflict.cpp
index a17fb6c..bdeeb3b 100644
--- a/lib/libpacman/conflict.cpp
+++ b/lib/libpacman/conflict.cpp
@@ -51,11 +51,6 @@ using namespace libpacman;
*/
FPtrList pmtrans_t::checkconflicts()
{
-       return checkconflicts(packages());
-}
-
-FPtrList pmtrans_t::checkconflicts(const FList<Package *> &packages)
-{
Package *info = NULL;
FPtrList baddeps;
pmdepmissing_t *miss = NULL;
@@ -67,10 +62,10 @@ FPtrList pmtrans_t::checkconflicts(const FList<Package *> 
&packages)
return baddeps;
}

-       howmany = packages.size();
+       howmany = syncpkgs.size();

-       for(auto i = packages.begin(), end = packages.end(); i != end; ++i) {
-               Package *tp = *i;
+       for(auto i = syncpkgs.begin(), end = syncpkgs.end(); i != end; ++i) {
+               Package *tp = (*i)->pkg_new;
if(tp == NULL) {
continue;
}
@@ -121,8 +116,8 @@ FPtrList pmtrans_t::checkconflicts(const FList<Package *> 
&packages)
}
/* CHECK 2: check targets against targets */
_pacman_log(PM_LOG_DEBUG, _("checkconflicts: targ '%s' vs targs"), tp->name());
-                       for(auto k = packages.begin(), k_end = packages.end(); 
k != k_end; ++k) {
-                               Package *otp = *k;
+                       for(auto k = syncpkgs.begin(), k_end = syncpkgs.end(); 
k != k_end; ++k) {
+                               Package *otp = (*k)->pkg_new;
if(!strcmp(otp->name(), tp->name())) {
/* a package cannot conflict with itself -- that's just not nice */
continue;
@@ -162,8 +157,8 @@ FPtrList pmtrans_t::checkconflicts(const FList<Package *> 
&packages)
/* If this package (*info) is also in our packages FPtrList, use the
* conflicts list from the new package, not the old one (*info)
*/
-                       for(auto j = packages.begin(), j_end = packages.end(); 
j != j_end; ++j) {
-                               Package *pkg = *j;
+                       for(auto j = syncpkgs.begin(), j_end = syncpkgs.end(); 
j != j_end; ++j) {
+                               Package *pkg = (*j)->pkg_new;
if(!strcmp(pkg->name(), info->name())) {
/* Use the new, to-be-installed package's conflicts */
conflicts = &pkg->conflicts();
diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp
index 74976be..b70a9a9 100644
--- a/lib/libpacman/trans.cpp
+++ b/lib/libpacman/trans.cpp
@@ -535,7 +535,7 @@ int __pmtrans_t::prepare(FPtrList **data)
EVENT(this, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);

_pacman_log(PM_LOG_FLOW1, _("looking for conflicts"));
-               deps = checkconflicts(list);
+               deps = checkconflicts();
if(!deps.empty()) {
int errorout = 0;
FStringList asked;
diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h
index f6f5f46..f6f41aa 100644
--- a/lib/libpacman/trans.h
+++ b/lib/libpacman/trans.h
@@ -69,7 +69,6 @@ struct __pmtrans_t
int add(const char *target, pmtranstype_t type, int flags, pmsyncpkg_t 
**syncpkg = NULL);

FPtrList checkconflicts();
-       FPtrList checkconflicts(const FList<libpacman::Package *> &packages);
FPtrList checkdeps(unsigned char op);
FPtrList find_conflicts();
void removedeps();
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to