diff options
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r-- | lib/libalpm/remove.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 22ae2bb8..2d840ceb 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -26,8 +26,6 @@ #include <stdlib.h> #include <errno.h> -#include <time.h> -#include <fcntl.h> #include <string.h> #include <limits.h> #include <unistd.h> @@ -36,6 +34,7 @@ /* libalpm */ #include "remove.h" #include "alpm_list.h" +#include "alpm.h" #include "trans.h" #include "util.h" #include "log.h" @@ -44,7 +43,6 @@ #include "db.h" #include "deps.h" #include "handle.h" -#include "alpm.h" int SYMEXPORT alpm_remove_pkg(pmpkg_t *pkg) { @@ -61,15 +59,16 @@ int SYMEXPORT alpm_remove_pkg(pmpkg_t *pkg) ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); - pkgname = alpm_pkg_get_name(pkg); + pkgname = pkg->name; if(_alpm_pkg_find(trans->remove, pkgname)) { RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } - _alpm_log(PM_LOG_DEBUG, "adding %s in the target list\n", pkgname); + _alpm_log(PM_LOG_DEBUG, "adding package %s to the transaction remove list\n", + pkgname); trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(pkg)); - return(0); + return 0; } static void remove_prepare_cascade(pmtrans_t *trans, pmdb_t *db, @@ -160,7 +159,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) if(trans->flags & PM_TRANS_FLAG_CASCADE) { remove_prepare_cascade(trans, db, lp); - } else if (trans->flags & PM_TRANS_FLAG_UNNEEDED) { + } else if(trans->flags & PM_TRANS_FLAG_UNNEEDED) { /* Remove needed packages (which would break dependencies) * from target list */ remove_prepare_keep_needed(trans, db, lp); @@ -193,7 +192,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL); } - return(0); + return 0; } static int can_remove_file(const char *path, alpm_list_t *skip) @@ -204,7 +203,7 @@ static int can_remove_file(const char *path, alpm_list_t *skip) if(alpm_list_find_str(skip, file)) { /* return success because we will never actually remove this file */ - return(1); + return 1; } /* If we fail write permissions due to a read-only filesystem, abort. * Assume all other possible failures are covered somewhere else */ @@ -214,11 +213,11 @@ static int can_remove_file(const char *path, alpm_list_t *skip) * it - ignore "chmod -w" simple permission failures */ _alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s\n"), file, strerror(errno)); - return(0); + return 0; } } - return(1); + return 1; } /* Helper function for iterating through a package's file and deleting them @@ -359,7 +358,7 @@ db: pkgname); } - return(0); + return 0; } int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db) @@ -378,12 +377,12 @@ int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db) for(targ = trans->remove; targ; targ = targ->next) { int position = 0; char scriptlet[PATH_MAX]; - info = (pmpkg_t*)targ->data; + info = (pmpkg_t *)targ->data; const char *pkgname = NULL; size_t targcount = alpm_list_count(targ); if(handle->trans->state == STATE_INTERRUPTED) { - return(0); + return 0; } /* get the name now so we can use it after package is removed */ @@ -465,7 +464,7 @@ int _alpm_remove_packages(pmtrans_t *trans, pmdb_t *db) /* run ldconfig if it exists */ _alpm_ldconfig(handle->root); - return(0); + return 0; } /* vim: set ts=2 sw=2 noet: */ |