summaryrefslogtreecommitdiff
path: root/lib
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
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')
-rw-r--r--lib/libalpm/add.c76
-rw-r--r--lib/libalpm/add.h6
-rw-r--r--lib/libalpm/alpm.c52
-rw-r--r--lib/libalpm/cache.c60
-rw-r--r--lib/libalpm/cache.h20
-rw-r--r--lib/libalpm/conflict.c61
-rw-r--r--lib/libalpm/conflict.h4
-rw-r--r--lib/libalpm/db.c48
-rw-r--r--lib/libalpm/db.h14
-rw-r--r--lib/libalpm/deps.c114
-rw-r--r--lib/libalpm/deps.h14
-rw-r--r--lib/libalpm/group.c6
-rw-r--r--lib/libalpm/group.h8
-rw-r--r--lib/libalpm/handle.c6
-rw-r--r--lib/libalpm/list.c22
-rw-r--r--lib/libalpm/list.h12
-rw-r--r--lib/libalpm/package.c32
-rw-r--r--lib/libalpm/package.h14
-rw-r--r--lib/libalpm/provide.c6
-rw-r--r--lib/libalpm/remove.c40
-rw-r--r--lib/libalpm/remove.h6
-rw-r--r--lib/libalpm/sync.c146
-rw-r--r--lib/libalpm/sync.h16
-rw-r--r--lib/libalpm/trans.c52
-rw-r--r--lib/libalpm/trans.h16
-rw-r--r--lib/libalpm/versioncmp.c4
-rw-r--r--lib/libalpm/versioncmp.h2
27 files changed, 428 insertions, 429 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 800cc0df..5d29abdd 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -57,7 +57,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
char *str = NULL;
pmpkg_t *dummy = NULL;
- if((dummy = pkg_new(NULL, NULL)) == NULL) {
+ if((dummy = _alpm_pkg_new(NULL, NULL)) == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
@@ -80,7 +80,7 @@ static int add_faketarget(pmtrans_t *trans, char *name)
} else if(strncmp("version", p, q-p) == 0) {
STRNCPY(dummy->version, q+1, PKG_VERSION_LEN);
} else if(strncmp("depend", p, q-p) == 0) {
- dummy->depends = pm_list_add(dummy->depends, strdup(q+1));
+ dummy->depends = _alpm_list_add(dummy->depends, strdup(q+1));
} else {
_alpm_log(PM_LOG_ERROR, "could not parse token %s", p);
}
@@ -92,12 +92,12 @@ static int add_faketarget(pmtrans_t *trans, char *name)
}
/* add the package to the transaction */
- trans->packages = pm_list_add(trans->packages, dummy);
+ trans->packages = _alpm_list_add(trans->packages, dummy);
return(0);
}
-int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
+int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
{
pmpkg_t *info = NULL;
pmpkg_t *dummy;
@@ -121,7 +121,7 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
goto error;
}
- if(pkg_splitname(name, pkgname, pkgver) == -1) {
+ if(_alpm_pkg_splitname(name, pkgname, pkgver) == -1) {
pm_errno = PM_ERR_PKG_INVALID_NAME;
goto error;
}
@@ -134,15 +134,15 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
if(trans->type != PM_TRANS_TYPE_UPGRADE) {
/* only install this package if it is not already installed */
- if(db_get_pkgfromcache(db, pkgname)) {
+ if(_alpm_db_get_pkgfromcache(db, pkgname)) {
pm_errno = PM_ERR_PKG_INSTALLED;
goto error;
}
} else {
if(trans->flags & PM_TRANS_FLAG_FRESHEN) {
/* only upgrade/install this package if it is already installed and at a lesser version */
- dummy = db_get_pkgfromcache(db, pkgname);
- if(dummy == NULL || versioncmp(dummy->version, pkgver) >= 0) {
+ dummy = _alpm_db_get_pkgfromcache(db, pkgname);
+ if(dummy == NULL || _alpm_versioncmp(dummy->version, pkgver) >= 0) {
pm_errno = PM_ERR_PKG_CANT_FRESH;
goto error;
}
@@ -154,11 +154,11 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
for(i = trans->packages; i; i = i->next) {
pmpkg_t *pkg = i->data;
if(strcmp(pkg->name, pkgname) == 0) {
- if(versioncmp(pkg->version, pkgver) < 0) {
+ if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
pmpkg_t *newpkg;
_alpm_log(PM_LOG_WARNING, "replacing older version %s-%s by %s in target list",
pkg->name, pkg->version, pkgver);
- if((newpkg = pkg_load(name)) == NULL) {
+ if((newpkg = _alpm_pkg_load(name)) == NULL) {
/* pm_errno is already set by pkg_load() */
goto error;
}
@@ -173,7 +173,7 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
_alpm_log(PM_LOG_FLOW2, "reading '%s' metadata", pkgname);
- info = pkg_load(name);
+ info = _alpm_pkg_load(name);
if(info == NULL) {
/* pm_errno is already set by pkg_load() */
goto error;
@@ -189,7 +189,7 @@ int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
/* add the package to the transaction */
- trans->packages = pm_list_add(trans->packages, info);
+ trans->packages = _alpm_list_add(trans->packages, info);
return(0);
@@ -198,7 +198,7 @@ error:
return(-1);
}
-int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
+int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
{
PMList *lp;
@@ -212,7 +212,7 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
/* look for unsatisfied dependencies */
_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(data) {
*data = lp;
@@ -224,7 +224,7 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
/* no unsatisfied deps, so look for conflicts */
_alpm_log(PM_LOG_FLOW1, "looking for conflicts");
- lp = checkconflicts(db, trans->packages);
+ lp = _alpm_checkconflicts(db, trans->packages);
if(lp != NULL) {
if(data) {
*data = lp;
@@ -236,7 +236,7 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_FLOW1, "sorting by dependencies");
- lp = sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
+ lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
/* free the old alltargs */
FREELISTPTR(trans->packages);
trans->packages = lp;
@@ -252,7 +252,7 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_FLOW1, "looking for file conflicts");
- lp = db_find_conflicts(db, trans->packages, handle->root, &skiplist);
+ lp = _alpm_db_find_conflicts(db, trans->packages, handle->root, &skiplist);
if(lp != NULL) {
if(data) {
*data = lp;
@@ -272,7 +272,7 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
return(0);
}
-int add_commit(pmtrans_t *trans, pmdb_t *db)
+int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
{
int i, ret = 0, errors = 0;
TAR *tar = NULL;
@@ -304,19 +304,19 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
/* see if this is an upgrade. if so, remove the old package first */
if(pmo_upgrade) {
- pmpkg_t *local = db_get_pkgfromcache(db, info->name);
+ pmpkg_t *local = _alpm_db_get_pkgfromcache(db, info->name);
if(local) {
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, info, NULL);
_alpm_log(PM_LOG_FLOW1, "upgrading package %s-%s", info->name, info->version);
/* we'll need to save some record for backup checks later */
- oldpkg = pkg_new(local->name, local->version);
+ oldpkg = _alpm_pkg_new(local->name, local->version);
if(oldpkg) {
if(!(local->infolevel & INFRQ_FILES)) {
char name[PKG_FULLNAME_LEN];
snprintf(name, PKG_FULLNAME_LEN, "%s-%s", local->name, local->version);
_alpm_log(PM_LOG_DEBUG, "loading FILES info for %s", local->name);
- db_read(db, name, INFRQ_FILES, local);
+ _alpm_db_read(db, name, INFRQ_FILES, local);
}
oldpkg->backup = _alpm_list_strdup(local->backup);
}
@@ -329,23 +329,23 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
if(oldpkg) {
pmtrans_t *tr;
_alpm_log(PM_LOG_FLOW1, "removing old package first (%s-%s)", oldpkg->name, oldpkg->version);
- tr = trans_new();
+ tr = _alpm_trans_new();
if(tr == NULL) {
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
- if(trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags, NULL, NULL) == -1) {
+ if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags, NULL, NULL) == -1) {
FREETRANS(tr);
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
/* copy over the install reason */
info->reason = local->reason;
- if(remove_loadtarget(tr, db, info->name) == -1) {
+ if(_alpm_remove_loadtarget(tr, db, info->name) == -1) {
FREETRANS(tr);
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
/* copy the skiplist over */
tr->skiplist = _alpm_list_strdup(trans->skiplist);
- if(remove_commit(tr, db) == -1) {
+ if(_alpm_remove_commit(tr, db) == -1) {
FREETRANS(tr);
RET_ERR(PM_ERR_TRANS_ABORT, -1);
}
@@ -404,7 +404,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
* eg, /home/httpd/html/index.html may be removed so index.php
* could be used.
*/
- if(pm_list_is_strin(pathname, handle->noextract)) {
+ if(_alpm_list_is_strin(pathname, handle->noextract)) {
alpm_logaction("notice: %s is in NoExtract -- skipping extraction", pathname);
tar_skip_regfile(tar);
continue;
@@ -412,11 +412,11 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
if(!stat(expath, &buf) && !S_ISDIR(buf.st_mode)) {
/* file already exists */
- if(pm_list_is_strin(pathname, handle->noupgrade)) {
+ if(_alpm_list_is_strin(pathname, handle->noupgrade)) {
notouch = 1;
} else {
if(!pmo_upgrade || oldpkg == NULL) {
- nb = pm_list_is_strin(pathname, info->backup);
+ nb = _alpm_list_is_strin(pathname, info->backup);
} else {
/* op == PM_TRANS_TYPE_UPGRADE */
md5_orig = _alpm_needbackup(pathname, oldpkg->backup);
@@ -593,7 +593,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
/* Update the requiredby field by scanning the whole database
* looking for packages depending on the package to add */
- for(lp = db_get_pkgcache(db); lp; lp = lp->next) {
+ for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *tmpp = lp->data;
PMList *tmppm = NULL;
if(tmpp == NULL) {
@@ -601,12 +601,12 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
}
for(tmppm = tmpp->depends; tmppm; tmppm = tmppm->next) {
pmdepend_t depend;
- if(splitdep(tmppm->data, &depend)) {
+ if(_alpm_splitdep(tmppm->data, &depend)) {
continue;
}
if(tmppm->data && !strcmp(depend.name, info->name)) {
_alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'", tmpp->name, info->name);
- info->requiredby = pm_list_add(info->requiredby, strdup(tmpp->name));
+ info->requiredby = _alpm_list_add(info->requiredby, strdup(tmpp->name));
}
}
}
@@ -618,13 +618,13 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
_alpm_log(PM_LOG_FLOW1, "updating database");
_alpm_log(PM_LOG_FLOW2, "adding database entry '%s'", info->name);
- if(db_write(db, info, INFRQ_ALL)) {
+ if(_alpm_db_write(db, info, INFRQ_ALL)) {
_alpm_log(PM_LOG_ERROR, "could not update database entry %s-%s",
info->name, info->version);
alpm_logaction(NULL, "error updating database for %s-%s!", info->name, info->version);
RET_ERR(PM_ERR_DB_WRITE, -1);
}
- if(db_add_pkgincache(db, info) == -1) {
+ if(_alpm_db_add_pkgincache(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, "could not add entry '%s' in cache", info->name);
}
@@ -635,10 +635,10 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
for(lp = info->depends; lp; lp = lp->next) {
pmpkg_t *depinfo;
pmdepend_t depend;
- if(splitdep(lp->data, &depend)) {
+ if(_alpm_splitdep(lp->data, &depend)) {
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);
@@ -647,7 +647,7 @@ int add_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) {
@@ -657,8 +657,8 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
}
}
_alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'", info->name, depinfo->name);
- depinfo->requiredby = pm_list_add(depinfo->requiredby, strdup(info->name));
- if(db_write(db, depinfo, INFRQ_DEPENDS)) {
+ depinfo->requiredby = _alpm_list_add(depinfo->requiredby, strdup(info->name));
+ 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);
}
diff --git a/lib/libalpm/add.h b/lib/libalpm/add.h
index 36382022..2b945b22 100644
--- a/lib/libalpm/add.h
+++ b/lib/libalpm/add.h
@@ -25,9 +25,9 @@
#include "db.h"
#include "trans.h"
-int add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
-int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data);
-int add_commit(pmtrans_t *trans, pmdb_t *db);
+int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
+int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data);
+int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db);
#endif /* _ALPM_ADD_H */
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 7ac7ada2..41cd49f1 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -102,12 +102,12 @@ int alpm_release()
/* close local database */
if(handle->db_local) {
- db_close(handle->db_local);
+ _alpm_db_close(handle->db_local);
handle->db_local = NULL;
}
/* and also sync ones */
for(i = handle->dbs_sync; i; i = i->next) {
- db_close(i->data);
+ _alpm_db_close(i->data);
i->data = NULL;
}
@@ -197,7 +197,7 @@ pmdb_t *alpm_db_register(char *treename)
}
}
- db = db_open(path, treename, DB_O_CREATE);
+ db = _alpm_db_open(path, treename, DB_O_CREATE);
if(db == NULL) {
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
@@ -205,7 +205,7 @@ pmdb_t *alpm_db_register(char *treename)
if(strcmp(treename, "local") == 0) {
handle->db_local = db;
} else {
- handle->dbs_sync = pm_list_add(handle->dbs_sync, db);
+ handle->dbs_sync = _alpm_list_add(handle->dbs_sync, db);
}
return(db);
@@ -238,14 +238,14 @@ int alpm_db_unregister(pmdb_t *db)
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
if(db == handle->db_local) {
- db_close(handle->db_local);
+ _alpm_db_close(handle->db_local);
handle->db_local = NULL;
found = 1;
} else {
pmdb_t *data;
handle->dbs_sync = _alpm_list_remove(handle->dbs_sync, db, db_cmp, (void **)&data);
if(data) {
- db_close(data);
+ _alpm_db_close(data);
found = 1;
}
}
@@ -294,14 +294,14 @@ int alpm_db_update(PM_DB *db, char *archive)
/* Do not update a database if a transaction is on-going */
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
- if(!pm_list_is_in(db, handle->dbs_sync)) {
+ if(!_alpm_list_is_in(db, handle->dbs_sync)) {
RET_ERR(PM_ERR_DB_NOT_FOUND, -1);
}
/* remove the old dir */
_alpm_log(PM_LOG_FLOW2, "flushing database %s/%s", handle->dbpath, db->treename);
- for(lp = db_get_pkgcache(db); lp; lp = lp->next) {
- if(db_remove(db, lp->data) == -1) {
+ for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
+ if(_alpm_db_remove(db, lp->data) == -1) {
if(lp->data) {
_alpm_log(PM_LOG_ERROR, "could not remove database entry %s/%s", db->treename,
((pmpkg_t *)lp->data)->name);
@@ -311,7 +311,7 @@ int alpm_db_update(PM_DB *db, char *archive)
}
/* Cache needs to be rebuild */
- db_free_pkgcache(db);
+ _alpm_db_free_pkgcache(db);
/* uncompress the sync database */
/* ORE
@@ -337,7 +337,7 @@ pmpkg_t *alpm_db_readpkg(pmdb_t *db, char *name)
ASSERT(db != NULL, return(NULL));
ASSERT(name != NULL && strlen(name) != 0, return(NULL));
- return(db_get_pkgfromcache(db, name));
+ return(_alpm_db_get_pkgfromcache(db, name));
}
/** Get the package cache of a package database
@@ -350,7 +350,7 @@ PMList *alpm_db_getpkgcache(pmdb_t *db)
ASSERT(handle != NULL, return(NULL));
ASSERT(db != NULL, return(NULL));
- return(db_get_pkgcache(db));
+ return(_alpm_db_get_pkgcache(db));
}
/** Get a group entry from a package database
@@ -365,7 +365,7 @@ pmgrp_t *alpm_db_readgrp(pmdb_t *db, char *name)
ASSERT(db != NULL, return(NULL));
ASSERT(name != NULL && strlen(name) != 0, return(NULL));
- return(db_get_grpfromcache(db, name));
+ return(_alpm_db_get_grpfromcache(db, name));
}
/** Get the group cache of a package database
@@ -378,7 +378,7 @@ PMList *alpm_db_getgrpcache(pmdb_t *db)
ASSERT(handle != NULL, return(NULL));
ASSERT(db != NULL, return(NULL));
- return(db_get_grpcache(db));
+ return(_alpm_db_get_grpcache(db));
}
/** @} */
@@ -434,7 +434,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
if(!(pkg->infolevel & INFRQ_DEPENDS)) {
char target[PKG_FULLNAME_LEN];
snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
- db_read(pkg->data, target, INFRQ_DEPENDS, pkg);
+ _alpm_db_read(pkg->data, target, INFRQ_DEPENDS, pkg);
}
break;*/
/* Files entry */
@@ -443,7 +443,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_FILES)) {
char target[PKG_FULLNAME_LEN];
snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
- db_read(pkg->data, target, INFRQ_FILES, pkg);
+ _alpm_db_read(pkg->data, target, INFRQ_FILES, pkg);
}
break;
/* Scriptlet */
@@ -451,7 +451,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
if(pkg->data == handle->db_local && !(pkg->infolevel & INFRQ_SCRIPLET)) {
char target[PKG_FULLNAME_LEN];
snprintf(target, PKG_FULLNAME_LEN, "%s-%s", pkg->name, pkg->version);
- db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
+ _alpm_db_read(pkg->data, target, INFRQ_SCRIPLET, pkg);
}
break;
}
@@ -499,7 +499,7 @@ int alpm_pkg_load(char *filename, pmpkg_t **pkg)
ASSERT(filename != NULL && strlen(filename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- *pkg = pkg_load(filename);
+ *pkg = _alpm_pkg_load(filename);
if(*pkg == NULL) {
/* pm_errno is set by pkg_load */
return(-1);
@@ -518,7 +518,7 @@ int alpm_pkg_free(pmpkg_t *pkg)
/* Only free packages loaded in user space */
if(pkg->origin != PKG_FROM_CACHE) {
- pkg_free(pkg);
+ _alpm_pkg_free(pkg);
}
return(0);
@@ -570,7 +570,7 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg)
*/
int alpm_pkg_vercmp(const char *ver1, const char *ver2)
{
- return(versioncmp(ver1, ver2));
+ return(_alpm_versioncmp(ver1, ver2));
}
/** @} */
@@ -689,12 +689,12 @@ int alpm_trans_init(unsigned char type, unsigned char flags, alpm_trans_cb_event
RET_ERR(PM_ERR_HANDLE_LOCK, -1);
}
- handle->trans = trans_new();
+ handle->trans = _alpm_trans_new();
if(handle->trans == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
- return(trans_init(handle->trans, type, flags, event, conv));
+ return(_alpm_trans_init(handle->trans, type, flags, event, conv));
}
/** Search for packages to upgrade and add them to the transaction.
@@ -711,7 +711,7 @@ int alpm_trans_sysupgrade()
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
- return(trans_sysupgrade(trans));
+ return(_alpm_trans_sysupgrade(trans));
}
/** Add a target to the transaction.
@@ -730,7 +730,7 @@ int alpm_trans_addtarget(char *target)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
- return(trans_addtarget(trans, target));
+ return(_alpm_trans_addtarget(trans, target));
}
/** Prepare a transaction.
@@ -749,7 +749,7 @@ int alpm_trans_prepare(PMList **data)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
- return(trans_prepare(handle->trans, data));
+ return(_alpm_trans_prepare(handle->trans, data));
}
/** Commit a transaction.
@@ -771,7 +771,7 @@ int alpm_trans_commit(PMList **data)
/* Check for database R/W permission */
ASSERT(handle->access == PM_ACCESS_RW, RET_ERR(PM_ERR_BADPERMS, -1));
- return(trans_commit(handle->trans, data));
+ return(_alpm_trans_commit(handle->trans, data));
}
/** Release a transaction.
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 709ba383..58717b5a 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -46,7 +46,7 @@ static int pkg_cmp(const void *p1, const void *p2)
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
-int db_load_pkgcache(pmdb_t *db)
+int _alpm_db_load_pkgcache(pmdb_t *db)
{
pmpkg_t *info;
/* The group cache needs INFRQ_DESC as well */
@@ -56,23 +56,23 @@ int db_load_pkgcache(pmdb_t *db)
return(-1);
}
- db_free_pkgcache(db);
+ _alpm_db_free_pkgcache(db);
_alpm_log(PM_LOG_DEBUG, "loading package cache (infolevel=%#x) for repository '%s'",
infolevel, db->treename);
- db_rewind(db);
- while((info = db_scan(db, NULL, infolevel)) != NULL) {
+ _alpm_db_rewind(db);
+ while((info = _alpm_db_scan(db, NULL, infolevel)) != NULL) {
info->origin = PKG_FROM_CACHE;
info->data = db;
/* add to the collective */
- db->pkgcache = pm_list_add_sorted(db->pkgcache, info, pkg_cmp);
+ db->pkgcache = _alpm_list_add_sorted(db->pkgcache, info, pkg_cmp);
}
return(0);
}
-void db_free_pkgcache(pmdb_t *db)
+void _alpm_db_free_pkgcache(pmdb_t *db)
{
if(db == NULL || db->pkgcache == NULL) {
return;
@@ -84,24 +84,24 @@ void db_free_pkgcache(pmdb_t *db)
FREELISTPKGS(db->pkgcache);
if(db->grpcache) {
- db_free_grpcache(db);
+ _alpm_db_free_grpcache(db);
}
}
-PMList *db_get_pkgcache(pmdb_t *db)
+PMList *_alpm_db_get_pkgcache(pmdb_t *db)
{
if(db == NULL) {
return(NULL);
}
if(db->pkgcache == NULL) {
- db_load_pkgcache(db);
+ _alpm_db_load_pkgcache(db);
}
return(db->pkgcache);
}
-int db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
+int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *newpkg;
@@ -109,19 +109,19 @@ int db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
- newpkg = pkg_dup(pkg);
+ newpkg = _alpm_pkg_dup(pkg);
if(newpkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "adding entry %s in '%s' cache", newpkg->name, db->treename);
- db->pkgcache = pm_list_add_sorted(db->pkgcache, newpkg, pkg_cmp);
+ db->pkgcache = _alpm_list_add_sorted(db->pkgcache, newpkg, pkg_cmp);
- db_free_grpcache(db);
+ _alpm_db_free_grpcache(db);
return(0);
}
-int db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
+int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
{
pmpkg_t *data;
@@ -138,24 +138,24 @@ int db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
_alpm_log(PM_LOG_DEBUG, "removing entry %s from '%s' cache", pkg->name, db->treename);
FREEPKG(data);
- db_free_grpcache(db);
+ _alpm_db_free_grpcache(db);
return(0);
}
-pmpkg_t *db_get_pkgfromcache(pmdb_t *db, char *target)
+pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target)
{
if(db == NULL) {
return(NULL);
}
- return(pkg_isin(target, db_get_pkgcache(db)));
+ return(_alpm_pkg_isin(target, _alpm_db_get_pkgcache(db)));
}
/* Returns a new group cache from db.
* It frees the cache if it already exists.
*/
-int db_load_grpcache(pmdb_t *db)
+int _alpm_db_load_grpcache(pmdb_t *db)
{
PMList *lp;
@@ -164,7 +164,7 @@ int db_load_grpcache(pmdb_t *db)
}
if(db->pkgcache == NULL) {
- db_load_pkgcache(db);
+ _alpm_db_load_pkgcache(db);
}
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'", db->treename);
@@ -174,12 +174,12 @@ int db_load_grpcache(pmdb_t *db)
pmpkg_t *pkg = lp->data;
for(i = pkg->groups; i; i = i->next) {
- if(!pm_list_is_strin(i->data, db->grpcache)) {
- pmgrp_t *grp = grp_new();
+ if(!_alpm_list_is_strin(i->data, db->grpcache)) {
+ pmgrp_t *grp = _alpm_grp_new();
STRNCPY(grp->name, (char *)i->data, GRP_NAME_LEN);
- grp->packages = pm_list_add_sorted(grp->packages, pkg->name, grp_cmp);
- db->grpcache = pm_list_add_sorted(db->grpcache, grp, grp_cmp);
+ grp->packages = _alpm_list_add_sorted(grp->packages, pkg->name, _alpm_grp_cmp);
+ db->grpcache = _alpm_list_add_sorted(db->grpcache, grp, _alpm_grp_cmp);
} else {
PMList *j;
@@ -187,8 +187,8 @@ int db_load_grpcache(pmdb_t *db)
pmgrp_t *grp = j->data;
if(strcmp(grp->name, i->data) == 0) {
- if(!pm_list_is_strin(pkg->name, grp->packages)) {
- grp->packages = pm_list_add_sorted(grp->packages, (char *)pkg->name, grp_cmp);
+ if(!_alpm_list_is_strin(pkg->name, grp->packages)) {
+ grp->packages = _alpm_list_add_sorted(grp->packages, (char *)pkg->name, _alpm_grp_cmp);
}
}
}
@@ -199,7 +199,7 @@ int db_load_grpcache(pmdb_t *db)
return(0);
}
-void db_free_grpcache(pmdb_t *db)
+void _alpm_db_free_grpcache(pmdb_t *db)
{
PMList *lg;
@@ -216,20 +216,20 @@ void db_free_grpcache(pmdb_t *db)
FREELIST(db->grpcache);
}
-PMList *db_get_grpcache(pmdb_t *db)
+PMList *_alpm_db_get_grpcache(pmdb_t *db)
{
if(db == NULL) {
return(NULL);
}
if(db->grpcache == NULL) {
- db_load_grpcache(db);
+ _alpm_db_load_grpcache(db);
}
return(db->grpcache);
}
-pmgrp_t *db_get_grpfromcache(pmdb_t *db, char *target)
+pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target)
{
PMList *i;
@@ -237,7 +237,7 @@ pmgrp_t *db_get_grpfromcache(pmdb_t *db, char *target)
return(NULL);
}
- for(i = db_get_grpcache(db); i; i = i->next) {
+ for(i = _alpm_db_get_grpcache(db); i; i = i->next) {
pmgrp_t *info = i->data;
if(strcmp(info->name, target) == 0) {
diff --git a/lib/libalpm/cache.h b/lib/libalpm/cache.h
index 94b1c062..c1ab844e 100644
--- a/lib/libalpm/cache.h
+++ b/lib/libalpm/cache.h
@@ -27,17 +27,17 @@
#include "db.h"
/* packages */
-int db_load_pkgcache(pmdb_t *db);
-void db_free_pkgcache(pmdb_t *db);
-int db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
-int db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-PMList *db_get_pkgcache(pmdb_t *db);
-pmpkg_t *db_get_pkgfromcache(pmdb_t *db, char *target);
+int _alpm_db_load_pkgcache(pmdb_t *db);
+void _alpm_db_free_pkgcache(pmdb_t *db);
+int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
+int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
+PMList *_alpm_db_get_pkgcache(pmdb_t *db);
+pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
/* groups */
-int db_load_grpcache(pmdb_t *db);
-void db_free_grpcache(pmdb_t *db);
-PMList *db_get_grpcache(pmdb_t *db);
-pmgrp_t *db_get_grpfromcache(pmdb_t *db, char *target);
+int _alpm_db_load_grpcache(pmdb_t *db);
+void _alpm_db_free_grpcache(pmdb_t *db);
+PMList *_alpm_db_get_grpcache(pmdb_t *db);
+pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target);
#endif /* _ALPM_CACHE_H */
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 5836a9d6..a2f85153 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -38,7 +38,7 @@
*
* conflicts are always name only
*/
-PMList *checkconflicts(pmdb_t *db, PMList *packages)
+PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages)
{
pmpkg_t *info = NULL;
PMList *i, *j, *k;
@@ -61,7 +61,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
continue;
}
/* CHECK 1: check targets against database */
- for(k = db_get_pkgcache(db); k; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
pmpkg_t *dp = (pmpkg_t *)k->data;
if(!strcmp(dp->name, tp->name)) {
/* a package cannot conflict with itself -- that's just not nice */
@@ -71,9 +71,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
/* conflict */
_alpm_log(PM_LOG_DEBUG, "targs vs db: found %s as a conflict for %s",
dp->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -85,9 +85,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
/* confict */
_alpm_log(PM_LOG_DEBUG, "targs vs db: found %s as a conflict for %s",
dp->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, dp->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -106,9 +106,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
/* otp is listed in tp's conflict list */
_alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
otp->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -119,9 +119,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
if(!strcmp(m->data, j->data)) {
_alpm_log(PM_LOG_DEBUG, "targs vs targs: found %s as a conflict for %s",
otp->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, otp->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -131,7 +131,7 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
}
}
/* CHECK 3: check database against targets */
- for(k = db_get_pkgcache(db); k; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db); k; k = k->next) {
info = k->data;
if(!strcmp(info->name, tp->name)) {
/* a package cannot conflict with itself -- that's just not nice */
@@ -141,9 +141,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
if(!strcmp((char *)j->data, tp->name)) {
_alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s",
info->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -156,9 +156,9 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
if(!strcmp(m->data, n->data)) {
_alpm_log(PM_LOG_DEBUG, "db vs targs: found %s as a conflict for %s",
info->name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_CONFLICT, PM_DEP_MOD_ANY, info->name, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -173,12 +173,11 @@ PMList *checkconflicts(pmdb_t *db, PMList *packages)
return(baddeps);
}
-PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip_list)
+PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip_list)
{
PMList *i, *j, *k;
char *filestr = NULL;
char path[PATH_MAX+1];
- char *str = NULL;
struct stat buf, buf2;
PMList *conflicts = NULL;
@@ -201,13 +200,13 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
if(!strcmp(filestr, "._install") || !strcmp(filestr, ".INSTALL")) {
continue;
}
- if(pm_list_is_strin(filestr, p2->files)) {
+ if(_alpm_list_is_strin(filestr, p2->files)) {
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
conflict->type = PM_CONFLICT_TYPE_TARGET;
STRNCPY(conflict->target, p1->name, PKG_NAME_LEN);
STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
STRNCPY(conflict->ctarget, p2->name, PKG_NAME_LEN);
- conflicts = pm_list_add(conflicts, conflict);
+ conflicts = _alpm_list_add(conflicts, conflict);
}
}
}
@@ -243,9 +242,9 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
ok = 1;
} else {
if(dbpkg == NULL) {
- dbpkg = db_scan(db, p->name, INFRQ_DESC | INFRQ_FILES);
+ dbpkg = _alpm_db_scan(db, p->name, INFRQ_DESC | INFRQ_FILES);
}
- if(dbpkg && pm_list_is_strin(j->data, dbpkg->files)) {
+ if(dbpkg && _alpm_list_is_strin(j->data, dbpkg->files)) {
ok = 1;
}
/* Make sure that the supposedly-conflicting file is not actually just
@@ -270,9 +269,9 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
/* As long as they're not the current package */
if(strcmp(p1->name, p->name)) {
pmpkg_t *dbpkg2 = NULL;
- dbpkg2 = db_scan(db, p1->name, INFRQ_DESC | INFRQ_FILES);
+ dbpkg2 = _alpm_db_scan(db, p1->name, INFRQ_DESC | INFRQ_FILES);
/* If it used to exist in there, but doesn't anymore */
- if(dbpkg2 && !pm_list_is_strin(filestr, p1->files) && pm_list_is_strin(filestr, dbpkg2->files)) {
+ if(dbpkg2 && !_alpm_list_is_strin(filestr, p1->files) && _alpm_list_is_strin(filestr, dbpkg2->files)) {
ok = 1;
/* Add to the "skip list" of files that we shouldn't remove during an upgrade.
*
@@ -290,7 +289,7 @@ PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip
* Our workaround is to scan through all "old" packages and all "new"
* ones, looking for files that jump to different packages.
*/
- *skip_list = pm_list_add(*skip_list, strdup(filestr));
+ *skip_list = _alpm_list_add(*skip_list, strdup(filestr));
}
FREEPKG(dbpkg2);
}
@@ -304,7 +303,7 @@ donecheck:
STRNCPY(conflict->target, p->name, PKG_NAME_LEN);
STRNCPY(conflict->file, filestr, CONFLICT_FILE_LEN);
conflict->ctarget[0] = 0;
- conflicts = pm_list_add(conflicts, conflict);
+ conflicts = _alpm_list_add(conflicts, conflict);
}
}
}
diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h
index c8143641..7b8c9643 100644
--- a/lib/libalpm/conflict.h
+++ b/lib/libalpm/conflict.h
@@ -32,8 +32,8 @@ typedef struct __pmconflict_t {
char ctarget[PKG_NAME_LEN];
} pmconflict_t;
-PMList *checkconflicts(pmdb_t *db, PMList *packages);
-PMList *db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip_list);
+PMList *_alpm_checkconflicts(pmdb_t *db, PMList *packages);
+PMList *_alpm_db_find_conflicts(pmdb_t *db, PMList *targets, char *root, PMList **skip_list);
#endif /* _ALPM_CONFLICT_H */
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index c60ab353..dd5f61c9 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -38,7 +38,7 @@
#include "alpm.h"
/* Open a database and return a pmdb_t handle */
-pmdb_t *db_open(char *dbpath, char *treename, int mode)
+pmdb_t *_alpm_db_open(char *dbpath, char *treename, int mode)
{
pmdb_t *db;
@@ -76,7 +76,7 @@ pmdb_t *db_open(char *dbpath, char *treename, int mode)
return(db);
}
-void db_close(pmdb_t *db)
+void _alpm_db_close(pmdb_t *db)
{
if(db == NULL) {
return;
@@ -90,15 +90,15 @@ void db_close(pmdb_t *db)
}
FREE(db->path);
- db_free_pkgcache(db);
- db_free_grpcache(db);
+ _alpm_db_free_pkgcache(db);
+ _alpm_db_free_grpcache(db);
free(db);
return;
}
-void db_rewind(pmdb_t *db)
+void _alpm_db_rewind(pmdb_t *db)
{
if(db == NULL || db->dir == NULL) {
return;
@@ -107,7 +107,7 @@ void db_rewind(pmdb_t *db)
rewinddir(db->dir);
}
-pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq)
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
{
struct dirent *ent = NULL;
struct stat sbuf;
@@ -123,7 +123,7 @@ pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq)
if(target != NULL) {
/* search for a specific package (by name only) */
- db_rewind(db);
+ _alpm_db_rewind(db);
while(!found && (ent = readdir(db->dir)) != NULL) {
if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) {
continue;
@@ -169,18 +169,18 @@ pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq)
}
}
- pkg = pkg_new(NULL, NULL);
+ pkg = _alpm_pkg_new(NULL, NULL);
if(pkg == NULL) {
return(NULL);
}
- if(db_read(db, ent->d_name, inforeq, pkg) == -1) {
+ if(_alpm_db_read(db, ent->d_name, inforeq, pkg) == -1) {
FREEPKG(pkg);
}
return(pkg);
}
-int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
+int _alpm_db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
{
FILE *fp = NULL;
struct stat buf;
@@ -198,7 +198,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
}
if(info->name[0] == 0) {
- if(pkg_splitname(name, info->name, info->version) == -1) {
+ if(_alpm_pkg_splitname(name, info->name, info->version) == -1) {
return(-1);
}
}
@@ -223,7 +223,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(info->desc);
} else if(!strcmp(line, "%GROUPS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->groups = pm_list_add(info->groups, strdup(line));
+ info->groups = _alpm_list_add(info->groups, strdup(line));
}
} else if(!strcmp(line, "%URL%")) {
if(fgets(info->url, sizeof(info->url), fp) == NULL) {
@@ -232,7 +232,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(info->url);
} else if(!strcmp(line, "%LICENSE%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->license = pm_list_add(info->license, strdup(line));
+ info->license = _alpm_list_add(info->license, strdup(line));
}
} else if(!strcmp(line, "%ARCH%")) {
if(fgets(info->arch, sizeof(info->arch), fp) == NULL) {
@@ -287,7 +287,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
/* the REPLACES tag is special -- it only appears in sync repositories,
* not the local one. */
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->replaces = pm_list_add(info->replaces, strdup(line));
+ info->replaces = _alpm_list_add(info->replaces, strdup(line));
}
} else if(!strcmp(line, "%FORCE%")) {
/* FORCE tag only appears in sync repositories,
@@ -311,11 +311,11 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(line);
if(!strcmp(line, "%FILES%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->files = pm_list_add(info->files, strdup(line));
+ info->files = _alpm_list_add(info->files, strdup(line));
}
} else if(!strcmp(line, "%BACKUP%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->backup = pm_list_add(info->backup, strdup(line));
+ info->backup = _alpm_list_add(info->backup, strdup(line));
}
}
}
@@ -336,25 +336,25 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
_alpm_strtrim(line);
if(!strcmp(line, "%DEPENDS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->depends = pm_list_add(info->depends, strdup(line));
+ info->depends = _alpm_list_add(info->depends, strdup(line));
}
} else if(!strcmp(line, "%REQUIREDBY%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->requiredby = pm_list_add(info->requiredby, strdup(line));
+ info->requiredby = _alpm_list_add(info->requiredby, strdup(line));
}
} else if(!strcmp(line, "%CONFLICTS%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->conflicts = pm_list_add(info->conflicts, strdup(line));
+ info->conflicts = _alpm_list_add(info->conflicts, strdup(line));
}
} else if(!strcmp(line, "%PROVIDES%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->provides = pm_list_add(info->provides, strdup(line));
+ info->provides = _alpm_list_add(info->provides, strdup(line));
}
} else if(!strcmp(line, "%REPLACES%")) {
/* the REPLACES tag is special -- it only appears in sync repositories,
* not the local one. */
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
- info->replaces = pm_list_add(info->replaces, strdup(line));
+ info->replaces = _alpm_list_add(info->replaces, strdup(line));
}
} else if(!strcmp(line, "%FORCE%")) {
/* FORCE tag only appears in sync repositories,
@@ -386,7 +386,7 @@ error:
return(-1);
}
-int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
{
char topdir[PATH_MAX];
FILE *fp = NULL;
@@ -482,7 +482,7 @@ int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
}
/* FILES */
- if(local && inforeq & INFRQ_FILES) {
+ if(local && (inforeq & INFRQ_FILES)) {
snprintf(path, PATH_MAX, "%s/files", topdir);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, "db_write: could not open file %s/files", db->treename);
@@ -573,7 +573,7 @@ cleanup:
return(retval);
}
-int db_remove(pmdb_t *db, pmpkg_t *info)
+int _alpm_db_remove(pmdb_t *db, pmpkg_t *info)
{
char topdir[PATH_MAX];
char file[PATH_MAX];
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index a07ed52f..a86940f7 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -47,13 +47,13 @@ typedef struct __pmdb_t {
PMList *grpcache;
} pmdb_t;
-pmdb_t *db_open(char *path, char *treename, int mode);
-void db_close(pmdb_t *db);
-void db_rewind(pmdb_t *db);
-pmpkg_t *db_scan(pmdb_t *db, char *target, unsigned int inforeq);
-int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info);
-int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq);
-int db_remove(pmdb_t *db, pmpkg_t *info);
+pmdb_t *_alpm_db_open(char *path, char *treename, int mode);
+void _alpm_db_close(pmdb_t *db);
+void _alpm_db_rewind(pmdb_t *db);
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq);
+int _alpm_db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info);
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq);
+int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
#endif /* _ALPM_DB_H */
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 721ec21c..0a9838c3 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -37,7 +37,7 @@
extern pmhandle_t *handle;
-pmdepmissing_t *depmiss_new(const char *target, unsigned char type, unsigned char depmod,
+pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
const char *depname, const char *depversion)
{
pmdepmissing_t *miss;
@@ -60,7 +60,7 @@ pmdepmissing_t *depmiss_new(const char *target, unsigned char type, unsigned cha
return(miss);
}
-int depmiss_isin(pmdepmissing_t *needle, PMList *haystack)
+int _alpm_depmiss_isin(pmdepmissing_t *needle, PMList *haystack)
{
PMList *i;
@@ -90,7 +90,7 @@ int depmiss_isin(pmdepmissing_t *needle, PMList *haystack)
* This function returns the new PMList* target list.
*
*/
-PMList *sortbydeps(PMList *targets, int mode)
+PMList *_alpm_sortbydeps(PMList *targets, int mode)
{
PMList *newtargs = NULL;
PMList *i, *j, *k;
@@ -103,7 +103,7 @@ PMList *sortbydeps(PMList *targets, int mode)
}
for(i = targets; i; i = i->next) {
- newtargs = pm_list_add(newtargs, i->data);
+ newtargs = _alpm_list_add(newtargs, i->data);
numtargs++;
}
@@ -121,7 +121,7 @@ PMList *sortbydeps(PMList *targets, int mode)
for(j = p->depends; j; j = j->next) {
pmdepend_t dep;
pmpkg_t *q = NULL;
- if(splitdep(j->data, &dep)) {
+ if(_alpm_splitdep(j->data, &dep)) {
continue;
}
/* look for dep.name -- if it's farther down in the list, then
@@ -130,16 +130,16 @@ PMList *sortbydeps(PMList *targets, int mode)
for(k = i->next; k; k = k->next) {
q = (pmpkg_t *)k->data;
if(!strcmp(dep.name, q->name)) {
- if(!pkg_isin(q->name, tmptargs)) {
+ if(!_alpm_pkg_isin(q->name, tmptargs)) {
change = 1;
- tmptargs = pm_list_add(tmptargs, q);
+ tmptargs = _alpm_list_add(tmptargs, q);
}
break;
}
}
}
- if(!pkg_isin(p->name, tmptargs)) {
- tmptargs = pm_list_add(tmptargs, p);
+ if(!_alpm_pkg_isin(p->name, tmptargs)) {
+ tmptargs = _alpm_list_add(tmptargs, p);
}
}
FREELISTPTR(newtargs);
@@ -162,7 +162,7 @@ PMList *sortbydeps(PMList *targets, int mode)
* dependencies can include versions with depmod operators.
*
*/
-PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
+PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
{
pmdepend_t depend;
PMList *i, *j, *k;
@@ -186,24 +186,24 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
continue;
}
- if((oldpkg = db_get_pkgfromcache(db, tp->name)) == NULL) {
+ if((oldpkg = _alpm_db_get_pkgfromcache(db, tp->name)) == NULL) {
continue;
}
for(j = oldpkg->requiredby; j; j = j->next) {
char *ver;
pmpkg_t *p;
found = 0;
- if((p = db_get_pkgfromcache(db, j->data)) == NULL) {
+ if((p = _alpm_db_get_pkgfromcache(db, j->data)) == NULL) {
/* hmmm... package isn't installed.. */
continue;
}
- if(pkg_isin(p->name, packages)) {
+ if(_alpm_pkg_isin(p->name, packages)) {
/* this package is also in the upgrade list, so don't worry about it */
continue;
}
for(k = p->depends; k && !found; k = k->next) {
/* find the dependency info in p->depends */
- splitdep(k->data, &depend);
+ _alpm_splitdep(k->data, &depend);
if(!strcmp(depend.name, oldpkg->name)) {
found = 1;
}
@@ -229,7 +229,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(ptr = ver; *ptr != '-'; ptr++);
*ptr = '\0';
}
- cmp = versioncmp(ver, depend.version);
+ cmp = _alpm_versioncmp(ver, depend.version);
switch(depend.mod) {
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
@@ -239,9 +239,9 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
}
if(!found) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as required by %s", depend.name, p->name);
- miss = depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -259,10 +259,10 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(j = tp->depends; j; j = j->next) {
/* split into name/version pairs */
- splitdep((char *)j->data, &depend);
+ _alpm_splitdep((char *)j->data, &depend);
found = 0;
/* check database for literal packages */
- for(k = db_get_pkgcache(db); k && !found; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db); k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
if(!strcmp(p->name, depend.name)) {
if(depend.mod == PM_DEP_MOD_ANY) {
@@ -278,7 +278,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(ptr = ver; *ptr != '-'; ptr++);
*ptr = '\0';
}
- cmp = versioncmp(ver, depend.version);
+ cmp = _alpm_versioncmp(ver, depend.version);
switch(depend.mod) {
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
@@ -292,7 +292,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(k = packages; k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
/* see if the package names match OR if p provides depend.name */
- if(!strcmp(p->name, depend.name) || pm_list_is_strin(depend.name, p->provides)) {
+ if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) {
if(depend.mod == PM_DEP_MOD_ANY) {
/* accept any version */
found = 1;
@@ -306,7 +306,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(ptr = ver; *ptr != '-'; ptr++);
*ptr = '\0';
}
- cmp = versioncmp(ver, depend.version);
+ cmp = _alpm_versioncmp(ver, depend.version);
switch(depend.mod) {
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
@@ -335,7 +335,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
for(ptr = ver; *ptr != '-'; ptr++);
*ptr = '\0';
}
- cmp = versioncmp(ver, depend.version);
+ cmp = _alpm_versioncmp(ver, depend.version);
switch(depend.mod) {
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
@@ -350,9 +350,9 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
if(!found) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as a dependency for %s",
depend.name, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -368,11 +368,11 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
}
for(j = tp->requiredby; j; j = j->next) {
- if(!pm_list_is_strin((char *)j->data, packages)) {
+ if(!_alpm_list_is_strin((char *)j->data, packages)) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s as required by %s", (char *)j->data, tp->name);
- miss = depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
- if(!depmiss_isin(miss, baddeps)) {
- baddeps = pm_list_add(baddeps, miss);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = _alpm_list_add(baddeps, miss);
} else {
FREE(miss);
}
@@ -384,7 +384,7 @@ PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages)
return(baddeps);
}
-int splitdep(char *depstr, pmdepend_t *depend)
+int _alpm_splitdep(char *depstr, pmdepend_t *depend)
{
char *str = NULL;
char *ptr = NULL;
@@ -432,7 +432,7 @@ int splitdep(char *depstr, pmdepend_t *depend)
* I mean dependencies that are *only* required for packages in the target
* list, so they can be safely removed. This function is recursive.
*/
-PMList* removedeps(pmdb_t *db, PMList *targs)
+PMList* _alpm_removedeps(pmdb_t *db, PMList *targs)
{
PMList *i, *j, *k;
PMList *newtargs = targs;
@@ -447,11 +447,11 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
pmpkg_t *dep;
int needed = 0;
- if(splitdep(j->data, &depend)) {
+ if(_alpm_splitdep(j->data, &depend)) {
continue;
}
- dep = db_get_pkgfromcache(db, depend.name);
+ dep = _alpm_db_get_pkgfromcache(db, depend.name);
if(dep == NULL) {
/* package not found... look for a provisio instead */
k = _alpm_db_whatprovides(db, depend.name);
@@ -459,7 +459,7 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
_alpm_log(PM_LOG_WARNING, "cannot find package \"%s\" or anything that provides it!", depend.name);
continue;
}
- dep = db_get_pkgfromcache(db, ((pmpkg_t *)k->data)->name);
+ dep = _alpm_db_get_pkgfromcache(db, ((pmpkg_t *)k->data)->name);
if(dep == NULL) {
_alpm_log(PM_LOG_ERROR, "dep is NULL!");
/* wtf */
@@ -467,7 +467,7 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
}
FREELISTPTR(k);
}
- if(pkg_isin(dep->name, targs)) {
+ if(_alpm_pkg_isin(dep->name, targs)) {
continue;
}
@@ -479,24 +479,24 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
/* see if other packages need it */
for(k = dep->requiredby; k && !needed; k = k->next) {
- pmpkg_t *dummy = db_get_pkgfromcache(db, k->data);
- if(!pkg_isin(dummy->name, targs)) {
+ pmpkg_t *dummy = _alpm_db_get_pkgfromcache(db, k->data);
+ if(!_alpm_pkg_isin(dummy->name, targs)) {
needed = 1;
}
}
if(!needed) {
char *name;
- pmpkg_t *pkg = pkg_new(dep->name, dep->version);
+ pmpkg_t *pkg = _alpm_pkg_new(dep->name, dep->version);
if(pkg == NULL) {
_alpm_log(PM_LOG_ERROR, "could not allocate memory for a package structure");
continue;
}
asprintf(&name, "%s-%s", dep->name, dep->version);
/* add it to the target list */
- db_read(db, name, INFRQ_ALL, pkg);
- newtargs = pm_list_add(newtargs, pkg);
+ _alpm_db_read(db, name, INFRQ_ALL, pkg);
+ newtargs = _alpm_list_add(newtargs, pkg);
_alpm_log(PM_LOG_FLOW2, "adding %s to the targets", pkg->name);
- newtargs = removedeps(db, newtargs);
+ newtargs = _alpm_removedeps(db, newtargs);
FREE(name);
}
}
@@ -510,7 +510,7 @@ PMList* removedeps(pmdb_t *db, PMList *targs)
*
* make sure *list and *trail are already initialized
*/
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
PMList *trail, pmtrans_t *trans, PMList **data)
{
PMList *i, *j;
@@ -521,8 +521,8 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
return(-1);
}
- targ = pm_list_add(NULL, syncpkg);
- deps = checkdeps(local, PM_TRANS_TYPE_ADD, targ);
+ targ = _alpm_list_add(NULL, syncpkg);
+ deps = _alpm_checkdeps(local, PM_TRANS_TYPE_ADD, targ);
FREELISTPTR(targ);
if(deps == NULL) {
@@ -537,7 +537,7 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
/* check if one of the packages in *list already provides this dependency */
for(j = list; j && !found; j = j->next) {
pmpkg_t *sp = (pmpkg_t *)j->data;
- if(pm_list_is_strin(miss->depend.name, sp->provides)) {
+ if(_alpm_list_is_strin(miss->depend.name, sp->provides)) {
_alpm_log(PM_LOG_DEBUG, "%s provides dependency %s -- skipping",
sp->name, miss->depend.name);
found = 1;
@@ -550,7 +550,7 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
/* find the package in one of the repositories */
/* check literals */
for(j = dbs_sync; !sync && j; j = j->next) {
- sync = db_get_pkgfromcache(j->data, miss->depend.name);
+ sync = _alpm_db_get_pkgfromcache(j->data, miss->depend.name);
}
/* check provides */
for(j = dbs_sync; !sync && j; j = j->next) {
@@ -571,36 +571,36 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
+ *data = _alpm_list_add(*data, miss);
}
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
}
- if(pkg_isin(sync->name, list)) {
+ if(_alpm_pkg_isin(sync->name, list)) {
/* this dep is already in the target list */
_alpm_log(PM_LOG_DEBUG, "dependency %s is already in the target list -- skipping",
sync->name);
continue;
}
- if(!pkg_isin(sync->name, trail)) {
+ if(!_alpm_pkg_isin(sync->name, trail)) {
/* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in
* something we're not supposed to.
*/
int usedep = 1;
- if(pm_list_is_strin(sync->name, handle->ignorepkg)) {
- pmpkg_t *dummypkg = pkg_new(miss->target, NULL);
+ if(_alpm_list_is_strin(sync->name, handle->ignorepkg)) {
+ pmpkg_t *dummypkg = _alpm_pkg_new(miss->target, NULL);
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, sync, NULL, &usedep);
FREEPKG(dummypkg);
}
if(usedep) {
- trail = pm_list_add(trail, sync);
- if(resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
+ trail = _alpm_list_add(trail, sync);
+ if(_alpm_resolvedeps(local, dbs_sync, sync, list, trail, trans, data)) {
goto error;
}
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
sync->name, syncpkg->name);
- list = pm_list_add(list, sync);
+ list = _alpm_list_add(list, sync);
} else {
_alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target);
if(data) {
@@ -610,7 +610,7 @@ int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
+ *data = _alpm_list_add(*data, miss);
}
pm_errno = PM_ERR_UNSATISFIED_DEPS;
goto error;
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index fbbd6438..35d66308 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -36,14 +36,14 @@ typedef struct __pmdepmissing_t {
pmdepend_t depend;
} pmdepmissing_t;
-pmdepmissing_t *depmiss_new(const char *target, unsigned char type, unsigned char depmod,
+pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
const char *depname, const char *depversion);
-int depmiss_isin(pmdepmissing_t *needle, PMList *haystack);
-PMList *sortbydeps(PMList *targets, int mode);
-PMList *checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
-int splitdep(char *depstr, pmdepend_t *depend);
-PMList *removedeps(pmdb_t *db, PMList *targs);
-int resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
+int _alpm_depmiss_isin(pmdepmissing_t *needle, PMList *haystack);
+PMList *_alpm_sortbydeps(PMList *targets, int mode);
+PMList *_alpm_checkdeps(pmdb_t *db, unsigned char op, PMList *packages);
+int _alpm_splitdep(char *depstr, pmdepend_t *depend);
+PMList *_alpm_removedeps(pmdb_t *db, PMList *targs);
+int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList *list,
PMList *trail, pmtrans_t *trans, PMList **data);
#endif /* _ALPM_DEPS_H */
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 6d24597f..5d5ecbba 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -27,7 +27,7 @@
#include "util.h"
#include "group.h"
-pmgrp_t *grp_new()
+pmgrp_t *_alpm_grp_new()
{
pmgrp_t* grp;
@@ -42,7 +42,7 @@ pmgrp_t *grp_new()
return(grp);
}
-void grp_free(pmgrp_t *grp)
+void _alpm_grp_free(pmgrp_t *grp)
{
if(grp == NULL) {
return;
@@ -56,7 +56,7 @@ void grp_free(pmgrp_t *grp)
/* Helper function for sorting groups
*/
-int grp_cmp(const void *g1, const void *g2)
+int _alpm_grp_cmp(const void *g1, const void *g2)
{
pmgrp_t *grp1 = (pmgrp_t *)g1;
pmgrp_t *grp2 = (pmgrp_t *)g2;
diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h
index c00cc23e..6fa3a24c 100644
--- a/lib/libalpm/group.h
+++ b/lib/libalpm/group.h
@@ -31,7 +31,7 @@ typedef struct __pmgrp_t {
PMList *packages; /* List of strings */
} pmgrp_t;
-#define FREEGRP(p) do { if(p) { grp_free(p); p = NULL; } } while(0)
+#define FREEGRP(p) do { if(p) { _alpm_grp_free(p); p = NULL; } } while(0)
#define FREELISTGRPS(p) do { \
PMList *i; \
@@ -41,9 +41,9 @@ typedef struct __pmgrp_t {
FREELIST(p); \
} while(0)
-pmgrp_t *grp_new(void);
-void grp_free(pmgrp_t *grp);
-int grp_cmp(const void *g1, const void *g2);
+pmgrp_t *_alpm_grp_new(void);
+void _alpm_grp_free(pmgrp_t *grp);
+int _alpm_grp_cmp(const void *g1, const void *g2);
#endif /* _ALPM_GROUP_H */
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index b8a6713b..8d220ada 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -151,7 +151,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
break;
case PM_OPT_NOUPGRADE:
if((char *)data && strlen((char *)data) != 0) {
- handle->noupgrade = pm_list_add(handle->noupgrade, strdup((char *)data));
+ handle->noupgrade = _alpm_list_add(handle->noupgrade, strdup((char *)data));
_alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_NOUPGRADE", (char *)data);
} else {
FREELIST(handle->noupgrade);
@@ -160,7 +160,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
break;
case PM_OPT_NOEXTRACT:
if((char *)data && strlen((char *)data) != 0) {
- handle->noextract = pm_list_add(handle->noextract, strdup((char *)data));
+ handle->noextract = _alpm_list_add(handle->noextract, strdup((char *)data));
_alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_NOEXTRACT", (char *)data);
} else {
FREELIST(handle->noextract);
@@ -169,7 +169,7 @@ int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
break;
case PM_OPT_IGNOREPKG:
if((char *)data && strlen((char *)data) != 0) {
- handle->ignorepkg = pm_list_add(handle->ignorepkg, strdup((char *)data));
+ handle->ignorepkg = _alpm_list_add(handle->ignorepkg, strdup((char *)data));
_alpm_log(PM_LOG_FLOW2, "'%s' added to PM_OPT_IGNOREPKG", (char *)data);
} else {
FREELIST(handle->ignorepkg);
diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c
index e1113f5c..632ee2a3 100644
--- a/lib/libalpm/list.c
+++ b/lib/libalpm/list.c
@@ -27,7 +27,7 @@
/* pacman */
#include "list.h"
-PMList* _alpm_list_new()
+PMList *_alpm_list_new()
{
PMList *list = NULL;
@@ -54,7 +54,7 @@ void _alpm_list_free(PMList *list)
}
}
-PMList* pm_list_add(PMList *list, void *data)
+PMList *_alpm_list_add(PMList *list, void *data)
{
PMList *ptr, *lp;
@@ -88,7 +88,7 @@ PMList* pm_list_add(PMList *list, void *data)
/* Add items to a list in sorted order. Use the given comparision func to
* determine order.
*/
-PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn)
+PMList *_alpm_list_add_sorted(PMList *list, void *data, _alpm_fn_cmp fn)
{
PMList *add;
PMList *prev = NULL;
@@ -137,7 +137,7 @@ PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn)
* Otherwise, it is set to NULL.
* Return the new list (without the removed element).
*/
-PMList *_alpm_list_remove(PMList *haystack, void *needle, pm_fn_cmp fn, void **data)
+PMList *_alpm_list_remove(PMList *haystack, void *needle, _alpm_fn_cmp fn, void **data)
{
PMList *i = haystack;
@@ -194,7 +194,7 @@ int _alpm_list_count(PMList *list)
return(i);
}
-int pm_list_is_in(void *needle, PMList *haystack)
+int _alpm_list_is_in(void *needle, PMList *haystack)
{
PMList *lp;
@@ -208,7 +208,7 @@ int pm_list_is_in(void *needle, PMList *haystack)
/* Test for existence of a string in a PMList
*/
-int pm_list_is_strin(char *needle, PMList *haystack)
+int _alpm_list_is_strin(char *needle, PMList *haystack)
{
PMList *lp;
@@ -242,8 +242,8 @@ PMList *_alpm_list_remove_dupes(PMList *list)
PMList *i, *newlist = NULL;
for(i = list; i; i = i->next) {
- if(!pm_list_is_strin(i->data, newlist)) {
- newlist = pm_list_add(newlist, strdup(i->data));
+ if(!_alpm_list_is_strin(i->data, newlist)) {
+ newlist = _alpm_list_add(newlist, strdup(i->data));
}
}
return newlist;
@@ -253,7 +253,7 @@ PMList *_alpm_list_remove_dupes(PMList *list)
*
* The caller is responsible for freeing the old list
*/
-PMList* _alpm_list_reverse(PMList *list)
+PMList *_alpm_list_reverse(PMList *list)
{
/* simple but functional -- we just build a new list, starting
* with the old list's tail
@@ -262,7 +262,7 @@ PMList* _alpm_list_reverse(PMList *list)
PMList *lp;
for(lp = list->last; lp; lp = lp->prev) {
- newlist = pm_list_add(newlist, lp->data);
+ newlist = _alpm_list_add(newlist, lp->data);
}
return(newlist);
@@ -274,7 +274,7 @@ PMList *_alpm_list_strdup(PMList *list)
PMList *lp;
for(lp = list; lp; lp = lp->next) {
- newlist = pm_list_add(newlist, strdup(lp->data));
+ newlist = _alpm_list_add(newlist, strdup(lp->data));
}
return(newlist);
diff --git a/lib/libalpm/list.h b/lib/libalpm/list.h
index 55375314..0052efc4 100644
--- a/lib/libalpm/list.h
+++ b/lib/libalpm/list.h
@@ -41,16 +41,16 @@ typedef struct __pmlist_t PMList;
} while(0)
/* Sort comparison callback function declaration */
-typedef int (*pm_fn_cmp) (const void *, const void *);
+typedef int (*_alpm_fn_cmp) (const void *, const void *);
PMList *_alpm_list_new(void);
void _alpm_list_free(PMList *list);
-PMList *pm_list_add(PMList *list, void *data);
-PMList *pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn);
-PMList *_alpm_list_remove(PMList *haystack, void *needle, pm_fn_cmp fn, void **data);
+PMList *_alpm_list_add(PMList *list, void *data);
+PMList *_alpm_list_add_sorted(PMList *list, void *data, _alpm_fn_cmp fn);
+PMList *_alpm_list_remove(PMList *haystack, void *needle, _alpm_fn_cmp fn, void **data);
int _alpm_list_count(PMList *list);
-int pm_list_is_in(void *needle, PMList *haystack);
-int pm_list_is_strin(char *needle, PMList *haystack);
+int _alpm_list_is_in(void *needle, PMList *haystack);
+int _alpm_list_is_strin(char *needle, PMList *haystack);
PMList *_alpm_list_last(PMList *list);
PMList *_alpm_list_remove_dupes(PMList *list);
PMList *_alpm_list_reverse(PMList *list);
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 91b57b0e..7767297a 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -35,7 +35,7 @@
#include "package.h"
#include "alpm.h"
-pmpkg_t *pkg_new(const char *name, const char *version)
+pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
{
pmpkg_t* pkg = NULL;
@@ -79,7 +79,7 @@ pmpkg_t *pkg_new(const char *name, const char *version)
return(pkg);
}
-pmpkg_t *pkg_dup(pmpkg_t *pkg)
+pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
{
pmpkg_t* newpkg = NULL;
@@ -118,7 +118,7 @@ pmpkg_t *pkg_dup(pmpkg_t *pkg)
return(newpkg);
}
-void pkg_free(pmpkg_t *pkg)
+void _alpm_pkg_free(pmpkg_t *pkg)
{
if(pkg == NULL) {
return;
@@ -185,11 +185,11 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
} else if(!strcmp(key, "PKGDESC")) {
STRNCPY(info->desc, ptr, sizeof(info->desc));
} else if(!strcmp(key, "GROUP")) {
- info->groups = pm_list_add(info->groups, strdup(ptr));
+ info->groups = _alpm_list_add(info->groups, strdup(ptr));
} else if(!strcmp(key, "URL")) {
STRNCPY(info->url, ptr, sizeof(info->url));
} else if(!strcmp(key, "LICENSE")) {
- info->license = pm_list_add(info->license, strdup(ptr));
+ info->license = _alpm_list_add(info->license, strdup(ptr));
} else if(!strcmp(key, "BUILDDATE")) {
STRNCPY(info->builddate, ptr, sizeof(info->builddate));
} else if(!strcmp(key, "INSTALLDATE")) {
@@ -203,15 +203,15 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
STRNCPY(tmp, ptr, sizeof(tmp));
info->size = atol(tmp);
} else if(!strcmp(key, "DEPEND")) {
- info->depends = pm_list_add(info->depends, strdup(ptr));
+ info->depends = _alpm_list_add(info->depends, strdup(ptr));
} else if(!strcmp(key, "CONFLICT")) {
- info->conflicts = pm_list_add(info->conflicts, strdup(ptr));
+ info->conflicts = _alpm_list_add(info->conflicts, strdup(ptr));
} else if(!strcmp(key, "REPLACES")) {
- info->replaces = pm_list_add(info->replaces, strdup(ptr));
+ info->replaces = _alpm_list_add(info->replaces, strdup(ptr));
} else if(!strcmp(key, "PROVIDES")) {
- info->provides = pm_list_add(info->provides, strdup(ptr));
+ info->provides = _alpm_list_add(info->provides, strdup(ptr));
} else if(!strcmp(key, "BACKUP")) {
- info->backup = pm_list_add(info->backup, strdup(ptr));
+ info->backup = _alpm_list_add(info->backup, strdup(ptr));
} else {
_alpm_log(PM_LOG_ERROR, "%s: syntax error in description file line %d",
info->name[0] != '\0' ? info->name : "error", linenum);
@@ -225,7 +225,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
return(0);
}
-pmpkg_t *pkg_load(char *pkgfile)
+pmpkg_t *_alpm_pkg_load(char *pkgfile)
{
char *expath;
int i;
@@ -249,7 +249,7 @@ pmpkg_t *pkg_load(char *pkgfile)
RET_ERR(PM_ERR_NOT_A_FILE, NULL);
}
- info = pkg_new(NULL, NULL);
+ info = _alpm_pkg_new(NULL, NULL);
if(info == NULL) {
tar_close(tar);
RET_ERR(PM_ERR_MEMORY, NULL);
@@ -323,7 +323,7 @@ pmpkg_t *pkg_load(char *pkgfile)
continue;
}
_alpm_strtrim(str);
- info->files = pm_list_add(info->files, strdup(str));
+ info->files = _alpm_list_add(info->files, strdup(str));
}
FREE(str);
fclose(fp);
@@ -340,7 +340,7 @@ pmpkg_t *pkg_load(char *pkgfile)
/* no .FILELIST present in this package.. build the filelist the */
/* old-fashioned way, one at a time */
expath = strdup(th_get_pathname(tar));
- info->files = pm_list_add(info->files, expath);
+ info->files = _alpm_list_add(info->files, expath);
}
}
@@ -374,7 +374,7 @@ error:
/* Test for existence of a package in a PMList*
* of pmpkg_t*
*/
-pmpkg_t *pkg_isin(char *needle, PMList *haystack)
+pmpkg_t *_alpm_pkg_isin(char *needle, PMList *haystack)
{
PMList *lp;
@@ -392,7 +392,7 @@ pmpkg_t *pkg_isin(char *needle, PMList *haystack)
return(NULL);
}
-int pkg_splitname(char *target, char *name, char *version)
+int _alpm_pkg_splitname(char *target, char *name, char *version)
{
char tmp[PKG_FULLNAME_LEN+7];
char *p, *q;
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 155a2f6c..c22cfe59 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -70,7 +70,7 @@ typedef struct __pmpkg_t {
#define FREEPKG(p) \
do { \
if(p) { \
- pkg_free(p); \
+ _alpm_pkg_free(p); \
p = NULL; \
} \
} while(0)
@@ -86,12 +86,12 @@ do { \
} \
} while(0)
-pmpkg_t* pkg_new(const char *name, const char *version);
-pmpkg_t *pkg_dup(pmpkg_t *pkg);
-void pkg_free(pmpkg_t *pkg);
-pmpkg_t *pkg_load(char *pkgfile);
-pmpkg_t *pkg_isin(char *needle, PMList *haystack);
-int pkg_splitname(char *target, char *name, char *version);
+pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
+pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
+void _alpm_pkg_free(pmpkg_t *pkg);
+pmpkg_t *_alpm_pkg_load(char *pkgfile);
+pmpkg_t *_alpm_pkg_isin(char *needle, PMList *haystack);
+int _alpm_pkg_splitname(char *target, char *name, char *version);
#endif /* _ALPM_PACKAGE_H */
diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c
index 17bf6454..bca6b7da 100644
--- a/lib/libalpm/provide.c
+++ b/lib/libalpm/provide.c
@@ -39,11 +39,11 @@ PMList *_alpm_db_whatprovides(pmdb_t *db, char *package)
return(NULL);
}
- for(lp = db_get_pkgcache(db); lp; lp = lp->next) {
+ for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *info = lp->data;
- if(pm_list_is_strin(package, info->provides)) {
- pkgs = pm_list_add(pkgs, info);
+ if(_alpm_list_is_strin(package, info->provides)) {
+ pkgs = _alpm_list_add(pkgs, info);
}
}
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);
}
diff --git a/lib/libalpm/remove.h b/lib/libalpm/remove.h
index b75a3605..217f23be 100644
--- a/lib/libalpm/remove.h
+++ b/lib/libalpm/remove.h
@@ -25,9 +25,9 @@
#include "db.h"
#include "trans.h"
-int remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
-int remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data);
-int remove_commit(pmtrans_t *trans, pmdb_t *db);
+int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name);
+int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data);
+int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db);
#endif /* _ALPM_REMOVE_H */
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 7f6067ae..cec0b427 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -48,7 +48,7 @@
extern pmhandle_t *handle;
-pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data)
+pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
{
pmsyncpkg_t *sync;
@@ -63,7 +63,7 @@ pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data)
return(sync);
}
-void sync_free(pmsyncpkg_t *sync)
+void _alpm_sync_free(pmsyncpkg_t *sync)
{
if(sync == NULL) {
return;
@@ -102,7 +102,7 @@ static pmsyncpkg_t *find_pkginsync(char *needle, PMList *haystack)
/* It returns a PMList of packages extracted from the given archive
* (the archive must have been generated by gensync)
*/
-PMList *sync_load_dbarchive(char *archive)
+PMList *_alpm_sync_load_dbarchive(char *archive)
{
PMList *lp = NULL;
DIR *dir = NULL;
@@ -137,22 +137,22 @@ error:
return(NULL);
}
-int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
{
PMList *i, *j, *k;
/* check for "recommended" package replacements */
_alpm_log(PM_LOG_FLOW1, "checking for package replacements");
for(i = dbs_sync; i; i = i->next) {
- for(j = db_get_pkgcache(i->data); j; j = j->next) {
+ for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *spkg = j->data;
for(k = spkg->replaces; k; k = k->next) {
PMList *m;
- for(m = db_get_pkgcache(db_local); m; m = m->next) {
+ for(m = _alpm_db_get_pkgcache(db_local); m; m = m->next) {
pmpkg_t *lpkg = m->data;
if(!strcmp(k->data, lpkg->name)) {
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'", k->data, spkg->name);
- if(pm_list_is_strin(lpkg->name, handle->ignorepkg)) {
+ if(_alpm_list_is_strin(lpkg->name, handle->ignorepkg)) {
_alpm_log(PM_LOG_WARNING, "%s-%s: ignoring package upgrade (to be replaced by %s-%s)",
lpkg->name, lpkg->version, spkg->name, spkg->version);
} else {
@@ -165,7 +165,7 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
* the package to replace.
*/
pmsyncpkg_t *sync;
- pmpkg_t *dummy = pkg_new(lpkg->name, NULL);
+ pmpkg_t *dummy = _alpm_pkg_new(lpkg->name, NULL);
if(dummy == NULL) {
pm_errno = PM_ERR_MEMORY;
goto error;
@@ -175,17 +175,17 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
sync = find_pkginsync(spkg->name, trans->packages);
if(sync) {
/* found it -- just append to the replaces list */
- sync->data = pm_list_add(sync->data, dummy);
+ sync->data = _alpm_list_add(sync->data, dummy);
} else {
/* none found -- enter pkg into the final sync list */
- sync = sync_new(PM_SYNC_TYPE_REPLACE, spkg, NULL);
+ sync = _alpm_sync_new(PM_SYNC_TYPE_REPLACE, spkg, NULL);
if(sync == NULL) {
FREEPKG(dummy);
pm_errno = PM_ERR_MEMORY;
goto error;
}
- sync->data = pm_list_add(NULL, dummy);
- trans->packages = pm_list_add(trans->packages, sync);
+ sync->data = _alpm_list_add(NULL, dummy);
+ trans->packages = _alpm_list_add(trans->packages, sync);
}
_alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (to be replaced by %s-%s)",
lpkg->name, lpkg->version, spkg->name, spkg->version);
@@ -200,7 +200,7 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
/* match installed packages with the sync dbs and compare versions */
_alpm_log(PM_LOG_FLOW1, "checking for package upgrades");
- for(i = db_get_pkgcache(db_local); i; i = i->next) {
+ for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
int cmp;
int replace = 0;
pmpkg_t *local = i->data;
@@ -208,7 +208,7 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
pmsyncpkg_t *sync;
for(j = dbs_sync; !spkg && j; j = j->next) {
- spkg = db_get_pkgfromcache(j->data, local->name);
+ spkg = _alpm_db_get_pkgfromcache(j->data, local->name);
}
if(spkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping", local->name);
@@ -219,7 +219,7 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
for(j = trans->packages; j && !replace; j = j->next) {
sync = j->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
- if(pkg_isin(spkg->name, sync->data)) {
+ if(_alpm_pkg_isin(spkg->name, sync->data)) {
replace = 1;
}
}
@@ -231,14 +231,14 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
}
/* compare versions and see if we need to upgrade */
- cmp = versioncmp(local->version, spkg->version);
+ cmp = _alpm_versioncmp(local->version, spkg->version);
if(cmp > 0 && !spkg->force) {
/* local version is newer */
_alpm_log(PM_LOG_WARNING, "%s-%s: local version is newer",
local->name, local->version);
} else if(cmp == 0) {
/* versions are identical */
- } else if(pm_list_is_strin(i->data, handle->ignorepkg)) {
+ } else if(_alpm_list_is_strin(i->data, handle->ignorepkg)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, "%s-%s: ignoring package upgrade (%s)",
local->name, local->version, spkg->version);
@@ -246,14 +246,14 @@ int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync)
_alpm_log(PM_LOG_FLOW2, "%s-%s elected for upgrade (%s => %s)",
local->name, local->version, local->version, spkg->version);
if(!find_pkginsync(spkg->name, trans->packages)) {
- pmpkg_t *dummy = pkg_new(local->name, local->version);
- sync = sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
+ pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
+ sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
if(sync == NULL) {
FREEPKG(dummy);
pm_errno = PM_ERR_MEMORY;
goto error;
}
- trans->packages = pm_list_add(trans->packages, sync);
+ trans->packages = _alpm_list_add(trans->packages, sync);
} else {
/* spkg->name is already in the packages list -- just ignore it */
}
@@ -266,7 +266,7 @@ error:
return(-1);
}
-int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *name)
+int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *name)
{
char targline[PKG_FULLNAME_LEN];
char *targ;
@@ -288,7 +288,7 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *dbs = j->data;
if(strcmp(dbs->treename, targline) == 0) {
- spkg = db_get_pkgfromcache(dbs, targ);
+ spkg = _alpm_db_get_pkgfromcache(dbs, targ);
if(spkg == NULL) {
/* Search provides */
PMList *p;
@@ -298,7 +298,7 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
- spkg = db_get_pkgfromcache(dbs, p->data);
+ spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p);
}
}
@@ -307,7 +307,7 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
targ = targline;
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *dbs = j->data;
- spkg = db_get_pkgfromcache(dbs, targ);
+ spkg = _alpm_db_get_pkgfromcache(dbs, targ);
}
if(spkg == NULL) {
/* Search provides */
@@ -317,7 +317,7 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
PMList *p = _alpm_db_whatprovides(dbs, targ);
if(p) {
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
- spkg = db_get_pkgfromcache(dbs, p->data);
+ spkg = _alpm_db_get_pkgfromcache(dbs, p->data);
FREELISTPTR(p);
}
}
@@ -327,9 +327,9 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
- local = db_get_pkgfromcache(db_local, spkg->name);
+ local = _alpm_db_get_pkgfromcache(db_local, spkg->name);
if(local) {
- cmp = versioncmp(local->version, spkg->version);
+ cmp = _alpm_versioncmp(local->version, spkg->version);
if(cmp > 0) {
/* local version is newer -- get confirmation before adding */
int resp = 0;
@@ -353,18 +353,18 @@ int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *n
if(!find_pkginsync(spkg->name, trans->packages)) {
pmpkg_t *dummy = NULL;
if(local) {
- dummy = pkg_new(local->name, local->version);
+ dummy = _alpm_pkg_new(local->name, local->version);
if(dummy == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
}
}
- sync = sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
+ sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
if(sync == NULL) {
FREEPKG(dummy);
RET_ERR(PM_ERR_MEMORY, -1);
}
_alpm_log(PM_LOG_FLOW2, "adding target '%s' to the transaction set", spkg->name);
- trans->packages = pm_list_add(trans->packages, sync);
+ trans->packages = _alpm_list_add(trans->packages, sync);
}
return(0);
@@ -377,7 +377,7 @@ static int ptr_cmp(const void *s1, const void *s2)
return(strcmp(((pmsyncpkg_t *)s1)->pkg->name, ((pmsyncpkg_t *)s2)->pkg->name));
}
-int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **data)
+int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **data)
{
PMList *deps = NULL;
PMList *list = NULL; /* list allowing checkdeps usage with data from trans->packages */
@@ -395,7 +395,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
- list = pm_list_add(list, sync->pkg);
+ list = _alpm_list_add(list, sync->pkg);
}
trail = _alpm_list_new();
@@ -404,7 +404,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
_alpm_log(PM_LOG_FLOW1, "resolving targets dependencies");
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
- if(resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) {
+ if(_alpm_resolvedeps(db_local, dbs_sync, spkg, list, trail, trans, data) == -1) {
/* pm_errno is set by resolvedeps */
goto error;
}
@@ -413,11 +413,11 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
/* add the dependencies found by resolvedeps to the transaction set */
pmpkg_t *spkg = i->data;
if(!find_pkginsync(spkg->name, trans->packages)) {
- pmsyncpkg_t *sync = sync_new(PM_SYNC_TYPE_DEPEND, spkg, NULL);
+ pmsyncpkg_t *sync = _alpm_sync_new(PM_SYNC_TYPE_DEPEND, spkg, NULL);
if(sync == NULL) {
goto error;
}
- trans->packages = pm_list_add(trans->packages, sync);
+ trans->packages = _alpm_list_add(trans->packages, sync);
_alpm_log(PM_LOG_FLOW2, "adding package %s-%s to the transaction targets",
spkg->name, spkg->version);
}
@@ -428,7 +428,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_FLOW1, "looking for unresolvable dependencies");
- deps = checkdeps(db_local, PM_TRANS_TYPE_UPGRADE, list);
+ deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_UPGRADE, list);
if(deps) {
if(data) {
*data = deps;
@@ -440,7 +440,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
/* no unresolvable deps, so look for conflicts */
_alpm_log(PM_LOG_FLOW1, "looking for conflicts");
- deps = checkconflicts(db_local, list);
+ deps = _alpm_checkconflicts(db_local, list);
if(deps) {
int errorout = 0;
@@ -459,7 +459,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
for(j = trans->packages; j && !found; j = j->next) {
sync = j->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
- if(pkg_isin(miss->depend.name, sync->data)) {
+ if(_alpm_pkg_isin(miss->depend.name, sync->data)) {
found = 1;
}
}
@@ -471,11 +471,11 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
}
sync = find_pkginsync(miss->target, trans->packages);
- local = db_get_pkgfromcache(db_local, miss->depend.name);
+ local = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
/* check if this package also "provides" the package it's conflicting with
*/
- if(pm_list_is_strin(miss->depend.name, sync->pkg->provides)) {
+ if(_alpm_list_is_strin(miss->depend.name, sync->pkg->provides)) {
/* so just treat it like a "replaces" item so the REQUIREDBY
* fields are inherited properly.
*/
@@ -499,8 +499,8 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
/* figure out which one was requested in targets. If they both were,
* then it's still an unresolvable conflict. */
- target = pm_list_is_strin(miss->target, trans->targets);
- depend = pm_list_is_strin(miss->depend.name, trans->targets);
+ target = _alpm_list_is_strin(miss->target, trans->targets);
+ depend = _alpm_list_is_strin(miss->depend.name, trans->targets);
if(depend && !target) {
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it",
miss->depend.name);
@@ -530,12 +530,12 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
_alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict", miss->target);
if(local) {
int doremove = 0;
- if(!pm_list_is_strin(miss->depend.name, asked)) {
+ if(!_alpm_list_is_strin(miss->depend.name, asked)) {
QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, miss->target, miss->depend.name, NULL, &doremove);
- asked = pm_list_add(asked, strdup(miss->depend.name));
+ asked = _alpm_list_add(asked, strdup(miss->depend.name));
if(doremove) {
pmsyncpkg_t *rsync = find_pkginsync(miss->depend.name, trans->packages);
- pmpkg_t *q = pkg_new(miss->depend.name, NULL);
+ pmpkg_t *q = _alpm_pkg_new(miss->depend.name, NULL);
if(q == NULL) {
if(data) {
FREELIST(*data);
@@ -550,7 +550,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
}
/* append to the replaces list */
_alpm_log(PM_LOG_FLOW2, "electing '%s' for removal", miss->depend.name);
- sync->data = pm_list_add(sync->data, q);
+ sync->data = _alpm_list_add(sync->data, q);
if(rsync) {
/* remove it from the target list */
pmsyncpkg_t *spkg = NULL;
@@ -569,7 +569,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
+ *data = _alpm_list_add(*data, miss);
}
}
}
@@ -583,7 +583,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
+ *data = _alpm_list_add(*data, miss);
}
}
}
@@ -617,13 +617,13 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
for(j = sync->data; j; j = j->next) {
- list = pm_list_add(list, j->data);
+ list = _alpm_list_add(list, j->data);
}
}
}
if(list) {
_alpm_log(PM_LOG_FLOW1, "checking dependencies of packages designated for removal");
- deps = checkdeps(db_local, PM_TRANS_TYPE_REMOVE, list);
+ deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_REMOVE, list);
if(deps) {
int errorout = 0;
for(i = deps; i; i = i->next) {
@@ -633,8 +633,8 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
PMList *k;
/* If miss->depend.name depends on something that miss->target and a
* package in final both provide, then it's okay... */
- pmpkg_t *leavingp = db_get_pkgfromcache(db_local, miss->target);
- pmpkg_t *conflictp = db_get_pkgfromcache(db_local, miss->depend.name);
+ pmpkg_t *leavingp = _alpm_db_get_pkgfromcache(db_local, miss->target);
+ pmpkg_t *conflictp = _alpm_db_get_pkgfromcache(db_local, miss->depend.name);
if(!leavingp || !conflictp) {
_alpm_log(PM_LOG_ERROR, "something has gone horribly wrong");
goto error;
@@ -674,7 +674,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
goto error;
}
*miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
+ *data = _alpm_list_add(*data, miss);
}
}
}
@@ -700,7 +700,7 @@ error:
return(-1);
}
-int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
+int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
{
PMList *i;
pmtrans_t *tr = NULL;
@@ -710,14 +710,15 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
/* remove conflicting and to-be-replaced packages */
- tr = trans_new();
+ tr = _alpm_trans_new();
if(tr == NULL) {
_alpm_log(PM_LOG_ERROR, "could not create removal transaction");
pm_errno = PM_ERR_MEMORY;
goto error;
}
- if(trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS, NULL, NULL) == -1) {
+ if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS,
+ trans->cb_event, trans->cb_conv) == -1) {
_alpm_log(PM_LOG_ERROR, "could not initialize the removal transaction");
goto error;
}
@@ -728,8 +729,8 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
PMList *j;
for(j = sync->data; j; j = j->next) {
pmpkg_t *pkg = j->data;
- if(!pkg_isin(pkg->name, tr->packages)) {
- if(trans_addtarget(tr, pkg->name) == -1) {
+ if(!_alpm_pkg_isin(pkg->name, tr->packages)) {
+ if(_alpm_trans_addtarget(tr, pkg->name) == -1) {
goto error;
}
replaces++;
@@ -739,13 +740,13 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
}
if(replaces) {
_alpm_log(PM_LOG_FLOW1, "removing conflicting and to-be-replaced packages");
- if(trans_prepare(tr, data) == -1) {
+ if(_alpm_trans_prepare(tr, data) == -1) {
_alpm_log(PM_LOG_ERROR, "could not prepare removal transaction");
goto error;
}
/* we want the frontend to be aware of commit details */
tr->cb_event = trans->cb_event;
- if(trans_commit(tr, NULL) == -1) {
+ if(_alpm_trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, "could not commit removal transaction");
goto error;
}
@@ -754,13 +755,14 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
/* install targets */
_alpm_log(PM_LOG_FLOW1, "installing packages");
- tr = trans_new();
+ tr = _alpm_trans_new();
if(tr == NULL) {
_alpm_log(PM_LOG_ERROR, "could not create transaction");
pm_errno = PM_ERR_MEMORY;
goto error;
}
- if(trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS, NULL, NULL) == -1) {
+ if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS,
+ trans->cb_event, trans->cb_conv) == -1) {
_alpm_log(PM_LOG_ERROR, "could not initialize transaction");
goto error;
}
@@ -769,7 +771,7 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
pmpkg_t *spkg = sync->pkg;
char str[PATH_MAX];
snprintf(str, PATH_MAX, "%s%s/%s-%s" PM_EXT_PKG, handle->root, handle->cachedir, spkg->name, spkg->version);
- if(trans_addtarget(tr, str) == -1) {
+ if(_alpm_trans_addtarget(tr, str) == -1) {
goto error;
}
/* using _alpm_list_last() is ok because addtarget() adds the new target at the
@@ -779,13 +781,11 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
spkg->reason = PM_PKG_REASON_DEPEND;
}
}
- if(trans_prepare(tr, data) == -1) {
+ if(_alpm_trans_prepare(tr, data) == -1) {
_alpm_log(PM_LOG_ERROR, "could not prepare transaction");
goto error;
}
- /* we want the frontend to be aware of commit details */
- tr->cb_event = trans->cb_event;
- if(trans_commit(tr, NULL) == -1) {
+ if(_alpm_trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, "could not commit transaction");
goto error;
}
@@ -798,16 +798,16 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
PMList *j;
- pmpkg_t *new = db_get_pkgfromcache(db_local, sync->pkg->name);
+ pmpkg_t *new = _alpm_db_get_pkgfromcache(db_local, sync->pkg->name);
for(j = sync->data; j; j = j->next) {
PMList *k;
pmpkg_t *old = j->data;
/* merge lists */
for(k = old->requiredby; k; k = k->next) {
- if(!pm_list_is_strin(k->data, new->requiredby)) {
+ if(!_alpm_list_is_strin(k->data, new->requiredby)) {
/* replace old's name with new's name in the requiredby's dependency list */
PMList *m;
- pmpkg_t *depender = db_get_pkgfromcache(db_local, k->data);
+ pmpkg_t *depender = _alpm_db_get_pkgfromcache(db_local, k->data);
if(depender == NULL) {
/* If the depending package no longer exists in the local db,
* then it must have ALSO conflicted with sync->pkg. If
@@ -821,16 +821,16 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
m->data = strdup(new->name);
}
}
- if(db_write(db_local, depender, INFRQ_DEPENDS) == -1) {
+ if(_alpm_db_write(db_local, depender, INFRQ_DEPENDS) == -1) {
_alpm_log(PM_LOG_ERROR, "could not update requiredby for database entry %s-%s",
new->name, new->version);
}
/* add the new requiredby */
- new->requiredby = pm_list_add(new->requiredby, strdup(k->data));
+ new->requiredby = _alpm_list_add(new->requiredby, strdup(k->data));
}
}
}
- if(db_write(db_local, new, INFRQ_DEPENDS) == -1) {
+ if(_alpm_db_write(db_local, new, INFRQ_DEPENDS) == -1) {
_alpm_log(PM_LOG_ERROR, "could not update new database entry %s-%s",
new->name, new->version);
}
diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h
index f8859977..196910ad 100644
--- a/lib/libalpm/sync.h
+++ b/lib/libalpm/sync.h
@@ -31,17 +31,17 @@ typedef struct __pmsyncpkg_t {
void *data;
} pmsyncpkg_t;
-#define FREESYNC(p) do { if(p) { sync_free(p); p = NULL; } } while(0)
+#define FREESYNC(p) do { if(p) { _alpm_sync_free(p); p = NULL; } } while(0)
-pmsyncpkg_t *sync_new(int type, pmpkg_t *spkg, void *data);
-void sync_free(pmsyncpkg_t *sync);
+pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data);
+void _alpm_sync_free(pmsyncpkg_t *sync);
-PMList *sync_load_dbarchive(char *archive);
+PMList *_alpm_sync_load_dbarchive(char *archive);
-int sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync);
-int sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *name);
-int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **data);
-int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data);
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync);
+int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, char *name);
+int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **data);
+int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data);
#endif /* _ALPM_SYNC_H */
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index ed357ade..c89abe69 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -36,7 +36,7 @@
extern pmhandle_t *handle;
-pmtrans_t *trans_new()
+pmtrans_t *_alpm_trans_new()
{
pmtrans_t *trans;
@@ -56,7 +56,7 @@ pmtrans_t *trans_new()
return(trans);
}
-void trans_free(pmtrans_t *trans)
+void _alpm_trans_free(pmtrans_t *trans)
{
if(trans == NULL) {
return;
@@ -78,7 +78,7 @@ void trans_free(pmtrans_t *trans)
free(trans);
}
-int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv)
+int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -92,52 +92,52 @@ int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_t
return(0);
}
-int trans_sysupgrade(pmtrans_t *trans)
+int _alpm_trans_sysupgrade(pmtrans_t *trans)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
- return(sync_sysupgrade(trans, handle->db_local, handle->dbs_sync));
+ return(_alpm_sync_sysupgrade(trans, handle->db_local, handle->dbs_sync));
}
-int trans_addtarget(pmtrans_t *trans, char *target)
+int _alpm_trans_addtarget(pmtrans_t *trans, char *target)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- if(pm_list_is_strin(target, trans->targets)) {
+ if(_alpm_list_is_strin(target, trans->targets)) {
RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1);
}
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_loadtarget(trans, handle->db_local, target) == -1) {
- /* pm_errno is set by add_loadtarget() */
+ if(_alpm_add_loadtarget(trans, handle->db_local, target) == -1) {
+ /* pm_errno is set by _alpm_add_loadtarget() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_loadtarget(trans, handle->db_local, target) == -1) {
+ if(_alpm_remove_loadtarget(trans, handle->db_local, target) == -1) {
/* pm_errno is set by remove_loadtarget() */
return(-1);
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_addtarget(trans, handle->db_local, handle->dbs_sync, target) == -1) {
+ if(_alpm_sync_addtarget(trans, handle->db_local, handle->dbs_sync, target) == -1) {
/* pm_errno is set by sync_loadtarget() */
return(-1);
}
break;
}
- trans->targets = pm_list_add(trans->targets, strdup(target));
+ trans->targets = _alpm_list_add(trans->targets, strdup(target));
return(0);
}
-int trans_prepare(pmtrans_t *trans, PMList **data)
+int _alpm_trans_prepare(pmtrans_t *trans, PMList **data)
{
*data = NULL;
@@ -152,20 +152,20 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_prepare(trans, handle->db_local, data) == -1) {
- /* pm_errno is set by add_prepare() */
+ if(_alpm_add_prepare(trans, handle->db_local, data) == -1) {
+ /* pm_errno is set by _alpm_add_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_prepare(trans, handle->db_local, data) == -1) {
- /* pm_errno is set by remove_prepare() */
+ if(_alpm_remove_prepare(trans, handle->db_local, data) == -1) {
+ /* pm_errno is set by _alpm_remove_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_prepare(trans, handle->db_local, handle->dbs_sync, data) == -1) {
- /* pm_errno is set by sync_prepare() */
+ if(_alpm_sync_prepare(trans, handle->db_local, handle->dbs_sync, data) == -1) {
+ /* pm_errno is set by _alpm_sync_prepare() */
return(-1);
}
break;
@@ -176,7 +176,7 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
return(0);
}
-int trans_commit(pmtrans_t *trans, PMList **data)
+int _alpm_trans_commit(pmtrans_t *trans, PMList **data)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -189,20 +189,20 @@ int trans_commit(pmtrans_t *trans, PMList **data)
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_commit(trans, handle->db_local) == -1) {
- /* pm_errno is set by add_prepare() */
+ if(_alpm_add_commit(trans, handle->db_local) == -1) {
+ /* pm_errno is set by _alpm_add_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_commit(trans, handle->db_local) == -1) {
- /* pm_errno is set by remove_prepare() */
+ if(_alpm_remove_commit(trans, handle->db_local) == -1) {
+ /* pm_errno is set by _alpm_remove_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_commit(trans, handle->db_local, data) == -1) {
- /* pm_errno is set by sync_commit() */
+ if(_alpm_sync_commit(trans, handle->db_local, data) == -1) {
+ /* pm_errno is set by _alpm_sync_commit() */
return(-1);
}
break;
diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h
index aa0633b8..6b01035d 100644
--- a/lib/libalpm/trans.h
+++ b/lib/libalpm/trans.h
@@ -44,7 +44,7 @@ typedef struct __pmtrans_t {
#define FREETRANS(p) \
do { \
if(p) { \
- trans_free(p); \
+ _alpm_trans_free(p); \
p = NULL; \
} \
} while (0)
@@ -61,13 +61,13 @@ do { \
} \
} while(0)
-pmtrans_t *trans_new(void);
-void trans_free(pmtrans_t *trans);
-int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv);
-int trans_sysupgrade(pmtrans_t *trans);
-int trans_addtarget(pmtrans_t *trans, char *target);
-int trans_prepare(pmtrans_t *trans, PMList **data);
-int trans_commit(pmtrans_t *trans, PMList **data);
+pmtrans_t *_alpm_trans_new(void);
+void _alpm_trans_free(pmtrans_t *trans);
+int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv);
+int _alpm_trans_sysupgrade(pmtrans_t *trans);
+int _alpm_trans_addtarget(pmtrans_t *trans, char *target);
+int _alpm_trans_prepare(pmtrans_t *trans, PMList **data);
+int _alpm_trans_commit(pmtrans_t *trans, PMList **data);
#endif /* _ALPM_TRANS_H */
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index a7dae40b..71b1f4ad 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -141,7 +141,7 @@ static int strverscmp (s1, s2)
#endif
/* this function was taken from rpm 4.0.4 and rewritten */
-int versioncmp(const char *a, const char *b) {
+int _alpm_versioncmp(const char *a, const char *b) {
char *str1, *ostr1, *str2, *ostr2;
char *one, *two;
char *rel1 = NULL, *rel2 = NULL;
@@ -248,7 +248,7 @@ int versioncmp(const char *a, const char *b) {
if((!*one) && (!*two)) {
/* compare release numbers */
if(rel1 && rel2) {
- rv = versioncmp(rel1, rel2);
+ rv = _alpm_versioncmp(rel1, rel2);
free(ostr1);
free(ostr2);
return rv;
diff --git a/lib/libalpm/versioncmp.h b/lib/libalpm/versioncmp.h
index ca70ed5d..49b70cd6 100644
--- a/lib/libalpm/versioncmp.h
+++ b/lib/libalpm/versioncmp.h
@@ -21,7 +21,7 @@
#ifndef _PM_VERSIONCMP_H
#define _PM_VERSIONCMP_H
-int versioncmp(const char *a, const char *b);
+int _alpm_versioncmp(const char *a, const char *b);
#endif