[pacman-dev] [patch] IV/C

Nagy Gabor ngaba at petra.hos.u-szeged.hu
Sun Apr 22 16:17:58 EDT 2007


Hi!
This should be OK, now:-(
Plz ignore IV/A, IV/B, apply IV first.
----patch IV/C-----
diff -Naur pacman-lib/lib/libalpm/alpm.h pacman-lib.new/lib/libalpm/alpm.h
--- pacman-lib/lib/libalpm/alpm.h	2007-03-19 05:23:45.000000000 +0100
+++ pacman-lib.new/lib/libalpm/alpm.h	2007-04-22 15:28:16.000000000 +0200
@@ -58,6 +58,7 @@
 typedef struct __pmdepend_t pmdepend_t;
 typedef struct __pmdepmissing_t pmdepmissing_t;
 typedef struct __pmconflict_t pmconflict_t;
+typedef struct __pmgraph_t pmgraph_t;
 
 /*
  * Library
diff -Naur pacman-lib/lib/libalpm/deps.c pacman-lib.new/lib/libalpm/deps.c
--- pacman-lib/lib/libalpm/deps.c	2007-04-22 22:09:23.000000000 +0200
+++ pacman-lib.new/lib/libalpm/deps.c	2007-04-22 22:06:11.000000000 +0200
@@ -67,17 +67,6 @@
 	free(graph);
 }
 
-pmgraph_t *_alpm_graph_finduntouched(alpm_list_t *vertices)
-{
-	alpm_list_t *i;
-	pmgraph_t *found = NULL;
-	for (i = vertices; i && !found; i = i->next) {
-		pmgraph_t *vertex = i->data;
-		if (vertex->state == 0) found = vertex;
-	}
-	return(found);
-}
-
 pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
                                   pmdepmod_t depmod, const char *depname,
                                   const char *depversion)
@@ -142,6 +131,7 @@
 	alpm_list_t *newtargs = NULL;
 	alpm_list_t *i, *j, *k;
 	alpm_list_t *vertices = NULL;
+	alpm_list_t *vptr;
 	pmgraph_t *vertex;
 
 	ALPM_LOG_FUNC;
@@ -178,8 +168,10 @@
 		vertex_i->sonptr=vertex_i->sons;
 	}
 
+	vptr = vertices;
 	vertex = vertices->data;
-	while(vertex) {
+
+	while(vptr) {
 		vertex->state = -1; // we touched this vertex
 		int found = 0;
 		while(vertex->sonptr && !found) {
@@ -191,22 +183,21 @@
 				vertex = nextson;
 			}
 			else if(nextson->state == -1) {
-				_alpm_log(PM_LOG_WARNING, _("dependency cycle detected"));
-				/* We add remaining targets */
-				for(i = targets; i; i = i->next)
-					if(!_alpm_pkg_find(alpm_pkg_get_name(i->data), newtargs))
-						newtargs = alpm_list_add(newtargs, i->data);
-				goto cleanup;
+				_alpm_log(PM_LOG_WARNING, _("dependency cycle detected\n"));
 			}
 		}
 		if(!found) {
 			newtargs = alpm_list_add(newtargs, vertex->data);
 			vertex->state = 1; //we leave this vertex
 			vertex = vertex->father;
-			if(!vertex) vertex=_alpm_graph_finduntouched(vertices);
+			if(!vertex) {
+				while(vptr = vptr->next) {
+					vertex = vptr->data;
+					if (vertex->state == 0) break;					
+				}
+			}
 		}
 	}
-cleanup:	
 
 	_alpm_log(PM_LOG_DEBUG, _("sorting dependencies finished"));
 
diff -Naur pacman-lib/lib/libalpm/deps.h pacman-lib.new/lib/libalpm/deps.h
--- pacman-lib/lib/libalpm/deps.h	2007-04-22 22:09:23.000000000 +0200
+++ pacman-lib.new/lib/libalpm/deps.h	2007-04-22 21:27:15.000000000 +0200
@@ -53,7 +53,6 @@
 
 pmgraph_t *_alpm_graph_new(void);
 void _alpm_graph_free(pmgraph_t *graph);
-pmgraph_t *_alpm_graph_finduntouched(alpm_list_t *vertices);
 
 pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
                                   pmdepmod_t depmod, const char *depname,
-----------------------------------
bye, ngaba




More information about the pacman-dev mailing list