summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-03 21:44:57 +0200
committerDan McGee <dan@archlinux.org>2011-07-03 21:44:57 +0200
commit1ce7f39ad73c5c96870c6036014afad3d49a8edf (patch)
tree616b3259a2a6c4bcad5a5433a02985352c60699d /lib/libalpm/trans.c
parentc839415e3fb4bcde11de3cb7595cec93501bed13 (diff)
parentafc96f2ab3d05f14a73e81f871164f01423b5572 (diff)
downloadpacman-1ce7f39ad73c5c96870c6036014afad3d49a8edf.tar.gz
pacman-1ce7f39ad73c5c96870c6036014afad3d49a8edf.tar.xz
Merge remote-tracking branch 'allan/ALPM'
Conflicts: lib/libalpm/be_local.c lib/libalpm/be_package.c lib/libalpm/conflict.c lib/libalpm/diskspace.c lib/libalpm/dload.c lib/libalpm/remove.c
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 29a74bf9..26989499 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -57,23 +57,23 @@ int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags,
/* Sanity checks */
CHECK_HANDLE(handle, return -1);
- ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
+ ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));
for(i = handle->dbs_sync; i; i = i->next) {
const alpm_db_t *db = i->data;
if(!(db->status & DB_STATUS_VALID)) {
- RET_ERR(handle, PM_ERR_DB_INVALID, -1);
+ RET_ERR(handle, ALPM_ERR_DB_INVALID, -1);
}
}
/* lock db */
- if(!(flags & PM_TRANS_FLAG_NOLOCK)) {
+ if(!(flags & ALPM_TRANS_FLAG_NOLOCK)) {
if(_alpm_handle_lock(handle)) {
- RET_ERR(handle, PM_ERR_HANDLE_LOCK, -1);
+ RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
}
}
- CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, PM_ERR_MEMORY, -1));
+ CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
trans->flags = flags;
trans->cb_event = event;
trans->cb_conv = conv;
@@ -102,7 +102,7 @@ static alpm_list_t *check_arch(alpm_handle_t *handle, alpm_list_t *pkgs)
const char *pkgname = alpm_pkg_get_name(pkg);
const char *pkgver = alpm_pkg_get_version(pkg);
size_t len = strlen(pkgname) + strlen(pkgver) + strlen(pkgarch) + 3;
- MALLOC(string, len, RET_ERR(handle, PM_ERR_MEMORY, invalid));
+ MALLOC(string, len, RET_ERR(handle, ALPM_ERR_MEMORY, invalid));
sprintf(string, "%s-%s-%s", pkgname, pkgver, pkgarch);
invalid = alpm_list_add(invalid, string);
}
@@ -117,12 +117,12 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
/* Sanity checks */
CHECK_HANDLE(handle, return -1);
- ASSERT(data != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
+ ASSERT(data != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
trans = handle->trans;
- ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
- ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1));
+ ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
+ ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));
/* If there's nothing to do, return without complaining */
if(trans->add == NULL && trans->remove == NULL) {
@@ -134,7 +134,7 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
if(data) {
*data = invalid;
}
- RET_ERR(handle, PM_ERR_PKG_INVALID_ARCH, -1);
+ RET_ERR(handle, ALPM_ERR_PKG_INVALID_ARCH, -1);
}
if(trans->add == NULL) {
@@ -164,10 +164,10 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
trans = handle->trans;
- ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
- ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, PM_ERR_TRANS_NOT_PREPARED, -1));
+ ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
+ ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_PREPARED, -1));
- ASSERT(!(trans->flags & PM_TRANS_FLAG_NOLOCK), RET_ERR(handle, PM_ERR_TRANS_NOT_LOCKED, -1));
+ ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK), RET_ERR(handle, ALPM_ERR_TRANS_NOT_LOCKED, -1));
/* If there's nothing to do, return without complaining */
if(trans->add == NULL && trans->remove == NULL) {
@@ -202,9 +202,9 @@ int SYMEXPORT alpm_trans_interrupt(alpm_handle_t *handle)
CHECK_HANDLE(handle, return -1);
trans = handle->trans;
- ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
+ ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_COMMITING || trans->state == STATE_INTERRUPTED,
- RET_ERR(handle, PM_ERR_TRANS_TYPE, -1));
+ RET_ERR(handle, ALPM_ERR_TRANS_TYPE, -1));
trans->state = STATE_INTERRUPTED;
@@ -220,10 +220,10 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
CHECK_HANDLE(handle, return -1);
trans = handle->trans;
- ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
- ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
+ ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
+ ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
- int nolock_flag = trans->flags & PM_TRANS_FLAG_NOLOCK;
+ int nolock_flag = trans->flags & ALPM_TRANS_FLAG_NOLOCK;
_alpm_trans_free(trans);
handle->trans = NULL;
@@ -231,7 +231,7 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
/* unlock db */
if(!nolock_flag) {
if(_alpm_handle_unlock(handle)) {
- _alpm_log(handle, PM_LOG_WARNING, _("could not remove lock file %s\n"),
+ _alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
alpm_option_get_lockfile(handle));
alpm_logaction(handle, "warning: could not remove lock file %s\n",
alpm_option_get_lockfile(handle));
@@ -298,7 +298,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
if(access(installfn, R_OK)) {
/* not found */
- _alpm_log(handle, PM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn);
return 0;
}
@@ -309,7 +309,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
}
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", handle->root);
if(mkdtemp(tmpdir) == NULL) {
- _alpm_log(handle, PM_LOG_ERROR, _("could not create temp directory\n"));
+ _alpm_log(handle, ALPM_LOG_ERROR, _("could not create temp directory\n"));
return 1;
} else {
clean_tmpdir = 1;
@@ -323,7 +323,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
}
} else {
if(_alpm_copyfile(installfn, scriptfn)) {
- _alpm_log(handle, PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), scriptfn, strerror(errno));
+ _alpm_log(handle, ALPM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), scriptfn, strerror(errno));
retval = 1;
}
}
@@ -347,13 +347,13 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
scriptpath, script, ver);
}
- _alpm_log(handle, PM_LOG_DEBUG, "executing \"%s\"\n", cmdline);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "executing \"%s\"\n", cmdline);
retval = _alpm_run_chroot(handle, "/bin/sh", argv);
cleanup:
if(clean_tmpdir && _alpm_rmrf(tmpdir)) {
- _alpm_log(handle, PM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir);
+ _alpm_log(handle, ALPM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir);
}
return retval;
@@ -363,7 +363,7 @@ alpm_transflag_t SYMEXPORT alpm_trans_get_flags(alpm_handle_t *handle)
{
/* Sanity checks */
CHECK_HANDLE(handle, return -1);
- ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
+ ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
return handle->trans->flags;
}
@@ -372,7 +372,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_add(alpm_handle_t *handle)
{
/* Sanity checks */
CHECK_HANDLE(handle, return NULL);
- ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
+ ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, NULL));
return handle->trans->add;
}
@@ -381,7 +381,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_remove(alpm_handle_t *handle)
{
/* Sanity checks */
CHECK_HANDLE(handle, return NULL);
- ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
+ ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, NULL));
return handle->trans->remove;
}