summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-17 22:35:26 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-02-17 22:35:26 +0000
commitbe39f49a5461d5804e4391266dfea6dd076691f4 (patch)
tree911a7f550895d9fdda7b4846d6775699549b2bf4 /lib/libalpm/remove.c
parent5e4c3661c6066623bbfa34bacccfafda5be21315 (diff)
downloadpacman-be39f49a5461d5804e4391266dfea6dd076691f4.tar.xz
prepend library function names with _alpm (helped with the patch from VMiklos <vmiklos@frugalware.org>)
added log and event callbacks to sync_commit internal transactions
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index dbc96417..7ae22216 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -48,7 +48,7 @@
extern pmhandle_t *handle;
-int remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
+int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
{
pmpkg_t *info;
@@ -56,22 +56,22 @@ int remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- if(pkg_isin(name, trans->packages)) {
+ if(_alpm_pkg_isin(name, trans->packages)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
- if((info = db_scan(db, name, INFRQ_ALL)) == NULL) {
+ if((info = _alpm_db_scan(db, name, INFRQ_ALL)) == NULL) {
_alpm_log(PM_LOG_ERROR, "could not find %s in database", name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
_alpm_log(PM_LOG_FLOW2, "adding %s in the targets list", info->name);
- trans->packages = pm_list_add(trans->packages, info);
+ trans->packages = _alpm_list_add(trans->packages, info);
return(0);
}
-int remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
+int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
{
PMList *lp;
@@ -82,24 +82,24 @@ int remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
_alpm_log(PM_LOG_FLOW1, "looking for unsatisfied dependencies");
- lp = checkdeps(db, trans->type, trans->packages);
+ lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
while(lp) {
PMList *i;
for(i = lp; i; i = i->next) {
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
- pmpkg_t *info = db_scan(db, miss->depend.name, INFRQ_ALL);
+ pmpkg_t *info = _alpm_db_scan(db, miss->depend.name, INFRQ_ALL);
if(info) {
_alpm_log(PM_LOG_FLOW2, "pulling %s in the targets list", info->name);
- trans->packages = pm_list_add(trans->packages, info);
+ trans->packages = _alpm_list_add(trans->packages, info);
} else {
_alpm_log(PM_LOG_ERROR, "could not find %s in database -- skipping",
miss->depend.name);
}
}
FREELIST(lp);
- lp = checkdeps(db, trans->type, trans->packages);
+ lp = _alpm_checkdeps(db, trans->type, trans->packages);
}
} else {
if(data) {
@@ -113,12 +113,12 @@ int remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
_alpm_log(PM_LOG_FLOW1, "finding removable dependencies");
- trans->packages = removedeps(db, trans->packages);
+ trans->packages = _alpm_removedeps(db, trans->packages);
}
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
- lp = sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
+ lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */
FREELISTPTR(trans->packages);
trans->packages = lp;
@@ -136,7 +136,7 @@ static int str_cmp(const void *s1, const void *s2)
return(strcmp(s1, s2));
}
-int remove_commit(pmtrans_t *trans, pmdb_t *db)
+int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
{
pmpkg_t *info;
struct stat buf;
@@ -175,7 +175,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
}
if(!nb && trans->type == PM_TRANS_TYPE_UPGRADE) {
/* check noupgrade */
- if(pm_list_is_strin(file, handle->noupgrade)) {
+ if(_alpm_list_is_strin(file, handle->noupgrade)) {
nb = 1;
}
}
@@ -247,10 +247,10 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
/* remove the package from the database */
_alpm_log(PM_LOG_FLOW1, "updating database");
_alpm_log(PM_LOG_FLOW2, "removing database entry '%s'", info->name);
- if(db_remove(db, info) == -1) {
+ if(_alpm_db_remove(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, "could not remove database entry %s-%s", info->name, info->version);
}
- if(db_remove_pkgfromcache(db, info) == -1) {
+ if(_alpm_db_remove_pkgfromcache(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, "could not remove entry '%s' from cache", info->name);
}
@@ -260,17 +260,17 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
pmpkg_t *depinfo = NULL;
pmdepend_t depend;
char *data;
- if(splitdep((char*)lp->data, &depend)) {
+ if(_alpm_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(pkg_isin(depend.name, trans->packages)) {
+ if(_alpm_pkg_isin(depend.name, trans->packages)) {
continue;
}
- depinfo = db_get_pkgfromcache(db, depend.name);
+ depinfo = _alpm_db_get_pkgfromcache(db, depend.name);
if(depinfo == NULL) {
/* look for a provides package */
PMList *provides = _alpm_db_whatprovides(db, depend.name);
@@ -279,7 +279,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
* the first one.
*/
/* use the first one */
- depinfo = db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
+ depinfo = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)provides->data)->name);
FREELISTPTR(provides);
}
if(depinfo == NULL) {
@@ -292,7 +292,7 @@ int remove_commit(pmtrans_t *trans, pmdb_t *db)
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, info->name, str_cmp, (void **)&data);
FREE(data);
_alpm_log(PM_LOG_DEBUG, "updating 'requiredby' field for package '%s'", depinfo->name);
- if(db_write(db, depinfo, INFRQ_DEPENDS)) {
+ if(_alpm_db_write(db, depinfo, INFRQ_DEPENDS)) {
_alpm_log(PM_LOG_ERROR, "could not update 'requiredby' database entry %s-%s",
depinfo->name, depinfo->version);
}