diff options
author | Dan McGee <dan@archlinux.org> | 2011-09-28 11:43:23 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-09-30 17:55:58 +0200 |
commit | 39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c (patch) | |
tree | e390376bfdc7818a7f5a21a3797be2cc951d7de8 /lib/libalpm/remove.c | |
parent | 73139ccb3c47ed1ebb1a62a27deb080b66d92bf4 (diff) | |
download | pacman-39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c.tar.gz pacman-39b0ac43fcbe35897f616a8e202ae9f3bcb1ee5c.tar.xz |
Revamp scriptlet path formation for scriptlets in local database
Expose the current static get_pkgpath() function internally to the rest
of the library as _alpm_local_db_pkgpath(). This allows use of this
convenience function in add.c and remove.c when forming the path to the
scriptlet location.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r-- | lib/libalpm/remove.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 7f917faa..44f3ee93 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -359,7 +359,6 @@ int _alpm_remove_single_package(alpm_handle_t *handle, const char *pkgname = oldpkg->name; const char *pkgver = oldpkg->version; alpm_filelist_t *filelist; - char scriptlet[PATH_MAX]; size_t i; if(newpkg) { @@ -370,13 +369,13 @@ int _alpm_remove_single_package(alpm_handle_t *handle, _alpm_log(handle, ALPM_LOG_DEBUG, "removing package %s-%s\n", pkgname, pkgver); - snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", - _alpm_db_path(handle->db_local), pkgname, pkgver); - /* run the pre-remove scriptlet if it exists */ if(alpm_pkg_has_scriptlet(oldpkg) && !(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) { + char *scriptlet = _alpm_local_db_pkgpath(handle->db_local, + oldpkg, "install"); _alpm_runscriptlet(handle, scriptlet, "pre_remove", pkgver, NULL, 0); + free(scriptlet); } } @@ -453,7 +452,10 @@ int _alpm_remove_single_package(alpm_handle_t *handle, /* run the post-remove script if it exists */ if(alpm_pkg_has_scriptlet(oldpkg) && !(handle->trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) { + char *scriptlet = _alpm_local_db_pkgpath(handle->db_local, + oldpkg, "install"); _alpm_runscriptlet(handle, scriptlet, "post_remove", pkgver, NULL, 0); + free(scriptlet); } } |