[pacman-dev] [PATCH] Pass the old package with PM_TRANS_EVT_UPGRADE_START

Nagy Gabor ngaba at bibl.u-szeged.hu
Wed Jul 30 17:41:56 EDT 2008


From 84218a43d0a455a29b9312d43270ddf8bb78600d Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Wed, 30 Jul 2008 23:36:46 +0200
Subject: [PATCH] Pass the old package with PM_TRANS_EVT_UPGRADE_START

This is more rational and coherent with PM_TRANS_EVT_UPGRADE_DONE.

Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
 lib/libalpm/add.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 72ea70c..46a511c 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -650,14 +650,15 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
 	if(local) {
 		is_upgrade = 1;
 
-		EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, NULL);
+		/* we'll need to save some record for backup checks later */
+		oldpkg = _alpm_pkg_dup(local);
+
+		EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg);
 		_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n",
 				newpkg->name, newpkg->version);
 
-		/* we'll need to save some record for backup checks later */
-		oldpkg = _alpm_pkg_dup(local);
 		/* copy over the install reason */
-		newpkg->reason = alpm_pkg_get_reason(local);
+		newpkg->reason = alpm_pkg_get_reason(oldpkg);
 
 		/* pre_upgrade scriptlet */
 		if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
-- 
1.5.6.4





More information about the pacman-dev mailing list