[pacman-dev] [PATCH] Ensure pre_upgrade scriptlet gets old package version

Dan McGee dan at archlinux.org
Fri May 4 12:42:23 EDT 2012


This was accidentally broken in the refactor done in commit 73139ccb.

Fixes FS#29371.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/add.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 6c2f0cb..c49d99b 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -488,8 +488,9 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 	if(alpm_pkg_has_scriptlet(newpkg) &&
 			!(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
 		const char *scriptlet_name = is_upgrade ? "pre_upgrade" : "pre_install";
-		_alpm_runscriptlet(handle, pkgfile,
-				scriptlet_name, newpkg->version, NULL, 1);
+
+		_alpm_runscriptlet(handle, pkgfile, scriptlet_name,
+				newpkg->version, oldpkg ? oldpkg->version : NULL, 1);
 	}
 
 	/* we override any pre-set reason if we have alldeps or allexplicit set */
-- 
1.7.10.1



More information about the pacman-dev mailing list