2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* remove.c
|
|
|
|
*
|
2006-01-02 14:55:35 -05:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2006-10-15 15:31:03 -04:00
|
|
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
|
|
|
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
|
|
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
|
|
|
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
2005-03-14 20:51:43 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
|
|
* USA.
|
|
|
|
*/
|
|
|
|
|
2006-10-15 15:31:03 -04:00
|
|
|
#if defined(__APPLE__) || defined(__OpenBSD__)
|
|
|
|
#include <sys/syslimits.h>
|
|
|
|
#endif
|
|
|
|
#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h>
|
2006-03-02 14:02:35 -05:00
|
|
|
#include <limits.h>
|
2007-01-18 11:04:05 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
2006-05-14 22:19:57 -04:00
|
|
|
#include <libintl.h>
|
2005-03-14 20:51:43 -05:00
|
|
|
/* pacman */
|
2006-10-15 15:31:03 -04:00
|
|
|
#include "list.h"
|
|
|
|
#include "trans.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "util.h"
|
|
|
|
#include "error.h"
|
2005-12-26 11:48:37 -05:00
|
|
|
#include "versioncmp.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "md5.h"
|
2006-10-15 15:31:03 -04:00
|
|
|
#include "sha1.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "log.h"
|
|
|
|
#include "backup.h"
|
|
|
|
#include "package.h"
|
|
|
|
#include "db.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "deps.h"
|
|
|
|
#include "provide.h"
|
|
|
|
#include "remove.h"
|
|
|
|
#include "handle.h"
|
|
|
|
#include "alpm.h"
|
|
|
|
|
2006-02-17 17:35:26 -05:00
|
|
|
int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
|
2005-03-14 20:51:43 -05:00
|
|
|
{
|
|
|
|
pmpkg_t *info;
|
|
|
|
|
2005-03-16 17:10:05 -05:00
|
|
|
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
|
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
|
|
|
ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_pkg_isin(name, trans->packages)) {
|
2006-01-18 17:37:16 -05:00
|
|
|
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
|
|
|
|
}
|
|
|
|
|
2006-02-17 17:35:26 -05:00
|
|
|
if((info = _alpm_db_scan(db, name, INFRQ_ALL)) == NULL) {
|
2006-12-01 04:32:29 -05:00
|
|
|
/* Unimportant - just ignore it if we can't find it */
|
|
|
|
_alpm_log(PM_LOG_DEBUG, _("could not find %s in database"), name);
|
2005-03-16 17:10:05 -05:00
|
|
|
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
2005-04-24 17:27:35 -04:00
|
|
|
|
2006-10-15 15:31:03 -04:00
|
|
|
/* ignore holdpkgs on upgrade */
|
|
|
|
if((trans == handle->trans) && _alpm_list_is_strin(info->name, handle->holdpkg)) {
|
|
|
|
int resp = 0;
|
|
|
|
QUESTION(trans, PM_TRANS_CONV_REMOVE_HOLDPKG, info, NULL, NULL, &resp);
|
|
|
|
if(!resp) {
|
|
|
|
RET_ERR(PM_ERR_PKG_HOLD, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW2, _("adding %s in the targets list"), info->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
trans->packages = _alpm_list_add(trans->packages, info);
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2006-10-20 02:26:55 -04:00
|
|
|
int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, pmlist_t **data)
|
2005-03-14 20:51:43 -05:00
|
|
|
{
|
2006-10-20 02:26:55 -04:00
|
|
|
pmlist_t *lp;
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2005-03-16 17:10:05 -05:00
|
|
|
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
|
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
if(!(trans->flags & (PM_TRANS_FLAG_NODEPS)) && (trans->type != PM_TRANS_TYPE_UPGRADE)) {
|
2005-05-04 15:55:23 -04:00
|
|
|
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("looking for unsatisfied dependencies"));
|
2006-10-15 15:31:03 -04:00
|
|
|
lp = _alpm_checkdeps(trans, db, trans->type, trans->packages);
|
2006-01-15 10:55:16 -05:00
|
|
|
if(lp != NULL) {
|
2005-03-14 20:51:43 -05:00
|
|
|
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
|
|
|
|
while(lp) {
|
2006-10-20 02:26:55 -04:00
|
|
|
pmlist_t *i;
|
2006-01-16 17:27:09 -05:00
|
|
|
for(i = lp; i; i = i->next) {
|
|
|
|
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
|
2006-02-17 17:35:26 -05:00
|
|
|
pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL);
|
2006-01-16 17:27:09 -05:00
|
|
|
if(info) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW2, _("pulling %s in the targets list"), info->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
trans->packages = _alpm_list_add(trans->packages, info);
|
2006-01-16 17:27:09 -05:00
|
|
|
} else {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping"),
|
2006-01-16 17:27:09 -05:00
|
|
|
miss->depend.name);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FREELIST(lp);
|
2006-10-15 15:31:03 -04:00
|
|
|
lp = _alpm_checkdeps(trans, db, trans->type, trans->packages);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
} else {
|
2006-01-07 13:25:28 -05:00
|
|
|
if(data) {
|
|
|
|
*data = lp;
|
2006-01-15 10:55:16 -05:00
|
|
|
} else {
|
|
|
|
FREELIST(lp);
|
2006-01-07 13:25:28 -05:00
|
|
|
}
|
2005-03-16 17:10:05 -05:00
|
|
|
RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("finding removable dependencies"));
|
2006-02-17 17:35:26 -05:00
|
|
|
trans->packages = _alpm_removedeps(db, trans->packages);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
2005-03-25 17:09:14 -05:00
|
|
|
/* re-order w.r.t. dependencies */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("sorting by dependencies"));
|
2006-02-17 17:35:26 -05:00
|
|
|
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
|
2005-03-25 17:09:14 -05:00
|
|
|
/* free the old alltargs */
|
2005-04-06 17:00:57 -04:00
|
|
|
FREELISTPTR(trans->packages);
|
|
|
|
trans->packages = lp;
|
2005-03-25 17:09:14 -05:00
|
|
|
|
2005-05-04 15:55:23 -04:00
|
|
|
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_DONE, NULL, NULL);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2005-05-03 13:43:02 -04:00
|
|
|
/* Helper function for comparing strings
|
|
|
|
*/
|
|
|
|
static int str_cmp(const void *s1, const void *s2)
|
|
|
|
{
|
|
|
|
return(strcmp(s1, s2));
|
|
|
|
}
|
|
|
|
|
2007-01-16 23:47:19 -05:00
|
|
|
/* Helper function for iterating through a package's file and deleting them
|
|
|
|
* Used by _alpm_remove_commit
|
|
|
|
*/
|
|
|
|
static void unlink_file(pmpkg_t *info, pmlist_t *lp, pmlist_t *targ,
|
|
|
|
pmtrans_t *trans, int filenum, int *position)
|
|
|
|
{
|
2007-01-18 11:04:05 -05:00
|
|
|
struct stat buf;
|
|
|
|
int nb = 0;
|
|
|
|
double percent = 0.0;
|
|
|
|
char *file = lp->data;
|
|
|
|
char line[PATH_MAX+1];
|
2007-01-18 12:04:25 -05:00
|
|
|
char *checksum = _alpm_needbackup(lp->data, info->backup);
|
2007-01-18 11:04:05 -05:00
|
|
|
|
|
|
|
if ( *position != 0 ) {
|
|
|
|
percent = (double)*position / filenum;
|
|
|
|
} if ( checksum ) {
|
|
|
|
nb = 1;
|
|
|
|
FREE(checksum);
|
|
|
|
} if ( !nb && trans->type == PM_TRANS_TYPE_UPGRADE ) {
|
|
|
|
/* check noupgrade */
|
|
|
|
if ( _alpm_list_is_strin(file, handle->noupgrade) ) {
|
|
|
|
nb = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
snprintf(line, PATH_MAX, "%s%s", handle->root, file);
|
|
|
|
if ( lstat(line, &buf) ) {
|
2007-01-18 12:04:25 -05:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("file %s does not exist"), line);
|
2007-01-18 11:04:05 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( S_ISDIR(buf.st_mode) ) {
|
|
|
|
if ( rmdir(line) ) {
|
|
|
|
/* this is okay, other pakcages are probably using it (like /usr) */
|
2007-01-18 12:04:25 -05:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("keeping directory %s"), line);
|
2007-01-18 11:04:05 -05:00
|
|
|
} else {
|
2007-01-18 12:04:25 -05:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("removing directory %s"), line);
|
2007-01-18 11:04:05 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* check the "skip list" before removing the file.
|
|
|
|
* see the big comment block in db_find_conflicts() for an
|
|
|
|
* explanation. */
|
|
|
|
int skipit = 0;
|
|
|
|
pmlist_t *j;
|
|
|
|
for ( j = trans->skiplist; j; j = j->next ) {
|
|
|
|
if ( !strcmp(file, (char*)j->data) ) {
|
|
|
|
skipit = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( skipit ) {
|
|
|
|
_alpm_log(PM_LOG_FLOW2, _("skipping removal of %s as it has moved to another package"),
|
2007-01-18 12:04:25 -05:00
|
|
|
line);
|
2007-01-18 11:04:05 -05:00
|
|
|
} else {
|
|
|
|
/* if the file is flagged, back it up to .pacsave */
|
|
|
|
if ( nb ) {
|
|
|
|
if ( !(trans->type == PM_TRANS_TYPE_UPGRADE) ) {
|
|
|
|
/* if it was an upgrade, the file would be left alone because
|
|
|
|
* pacman_add() would handle it */
|
|
|
|
if ( !(trans->type & PM_TRANS_FLAG_NOSAVE) ) {
|
|
|
|
char newpath[PATH_MAX];
|
|
|
|
snprintf(newpath, PATH_MAX, "%s.pacsave", line);
|
|
|
|
rename(line, newpath);
|
2007-01-18 12:04:25 -05:00
|
|
|
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), line, newpath);
|
2007-01-18 11:04:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2007-01-18 12:04:25 -05:00
|
|
|
_alpm_log(PM_LOG_FLOW2, _("unlinking %s"), line);
|
2007-01-18 11:04:05 -05:00
|
|
|
int list_count = _alpm_list_count(trans->packages); /* this way we don't have to call _alpm_list_count twice during PROGRESS */
|
|
|
|
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - _alpm_list_count(targ) + 1));
|
|
|
|
++(*position);
|
|
|
|
}
|
2007-01-18 12:04:25 -05:00
|
|
|
if (unlink(line) == -1) {
|
2007-01-18 11:04:05 -05:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), file, strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-01-16 23:47:19 -05:00
|
|
|
}
|
|
|
|
|
2006-02-17 17:35:26 -05:00
|
|
|
int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
|
2005-03-14 20:51:43 -05:00
|
|
|
{
|
|
|
|
pmpkg_t *info;
|
2006-10-20 02:26:55 -04:00
|
|
|
pmlist_t *targ, *lp;
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2005-03-16 17:10:05 -05:00
|
|
|
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
|
|
|
|
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2005-04-06 17:00:57 -04:00
|
|
|
for(targ = trans->packages; targ; targ = targ->next) {
|
2006-10-15 15:31:03 -04:00
|
|
|
int position = 0;
|
2005-03-14 20:51:43 -05:00
|
|
|
char pm_install[PATH_MAX];
|
|
|
|
info = (pmpkg_t*)targ->data;
|
|
|
|
|
2006-07-14 19:15:07 -04:00
|
|
|
if(handle->trans->state == STATE_INTERRUPTED) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
|
2005-05-04 15:55:23 -04:00
|
|
|
EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("removing package %s-%s"), info->name, info->version);
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
/* run the pre-remove scriptlet if it exists */
|
2006-03-07 13:17:03 -05:00
|
|
|
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
2005-03-28 15:01:11 -05:00
|
|
|
snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path, info->name, info->version);
|
2006-10-15 15:31:03 -04:00
|
|
|
_alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL, trans);
|
2005-03-26 08:29:47 -05:00
|
|
|
}
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
2006-10-15 15:31:03 -04:00
|
|
|
int filenum = _alpm_list_count(info->files);
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("removing files"));
|
2005-03-26 13:03:36 -05:00
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
/* iterate through the list backwards, unlinking files */
|
2006-01-05 16:49:42 -05:00
|
|
|
for(lp = _alpm_list_last(info->files); lp; lp = lp->prev) {
|
2007-01-16 23:47:19 -05:00
|
|
|
unlink_file(info, lp, targ, trans, filenum, &position);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
|
|
|
|
/* run the post-remove script if it exists */
|
2006-03-07 13:17:03 -05:00
|
|
|
if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
|
2005-03-26 13:03:36 -05:00
|
|
|
snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path, info->name, info->version);
|
2006-10-15 15:31:03 -04:00
|
|
|
_alpm_runscriptlet(handle->root, pm_install, "post_remove", info->version, NULL, trans);
|
2005-03-26 13:03:36 -05:00
|
|
|
}
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* remove the package from the database */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("updating database"));
|
|
|
|
_alpm_log(PM_LOG_FLOW2, _("removing database entry '%s'"), info->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_db_remove(db, info) == -1) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s-%s"), info->name, info->version);
|
2005-04-23 13:18:31 -04:00
|
|
|
}
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_db_remove_pkgfromcache(db, info) == -1) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"), info->name);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update dependency packages' REQUIREDBY fields */
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW2, _("updating dependency packages 'requiredby' fields"));
|
2005-03-14 20:51:43 -05:00
|
|
|
for(lp = info->depends; lp; lp = lp->next) {
|
|
|
|
pmpkg_t *depinfo = NULL;
|
|
|
|
pmdepend_t depend;
|
2006-10-31 01:39:59 -05:00
|
|
|
void *vdata;
|
2005-05-03 13:44:53 -04:00
|
|
|
char *data;
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_splitdep((char*)lp->data, &depend)) {
|
2005-03-26 16:20:03 -05:00
|
|
|
continue;
|
|
|
|
}
|
2006-01-18 17:37:16 -05:00
|
|
|
/* if this dependency is in the transaction targets, no need to update
|
|
|
|
* its requiredby info: it is in the process of being removed (if not
|
|
|
|
* already done!)
|
|
|
|
*/
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_pkg_isin(depend.name, trans->packages)) {
|
2006-01-18 17:37:16 -05:00
|
|
|
continue;
|
|
|
|
}
|
2006-02-17 17:35:26 -05:00
|
|
|
depinfo = _alpm_db_get_pkgfromcache(db, depend.name);
|
2005-03-14 20:51:43 -05:00
|
|
|
if(depinfo == NULL) {
|
|
|
|
/* look for a provides package */
|
2006-10-20 02:26:55 -04:00
|
|
|
pmlist_t *provides = _alpm_db_whatprovides(db, depend.name);
|
2005-03-14 20:51:43 -05:00
|
|
|
if(provides) {
|
|
|
|
/* TODO: should check _all_ packages listed in provides, not just
|
|
|
|
* the first one.
|
|
|
|
*/
|
|
|
|
/* use the first one */
|
2006-02-17 17:35:26 -05:00
|
|
|
depinfo = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
|
2005-03-28 02:45:24 -05:00
|
|
|
FREELISTPTR(provides);
|
2006-01-16 17:27:09 -05:00
|
|
|
}
|
|
|
|
if(depinfo == NULL) {
|
2006-11-24 02:01:27 -05:00
|
|
|
/* dep not installed... that's fine, carry on */
|
|
|
|
_alpm_log(PM_LOG_DEBUG, _("could not find dependency '%s' for removal"), depend.name);
|
2005-03-14 20:51:43 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2007-01-03 01:13:08 -05:00
|
|
|
/* Ensure package has the appropriate data */
|
|
|
|
_alpm_db_read(db, INFRQ_DEPENDS, depinfo);
|
2005-03-14 20:51:43 -05:00
|
|
|
/* splice out this entry from requiredby */
|
2006-10-31 01:39:59 -05:00
|
|
|
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, &vdata);
|
|
|
|
data = vdata;
|
2005-05-03 13:44:53 -04:00
|
|
|
FREE(data);
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), depinfo->name);
|
2006-02-17 17:35:26 -05:00
|
|
|
if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"),
|
2006-01-16 17:27:09 -05:00
|
|
|
depinfo->name, depinfo->version);
|
2005-03-26 13:03:36 -05:00
|
|
|
}
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
|
2006-10-15 15:31:03 -04:00
|
|
|
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 100, _alpm_list_count(trans->packages), (_alpm_list_count(trans->packages) - _alpm_list_count(targ) +1));
|
2005-03-14 20:51:43 -05:00
|
|
|
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
|
2005-05-04 15:55:23 -04:00
|
|
|
EVENT(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL);
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* run ldconfig if it exists */
|
2006-07-14 19:15:07 -04:00
|
|
|
if((trans->type != PM_TRANS_TYPE_UPGRADE) && (handle->trans->state != STATE_INTERRUPTED)) {
|
2006-05-14 22:19:57 -04:00
|
|
|
_alpm_log(PM_LOG_FLOW1, _("running \"ldconfig -r %s\""), handle->root);
|
2005-03-26 13:03:36 -05:00
|
|
|
_alpm_ldconfig(handle->root);
|
|
|
|
}
|
2005-03-14 20:51:43 -05:00
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set ts=2 sw=2 noet: */
|