[pacman-dev] [patch] PM_TRANS_TYPE_UPGRADERM + "no ldconfig after upgrade" bugfix

Nagy Gabor ngaba at petra.hos.u-szeged.hu
Tue Apr 10 15:36:33 EDT 2007


Hi!
Here is my patch, plz test it. A note: now ldconfig doesn't run in case
of upgrade (why?). This is not safe imho, so you I fixed this in my
patch too.
----------------------
 	}
 
 	/* run ldconfig if it exists */
-	if((trans->type != PM_TRANS_TYPE_UPGRADE) && (handle->trans->state != STATE_INTERRUPTED)) {
+	if((trans->type != PM_TRANS_TYPE_UPGRADERM) && (handle->trans->state != STATE_INTERRUPTED)) {
 		_alpm_log(PM_LOG_DEBUG, _("running \"ldconfig -r %s\""), handle->root);
 		_alpm_ldconfig(handle->root);
 	}
diff -Naur pacman-lib/lib/libalpm/trans.c pacman-lib.new/lib/libalpm/trans.c
--- pacman-lib/lib/libalpm/trans.c	2007-04-04 06:43:24.000000000 +0200
+++ pacman-lib.new/lib/libalpm/trans.c	2007-04-10 21:21:07.000000000 +0200
@@ -148,6 +148,7 @@
 			}
 		break;
 		case PM_TRANS_TYPE_REMOVE:
+		case PM_TRANS_TYPE_UPGRADERM:
 			if(_alpm_remove_loadtarget(trans, handle->db_local, target) == -1) {
 				/* pm_errno is set by remove_loadtarget() */
 				return(-1);
@@ -189,6 +190,7 @@
 			}
 		break;
 		case PM_TRANS_TYPE_REMOVE:
+		case PM_TRANS_TYPE_UPGRADERM:
 			if(_alpm_remove_prepare(trans, handle->db_local, data) == -1) {
 				/* pm_errno is set by _alpm_remove_prepare() */
 				return(-1);
@@ -233,6 +235,7 @@
 			}
 		break;
 		case PM_TRANS_TYPE_REMOVE:
+		case PM_TRANS_TYPE_UPGRADERM:
 			if(_alpm_remove_commit(trans, handle->db_local) == -1) {
 				/* pm_errno is set by _alpm_remove_prepare() */
 				return(-1);
@@ -310,16 +313,16 @@
 
 				_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"),
 				          alpm_pkg_get_name(deppkg));
-				if(trans->type == PM_TRANS_TYPE_REMOVE) {
+				if(trans->type == PM_TRANS_TYPE_REMOVE || trans->type == PM_TRANS_TYPE_UPGRADERM) {
 					void *data = NULL;
 					rqdby = alpm_list_remove(rqdby,	pkgname, _alpm_str_cmp, &data);
 					FREE(data);
 					deppkg->requiredby = rqdby;
 				} else {
-					if(!alpm_list_find_str(rqdby, pkgname)) {
+//					if(!alpm_list_find_str(rqdby, pkgname)) {
 						rqdby = alpm_list_add(rqdby, strdup(pkgname));
 						deppkg->requiredby = rqdby;
-					}
+//					}
 				}
 
 				if(_alpm_db_write(localdb, deppkg, INFRQ_DEPENDS)) {
@@ -340,16 +343,16 @@
 
 		_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"),
 		          alpm_pkg_get_name(deppkg));
-		if(trans->type == PM_TRANS_TYPE_REMOVE) {
+		if(trans->type == PM_TRANS_TYPE_REMOVE || trans->type == PM_TRANS_TYPE_UPGRADERM) {
 			void *data = NULL;
 			rqdby = alpm_list_remove(rqdby, pkgname, _alpm_str_cmp, &data);
 			FREE(data);
 			deppkg->requiredby = rqdby;
 		} else {
-			if(!alpm_list_find_str(rqdby, pkgname)) {
+//			if(!alpm_list_find_str(rqdby, pkgname)) {
 				rqdby = alpm_list_add(rqdby, strdup(pkgname));
 				deppkg->requiredby = rqdby;
-			}
+//			}
 		}
 
 		if(_alpm_db_write(localdb, deppkg, INFRQ_DEPENDS)) {
-----------------------------
Bye, ngaba




More information about the pacman-dev mailing list