Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=42b585d10cfb45a6da9a3044fb264eb908e8d01d

commit 42b585d10cfb45a6da9a3044fb264eb908e8d01d
Author: Michel Hermier <[email protected]>
Date:   Fri Apr 26 08:29:47 2013 +0200

libpacman: Merge remove.c in trans.c.

diff --git a/lib/libpacman/Makefile.am b/lib/libpacman/Makefile.am
index ef19002..fe64b6f 100644
--- a/lib/libpacman/Makefile.am
+++ b/lib/libpacman/Makefile.am
@@ -28,7 +28,6 @@ TARGETS = md5driver.c \
packages_transaction.c \
trans.c \
trans_sysupgrade.c \
-       remove.c \
sync.c \
handle.c \
server.c \
diff --git a/lib/libpacman/pacman.c b/lib/libpacman/pacman.c
index 253896e..1bcdda2 100644
--- a/lib/libpacman/pacman.c
+++ b/lib/libpacman/pacman.c
@@ -53,7 +53,6 @@
#include "cache.h"
#include "conflict.h"
#include "backup.h"
-#include "remove.h"
#include "sync.h"
#include "handle.h"
#include "provide.h"
diff --git a/lib/libpacman/remove.c b/lib/libpacman/remove.c
deleted file mode 100644
index 501705d..0000000
--- a/lib/libpacman/remove.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- *  remove.c
- *
- *  Copyright (c) 2002-2006 by Judd Vinet <[email protected]>
- *  Copyright (c) 2005 by Aurelien Foret <[email protected]>
- *  Copyright (c) 2005 by Christian Hamar <[email protected]>
- *  Copyright (c) 2006 by David Kimpe <[email protected]>
- *  Copyright (c) 2005, 2006, 2007 by Miklos Vajna <[email protected]>
- *
- *  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.
- */
-
-#include "config.h"
-
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#endif
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
-#include <sys/stat.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <fcntl.h>
-#include <string.h>
-#include <limits.h>
-#include <zlib.h>
-
-/* pacman-g2 */
-#include "remove.h"
-
-#include "trans.h"
-#include "util.h"
-#include "error.h"
-#include "deps.h"
-#include "versioncmp.h"
-#include "md5.h"
-#include "sha1.h"
-#include "log.h"
-#include "backup.h"
-#include "package.h"
-#include "db.h"
-#include "cache.h"
-#include "provide.h"
-#include "handle.h"
-#include "pacman.h"
-#include "packages_transaction.h"
-
-int _pacman_remove_commit(pmtrans_t *trans, pmlist_t **data)
-{
-       pmpkg_t *info;
-       struct stat buf;
-       pmlist_t *targ, *lp;
-       char line[PATH_MAX+1];
-       int howmany, remain;
-       pmdb_t *db = trans->handle->db_local;
-
-       ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
-       ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
-
-       howmany = _pacman_list_count(trans->packages);
-
-       for(targ = trans->packages; targ; targ = targ->next) {
-               int position = 0;
-               char pm_install[PATH_MAX];
-               info = ((pmtranspkg_t*)targ->data)->pkg_local;
-
-               if(handle->trans->state == STATE_INTERRUPTED) {
-                       break;
-               }
-
-               remain = _pacman_list_count(targ);
-
-               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
-                       EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
-                       _pacman_log(PM_LOG_FLOW1, _("removing package %s-%s"), 
info->name, info->version);
-
-                       /* run the pre-remove scriptlet if it exists */
-                       if(info->scriptlet && !(trans->flags & 
PM_TRANS_FLAG_NOSCRIPTLET)) {
-                               snprintf(pm_install, PATH_MAX, 
"%s/%s-%s/install", db->path, info->name, info->version);
-                               _pacman_runscriptlet(handle->root, pm_install, 
"pre_remove", info->version, NULL, trans);
-                       }
-               }
-
-               if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
-                       int filenum = _pacman_list_count(info->files);
-                       _pacman_log(PM_LOG_FLOW1, _("removing files"));
-
-                       /* iterate through the list backwards, unlinking files 
*/
-                       for(lp = _pacman_list_last(info->files); lp; lp = 
lp->prev) {
-                               int nb = 0;
-                               double percent;
-                               char *file = lp->data;
-                               char *md5 =_pacman_needbackup(file, 
info->backup);
-                               char *sha1 =_pacman_needbackup(file, 
info->backup);
-
-                               if (position != 0) {
-                               percent = (double)position / filenum;
-                               }
-                               if(md5 && sha1) {
-                                       nb = 1;
-                                       FREE(md5);
-                                       FREE(sha1);
-                               }
-                               if(!nb && trans->type == PM_TRANS_TYPE_UPGRADE) 
{
-                                       /* check noupgrade */
-                                       
if(_pacman_strlist_find(handle->noupgrade, file)) {
-                                               nb = 1;
-                                       }
-                               }
-                               snprintf(line, PATH_MAX, "%s%s", handle->root, 
file);
-                               if(lstat(line, &buf)) {
-                                       _pacman_log(PM_LOG_DEBUG, _("file %s 
does not exist"), file);
-                                       continue;
-                               }
-                               if(S_ISDIR(buf.st_mode)) {
-                                       if(rmdir(line)) {
-                                               /* this is okay, other packages 
are probably using it. */
-                                               _pacman_log(PM_LOG_DEBUG, 
_("keeping directory %s"), file);
-                                       } else {
-                                               _pacman_log(PM_LOG_FLOW2, 
_("removing directory %s"), file);
-                                       }
-                               } 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) {
-                                               _pacman_log(PM_LOG_FLOW2, 
_("skipping removal of %s as it has moved to another package"),
-                                                       file);
-                                       } else {
-                                               /* if the file is flagged, back 
it up to .pacsave */
-                                               if(nb) {
-                                                       if(trans->type == 
PM_TRANS_TYPE_UPGRADE) {
-                                                               /* we're 
upgrading so just leave the file as is. pacman_add() will handle it */
-                                                       } else {
-                                                               
if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
-                                                                       char 
newpath[PATH_MAX];
-                                                                       
snprintf(newpath, PATH_MAX, "%s.pacsave", line);
-                                                                       
rename(line, newpath);
-                                                                       
_pacman_log(PM_LOG_WARNING, _("%s saved as %s"), line, newpath);
-                                                                       
pacman_logaction(_("%s saved as %s"), line, newpath);
-                                                               } else {
-                                                                       
_pacman_log(PM_LOG_FLOW2, _("unlinking %s"), file);
-                                                                       
if(unlink(line)) {
-                                                                               
_pacman_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
-                                                                       }
-                                                               }
-                                                       }
-                                               } else {
-                                                       
_pacman_log(PM_LOG_FLOW2, _("unlinking %s"), file);
-                                                       /* Need at here because 
we count only real unlinked files ? */
-                                                       PROGRESS(trans, 
PM_TRANS_PROGRESS_REMOVE_START, info->name, (int)(percent * 100), howmany, 
howmany - remain + 1);
-                                                       position++;
-                                                       if(unlink(line)) {
-                                                               
_pacman_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 
100, howmany, howmany - remain + 1);
-               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
-                       /* run the post-remove script if it exists */
-                       if(info->scriptlet && !(trans->flags & 
PM_TRANS_FLAG_NOSCRIPTLET)) {
-                               /* must run ldconfig here because some 
scriptlets fail due to missing libs otherwise */
-                               _pacman_ldconfig(handle->root);
-                               snprintf(pm_install, PATH_MAX, 
"%s/%s-%s/install", db->path, info->name, info->version);
-                               _pacman_runscriptlet(handle->root, pm_install, 
"post_remove", info->version, NULL, trans);
-                       }
-               }
-
-               /* remove the package from the database */
-               _pacman_log(PM_LOG_FLOW1, _("updating database"));
-               _pacman_log(PM_LOG_FLOW2, _("removing database entry '%s'"), 
info->name);
-               if(_pacman_db_remove(db, info) == -1) {
-                       _pacman_log(PM_LOG_ERROR, _("could not remove database 
entry %s-%s"), info->name, info->version);
-               }
-               if(_pacman_db_remove_pkgfromcache(db, info) == -1) {
-                       _pacman_log(PM_LOG_ERROR, _("could not remove entry 
'%s' from cache"), info->name);
-               }
-
-               /* update dependency packages' REQUIREDBY fields */
-               _pacman_log(PM_LOG_FLOW2, _("updating dependency packages 
'requiredby' fields"));
-               for(lp = info->depends; lp; lp = lp->next) {
-                       pmpkg_t *depinfo = NULL;
-                       pmdepend_t depend;
-                       char *data;
-                       if(_pacman_splitdep((char*)lp->data, &depend)) {
-                               continue;
-                       }
-                       /* 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!)
-                        */
-                       if(__pacman_trans_get_trans_pkg(trans, depend.name) != 
NULL) {
-                               continue;
-                       }
-                       depinfo = _pacman_db_get_pkgfromcache(db, depend.name);
-                       if(depinfo == NULL) {
-                               /* look for a provides package */
-                               pmlist_t *provides = 
_pacman_db_whatprovides(db, depend.name);
-                               if(provides) {
-                                       /* TODO: should check _all_ packages 
listed in provides, not just
-                                        *                       the first one.
-                                        */
-                                       /* use the first one */
-                                       depinfo = 
_pacman_db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
-                                       FREELISTPTR(provides);
-                               }
-                               if(depinfo == NULL) {
-                                       _pacman_log(PM_LOG_ERROR, _("could not 
find dependency '%s'"), depend.name);
-                                       /* wtf */
-                                       continue;
-                               }
-                       }
-                       /* splice out this entry from requiredby */
-                       depinfo->requiredby = 
_pacman_list_remove(_pacman_pkg_getinfo(depinfo, PM_PKG_REQUIREDBY), 
info->name, strcmp, (void **)&data);
-                       FREE(data);
-                       _pacman_log(PM_LOG_DEBUG, _("updating 'requiredby' 
field for package '%s'"), depinfo->name);
-                       if(_pacman_db_write(db, depinfo, INFRQ_DEPENDS)) {
-                               _pacman_log(PM_LOG_ERROR, _("could not update 
'requiredby' database entry %s-%s"),
-                                       depinfo->name, depinfo->version);
-                       }
-               }
-
-               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
-                       EVENT(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL);
-               }
-       }
-
-       /* run ldconfig if it exists */
-       if((trans->type != PM_TRANS_TYPE_UPGRADE) && (handle->trans->state != 
STATE_INTERRUPTED)) {
-               _pacman_ldconfig(handle->root);
-       }
-
-       return(0);
-}
-
-const pmtrans_ops_t _pacman_remove_pmtrans_opts = {
-       .commit = _pacman_remove_commit
-};
-
-/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/remove.h b/lib/libpacman/remove.h
deleted file mode 100644
index 05a532a..0000000
--- a/lib/libpacman/remove.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  remove.h
- *
- *  Copyright (c) 2002-2006 by Judd Vinet <[email protected]>
- *
- *  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.
- */
-#ifndef _PACMAN_REMOVE_H
-#define _PACMAN_REMOVE_H
-
-#include "trans.h"
-
-int _pacman_remove_commit(pmtrans_t *trans, pmlist_t **data);
-
-const pmtrans_ops_t _pacman_remove_pmtrans_opts;
-
-
-#endif /* _PACMAN_REMOVE_H */
-
-/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/trans.c b/lib/libpacman/trans.c
index 77f6f9f..47748e3 100644
--- a/lib/libpacman/trans.c
+++ b/lib/libpacman/trans.c
@@ -38,7 +38,6 @@
#include "util.h"
#include "log.h"
#include "handle.h"
-#include "remove.h"
#include "sync.h"
#include "cache.h"
#include "pacman.h"
@@ -170,12 +169,10 @@ int _pacman_trans_init(pmtrans_t *trans, pmtranstype_t 
type, unsigned int flags,

switch(type) {
case PM_TRANS_TYPE_ADD:
+               case PM_TRANS_TYPE_REMOVE:
case PM_TRANS_TYPE_UPGRADE:
trans->ops = NULL;
break;
-               case PM_TRANS_TYPE_REMOVE:
-                       trans->ops = &_pacman_remove_pmtrans_opts;
-               break;
case PM_TRANS_TYPE_SYNC:
trans->ops = &_pacman_sync_pmtrans_opts;
break;
@@ -704,6 +701,205 @@ struct trans_event_table_item {
}
};

+int _pacman_remove_commit(pmtrans_t *trans, pmlist_t **data)
+{
+       pmpkg_t *info;
+       struct stat buf;
+       pmlist_t *targ, *lp;
+       char line[PATH_MAX+1];
+       int howmany, remain;
+       pmdb_t *db = trans->handle->db_local;
+
+       ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
+       ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
+
+       howmany = _pacman_list_count(trans->packages);
+
+       for(targ = trans->packages; targ; targ = targ->next) {
+               int position = 0;
+               char pm_install[PATH_MAX];
+               info = ((pmtranspkg_t*)targ->data)->pkg_local;
+
+               if(handle->trans->state == STATE_INTERRUPTED) {
+                       break;
+               }
+
+               remain = _pacman_list_count(targ);
+
+               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
+                       EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
+                       _pacman_log(PM_LOG_FLOW1, _("removing package %s-%s"), 
info->name, info->version);
+
+                       /* run the pre-remove scriptlet if it exists */
+                       if(info->scriptlet && !(trans->flags & 
PM_TRANS_FLAG_NOSCRIPTLET)) {
+                               snprintf(pm_install, PATH_MAX, 
"%s/%s-%s/install", db->path, info->name, info->version);
+                               _pacman_runscriptlet(handle->root, pm_install, 
"pre_remove", info->version, NULL, trans);
+                       }
+               }
+
+               if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
+                       int filenum = _pacman_list_count(info->files);
+                       _pacman_log(PM_LOG_FLOW1, _("removing files"));
+
+                       /* iterate through the list backwards, unlinking files 
*/
+                       for(lp = _pacman_list_last(info->files); lp; lp = 
lp->prev) {
+                               int nb = 0;
+                               double percent;
+                               char *file = lp->data;
+                               char *md5 =_pacman_needbackup(file, 
info->backup);
+                               char *sha1 =_pacman_needbackup(file, 
info->backup);
+
+                               if (position != 0) {
+                               percent = (double)position / filenum;
+                               }
+                               if(md5 && sha1) {
+                                       nb = 1;
+                                       FREE(md5);
+                                       FREE(sha1);
+                               }
+                               if(!nb && trans->type == PM_TRANS_TYPE_UPGRADE) 
{
+                                       /* check noupgrade */
+                                       
if(_pacman_strlist_find(handle->noupgrade, file)) {
+                                               nb = 1;
+                                       }
+                               }
+                               snprintf(line, PATH_MAX, "%s%s", handle->root, 
file);
+                               if(lstat(line, &buf)) {
+                                       _pacman_log(PM_LOG_DEBUG, _("file %s 
does not exist"), file);
+                                       continue;
+                               }
+                               if(S_ISDIR(buf.st_mode)) {
+                                       if(rmdir(line)) {
+                                               /* this is okay, other packages 
are probably using it. */
+                                               _pacman_log(PM_LOG_DEBUG, 
_("keeping directory %s"), file);
+                                       } else {
+                                               _pacman_log(PM_LOG_FLOW2, 
_("removing directory %s"), file);
+                                       }
+                               } 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) {
+                                               _pacman_log(PM_LOG_FLOW2, 
_("skipping removal of %s as it has moved to another package"),
+                                                       file);
+                                       } else {
+                                               /* if the file is flagged, back 
it up to .pacsave */
+                                               if(nb) {
+                                                       if(trans->type == 
PM_TRANS_TYPE_UPGRADE) {
+                                                               /* we're 
upgrading so just leave the file as is. pacman_add() will handle it */
+                                                       } else {
+                                                               
if(!(trans->flags & PM_TRANS_FLAG_NOSAVE)) {
+                                                                       char 
newpath[PATH_MAX];
+                                                                       
snprintf(newpath, PATH_MAX, "%s.pacsave", line);
+                                                                       
rename(line, newpath);
+                                                                       
_pacman_log(PM_LOG_WARNING, _("%s saved as %s"), line, newpath);
+                                                                       
pacman_logaction(_("%s saved as %s"), line, newpath);
+                                                               } else {
+                                                                       
_pacman_log(PM_LOG_FLOW2, _("unlinking %s"), file);
+                                                                       
if(unlink(line)) {
+                                                                               
_pacman_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
+                                                                       }
+                                                               }
+                                                       }
+                                               } else {
+                                                       
_pacman_log(PM_LOG_FLOW2, _("unlinking %s"), file);
+                                                       /* Need at here because 
we count only real unlinked files ? */
+                                                       PROGRESS(trans, 
PM_TRANS_PROGRESS_REMOVE_START, info->name, (int)(percent * 100), howmany, 
howmany - remain + 1);
+                                                       position++;
+                                                       if(unlink(line)) {
+                                                               
_pacman_log(PM_LOG_ERROR, _("cannot remove file %s"), file);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, 
100, howmany, howmany - remain + 1);
+               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
+                       /* run the post-remove script if it exists */
+                       if(info->scriptlet && !(trans->flags & 
PM_TRANS_FLAG_NOSCRIPTLET)) {
+                               /* must run ldconfig here because some 
scriptlets fail due to missing libs otherwise */
+                               _pacman_ldconfig(handle->root);
+                               snprintf(pm_install, PATH_MAX, 
"%s/%s-%s/install", db->path, info->name, info->version);
+                               _pacman_runscriptlet(handle->root, pm_install, 
"post_remove", info->version, NULL, trans);
+                       }
+               }
+
+               /* remove the package from the database */
+               _pacman_log(PM_LOG_FLOW1, _("updating database"));
+               _pacman_log(PM_LOG_FLOW2, _("removing database entry '%s'"), 
info->name);
+               if(_pacman_db_remove(db, info) == -1) {
+                       _pacman_log(PM_LOG_ERROR, _("could not remove database 
entry %s-%s"), info->name, info->version);
+               }
+               if(_pacman_db_remove_pkgfromcache(db, info) == -1) {
+                       _pacman_log(PM_LOG_ERROR, _("could not remove entry 
'%s' from cache"), info->name);
+               }
+
+               /* update dependency packages' REQUIREDBY fields */
+               _pacman_log(PM_LOG_FLOW2, _("updating dependency packages 
'requiredby' fields"));
+               for(lp = info->depends; lp; lp = lp->next) {
+                       pmpkg_t *depinfo = NULL;
+                       pmdepend_t depend;
+                       char *data;
+                       if(_pacman_splitdep((char*)lp->data, &depend)) {
+                               continue;
+                       }
+                       /* 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!)
+                        */
+                       if(__pacman_trans_get_trans_pkg(trans, depend.name) != 
NULL) {
+                               continue;
+                       }
+                       depinfo = _pacman_db_get_pkgfromcache(db, depend.name);
+                       if(depinfo == NULL) {
+                               /* look for a provides package */
+                               pmlist_t *provides = 
_pacman_db_whatprovides(db, depend.name);
+                               if(provides) {
+                                       /* TODO: should check _all_ packages 
listed in provides, not just
+                                        *                       the first one.
+                                        */
+                                       /* use the first one */
+                                       depinfo = 
_pacman_db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
+                                       FREELISTPTR(provides);
+                               }
+                               if(depinfo == NULL) {
+                                       _pacman_log(PM_LOG_ERROR, _("could not 
find dependency '%s'"), depend.name);
+                                       /* wtf */
+                                       continue;
+                               }
+                       }
+                       /* splice out this entry from requiredby */
+                       depinfo->requiredby = 
_pacman_list_remove(_pacman_pkg_getinfo(depinfo, PM_PKG_REQUIREDBY), 
info->name, strcmp, (void **)&data);
+                       FREE(data);
+                       _pacman_log(PM_LOG_DEBUG, _("updating 'requiredby' 
field for package '%s'"), depinfo->name);
+                       if(_pacman_db_write(db, depinfo, INFRQ_DEPENDS)) {
+                               _pacman_log(PM_LOG_ERROR, _("could not update 
'requiredby' database entry %s-%s"),
+                                       depinfo->name, depinfo->version);
+                       }
+               }
+
+               if(trans->type != PM_TRANS_TYPE_UPGRADE) {
+                       EVENT(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL);
+               }
+       }
+
+       /* run ldconfig if it exists */
+       if((trans->type != PM_TRANS_TYPE_UPGRADE) && (handle->trans->state != 
STATE_INTERRUPTED)) {
+               _pacman_ldconfig(handle->root);
+       }
+
+       return(0);
+}
+
int _pacman_trans_commit(pmtrans_t *trans, pmlist_t **data)
{
pmdb_t *db_local;
@@ -726,7 +922,12 @@ int _pacman_trans_commit(pmtrans_t *trans, pmlist_t **data)

_pacman_trans_set_state(trans, STATE_COMMITING);

-       if (trans->ops != NULL && trans->ops->commit != NULL) {
+       if (trans->type == PM_TRANS_TYPE_REMOVE) {
+               if (_pacman_remove_commit (trans, data) == -1) {
+                       _pacman_trans_set_state(trans, STATE_PREPARED);
+                       return(-1);
+               }
+       } else if (trans->ops != NULL && trans->ops->commit != NULL) {
if (trans->ops->commit(trans, data) == -1) {
/* pm_errno is set by trans->ops->commit() */
_pacman_trans_set_state(trans, STATE_PREPARED);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to