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

commit b7b566f33890935c98309a9bc2ca347836f93e94
Author: Michel Hermier <[email protected]>
Date:   Sat May 4 13:50:58 2013 +0200

libpacman: Remove trail to resolvedeps.

diff --git a/lib/libpacman/deps.c b/lib/libpacman/deps.c
index 6fd986d..841d274 100644
--- a/lib/libpacman/deps.c
+++ b/lib/libpacman/deps.c
@@ -261,7 +261,7 @@ void _pacman_sortbydeps(pmtrans_t *trans, int mode)
int found;

if (trans->_packages == NULL) {
-               return(NULL);
+               return;
}

_pacman_log(PM_LOG_DEBUG, _("started sorting dependencies"));
@@ -532,8 +532,7 @@ void _pacman_removedeps(pmtrans_t *trans)
*
* make sure *trail are already initialized
*/
-int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg,
-                      pmlist_t *trail, pmlist_t **data)
+int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg, pmlist_t **data)
{
pmlist_t *i, *j;
pmlist_t *targ;
@@ -597,14 +596,12 @@ int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t 
*syncpkg,
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
}
-               if(_pacman_pkg_isin(ps->name, trans->_packages)) {
+               if (__pacman_trans_get_trans_pkg (trans, ps->name) != NULL) {
/* this dep is already in the target list */
_pacman_log(PM_LOG_DEBUG, _("dependency %s is already in the target list -- 
skipping"),
ps->name);
continue;
-               }
-
-               if(!_pacman_pkg_isin(ps->name, trail)) {
+               } else {
/* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in
* something we're not supposed to.
*/
@@ -615,13 +612,12 @@ int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t 
*syncpkg,
FREEPKG(dummypkg);
}
if(usedep) {
-                               trail = _pacman_list_add(trail, ps);
-                               if(_pacman_resolvedeps(trans, ps, trail, data)) 
{
-                                       goto error;
-                               }
_pacman_log(PM_LOG_DEBUG, _("pulling dependency %s (needed by %s)"),
ps->name, syncpkg->name);
-                               trans->_packages = 
_pacman_list_add(trans->_packages, ps);
+                               _pacman_trans_add_pkg (trans, ps, 
PM_TRANS_TYPE_UPGRADE, 0);
+                               if(_pacman_resolvedeps(trans, ps, data)) {
+                                       goto error;
+                               }
} else {
_pacman_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\""), 
miss->target);
if(data) {
@@ -635,9 +631,6 @@ int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg,
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
}
-               } else {
-                       /* cycle detected -- skip it */
-                       _pacman_log(PM_LOG_DEBUG, _("dependency cycle detected: 
%s"), ps->name);
}
}

diff --git a/lib/libpacman/deps.h b/lib/libpacman/deps.h
index cc411cf..2d1b558 100644
--- a/lib/libpacman/deps.h
+++ b/lib/libpacman/deps.h
@@ -53,8 +53,7 @@ void _pacman_sortbydeps(pmtrans_t *trans, int mode);
pmlist_t *_pacman_checkdeps(pmtrans_t *trans, unsigned char op, pmlist_t 
*packages);
int _pacman_splitdep(const char *depstr, pmdepend_t *depend);
void _pacman_removedeps(pmtrans_t *trans);
-int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg,
-                pmlist_t *trail, pmlist_t **data);
+int _pacman_resolvedeps(pmtrans_t *trans, pmpkg_t *syncpkg, pmlist_t **data);

#endif /* _PACMAN_DEPS_H */

diff --git a/lib/libpacman/trans.c b/lib/libpacman/trans.c
index ac6c8e9..064b140 100644
--- a/lib/libpacman/trans.c
+++ b/lib/libpacman/trans.c
@@ -568,7 +568,6 @@ static
int _pacman_sync_prepare (pmtrans_t *trans, pmlist_t **data)
{
pmlist_t *deps = NULL;
-       pmlist_t *trail = NULL; /* breadcrum list to avoid running into circles 
*/
pmlist_t *asked = NULL;
pmlist_t *i, *j, *k, *l, *m;
int ret = 0;
@@ -582,14 +581,12 @@ int _pacman_sync_prepare (pmtrans_t *trans, pmlist_t 
**data)
}

if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
-               trail = f_list_new();
-
/* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
_pacman_log(PM_LOG_FLOW1, _("resolving targets dependencies"));
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg_new;
-                       if (_pacman_resolvedeps (trans, spkg, trail, data) == 
-1) {
+                       if (_pacman_resolvedeps (trans, spkg, data) == -1) {
/* pm_errno is set by resolvedeps */
ret = -1;
goto cleanup;
@@ -625,8 +622,6 @@ int _pacman_sync_prepare (pmtrans_t *trans, pmlist_t **data)
ret = -1;
goto cleanup;
}
-
-               FREELISTPTR(trail);
}

if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) {
@@ -897,7 +892,6 @@ int _pacman_sync_prepare (pmtrans_t *trans, pmlist_t **data)
check_olddelay();

cleanup:
-       FREELISTPTR(trail);
FREELIST(asked);

return(ret);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to