[pacman-dev] [PATCH] New PM_TRANS_EVT_LDCONFIG events

Nagy Gabor ngaba at bibl.u-szeged.hu
Thu Jul 17 06:22:03 EDT 2008


From 49899f082d6ccd52dc8164a5856353dd2a12ee20 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Thu, 17 Jul 2008 12:15:29 +0200
Subject: [PATCH] New PM_TRANS_EVT_LDCONFIG events

User will see "running ldconfig..." message.

Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
 lib/libalpm/add.c     |    2 ++
 lib/libalpm/alpm.h    |    4 ++++
 lib/libalpm/remove.c  |    2 ++
 src/pacman/callback.c |    6 +++++-
 4 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 3b60fb3..12a315d 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -873,8 +873,10 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
 	}
 
 	/* run ldconfig if it exists */
+	EVENT(trans, PM_TRANS_EVT_LDCONFIG_START, NULL, NULL);
 	_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"\n", handle->root);
 	_alpm_ldconfig(handle->root);
+	EVENT(trans, PM_TRANS_EVT_LDCONFIG_DONE, NULL, NULL);
 
 	return(0);
 }
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index fbef057..c61533a 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -338,6 +338,10 @@ typedef enum _pmtransevt_t {
 	 * to the callback, respectively.
 	 */
 	PM_TRANS_EVT_UPGRADE_DONE,
+        /** ldconfig will run */
+	PM_TRANS_EVT_LDCONFIG_START,
+	/** ldconfig ran */
+	PM_TRANS_EVT_LDCONFIG_DONE,
 	/** Target package's integrity will be checked. */
 	PM_TRANS_EVT_INTEGRITY_START,
 	/** Target package's integrity was checked. */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 864fafa..a5ee3f0 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -404,8 +404,10 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
 
 	/* run ldconfig if it exists */
 	if(trans->type != PM_TRANS_TYPE_REMOVEUPGRADE) {
+		EVENT(trans, PM_TRANS_EVT_LDCONFIG_START, NULL, NULL);
 		_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"\n", handle->root);
 		_alpm_ldconfig(handle->root);
+		EVENT(trans, PM_TRANS_EVT_LDCONFIG_DONE, NULL, NULL);
 	}
 
 	return(0);
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index f968873..3bcf55e 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -159,7 +159,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
 {
 	switch(event) {
 		case PM_TRANS_EVT_CHECKDEPS_START:
-		  printf(_("checking dependencies...\n"));
+			printf(_("checking dependencies...\n"));
 			break;
 		case PM_TRANS_EVT_FILECONFLICTS_START:
 			if(config->noprogressbar) {
@@ -230,6 +230,9 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
 		case PM_TRANS_EVT_RETRIEVE_START:
 			printf(_(":: Retrieving packages from %s...\n"), (char*)data1);
 			break;
+		case PM_TRANS_EVT_LDCONFIG_START:
+ 			printf(_("running ldconfig...\n"));
+			break;
 		/* all the simple done events, with fallthrough for each */
 		case PM_TRANS_EVT_FILECONFLICTS_DONE:
 		case PM_TRANS_EVT_CHECKDEPS_DONE:
@@ -238,6 +241,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
 		case PM_TRANS_EVT_INTEGRITY_DONE:
 		case PM_TRANS_EVT_DELTA_INTEGRITY_DONE:
 		case PM_TRANS_EVT_DELTA_PATCHES_DONE:
+		case PM_TRANS_EVT_LDCONFIG_DONE:
 			/* nothing */
 			break;
 	}
-- 
1.5.6.3





More information about the pacman-dev mailing list