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

commit 4526c6cc4d3e3d8060ee890b3161946f2cc83b19
Author: Michel Hermier <[email protected]>
Date:   Fri Apr 26 10:37:40 2013 +0200

libpacman: loop over the whole checkdeps instead of looping by type 
(preparation to transform to pmtranspkg_t).

diff --git a/lib/libpacman/deps.c b/lib/libpacman/deps.c
index 43fdc00..e91aac1 100644
--- a/lib/libpacman/deps.c
+++ b/lib/libpacman/deps.c
@@ -218,17 +218,17 @@ pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned 
char op, pmlist_t *packag
return(NULL);
}

+       for (i = packages; i; i = i->next) {
+               pmpkg_t *tp = i->data;
+               if(tp == NULL) {
+                       continue;
+               }

-       if(op == PM_TRANS_TYPE_UPGRADE) {
-               /* PM_TRANS_TYPE_UPGRADE handles the backwards dependencies, 
ie, the packages
-                * listed in the requiredby field.
-                */
-               for(i = packages; i; i = i->next) {
-                       pmpkg_t *tp = i->data;
+               if(op == PM_TRANS_TYPE_UPGRADE) {
+                       /* PM_TRANS_TYPE_UPGRADE handles the backwards 
dependencies, ie, the packages
+                        * listed in the requiredby field.
+                        */
pmpkg_t *oldpkg;
-                       if(tp == NULL) {
-                               continue;
-                       }

if((oldpkg = _pacman_db_get_pkgfromcache(db, tp->name)) == NULL) {
continue;
@@ -262,15 +262,8 @@ pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned 
char op, pmlist_t *packag
}
}
}
-       }
-       if(op == PM_TRANS_TYPE_ADD || op == PM_TRANS_TYPE_UPGRADE) {
-               /* DEPENDENCIES -- look for unsatisfied dependencies */
-               for(i = packages; i; i = i->next) {
-                       pmpkg_t *tp = i->data;
-                       if(tp == NULL) {
-                               continue;
-                       }
-
+               if(op == PM_TRANS_TYPE_ADD || op == PM_TRANS_TYPE_UPGRADE) {
+                       /* DEPENDENCIES -- look for unsatisfied dependencies */
for(j = _pacman_pkg_getinfo(tp, PM_PKG_DEPENDS); j; j = j->next) {
/* split into name/version pairs */
_pacman_splitdep((char *)j->data, &depend);
@@ -396,15 +389,8 @@ pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned 
char op, pmlist_t *packag
}
}
}
-               }
-       } else if(op == PM_TRANS_TYPE_REMOVE) {
-               /* check requiredby fields */
-               for(i = packages; i; i = i->next) {
-                       pmpkg_t *tp = i->data;
-                       if(tp == NULL) {
-                               continue;
-                       }
-
+               } else if(op == PM_TRANS_TYPE_REMOVE) {
+                       /* check requiredby fields */
found=0;
for(j = _pacman_pkg_getinfo(tp, PM_PKG_REQUIREDBY); j; j = j->next) {
if(!_pacman_strlist_find(packages, (char *)j->data)) {
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to