Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-16 22:14:34 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-16 22:14:34 +0000
commit29a712e3939ff359cdaa8574be2c76d6f71a0c78 (patch)
tree8b87b008df04596e7d0856625bd5a96decfbf1b1
parent43ea74cce6ec1ce152c6120d64b221abed8dc27d (diff)
- reworked transaction prototypes
- added a trans_sysupgrade function
-rw-r--r--lib/libalpm/trans.c31
-rw-r--r--lib/libalpm/trans.h1
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 89f9a998..c0eeb421 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -94,6 +94,14 @@ int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_t
return(0);
}
+int 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));
+}
+
int trans_addtarget(pmtrans_t *trans, char *target)
{
/* Sanity checks */
@@ -107,20 +115,20 @@ int trans_addtarget(pmtrans_t *trans, char *target)
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_loadtarget(handle->db_local, trans, target) == -1) {
+ if(add_loadtarget(trans, handle->db_local, target) == -1) {
/* pm_errno is set by add_loadtarget() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_loadtarget(handle->db_local, trans, target) == -1) {
+ if(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(handle->db_local, handle->dbs_sync, trans, target) == -1) {
- /* pm_errno is set by add_loadtarget() */
+ if(sync_addtarget(trans, handle->db_local, handle->dbs_sync, target) == -1) {
+ /* pm_errno is set by sync_loadtarget() */
return(-1);
}
break;
@@ -140,19 +148,19 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_prepare(handle->db_local, trans, data) == -1) {
+ if(add_prepare(trans, handle->db_local, data) == -1) {
/* pm_errno is set by add_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_prepare(handle->db_local, trans, data) == -1) {
+ if(remove_prepare(trans, handle->db_local, data) == -1) {
/* pm_errno is set by remove_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_prepare(handle->db_local, trans, data) == -1) {
+ if(sync_prepare(trans, handle->db_local, handle->dbs_sync, data) == -1) {
/* pm_errno is set by sync_prepare() */
return(-1);
}
@@ -177,17 +185,20 @@ int trans_commit(pmtrans_t *trans)
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
case PM_TRANS_TYPE_UPGRADE:
- if(add_commit(handle->db_local, trans) == -1) {
+ if(add_commit(trans, handle->db_local) == -1) {
+ /* pm_errno is set by add_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_REMOVE:
- if(remove_commit(handle->db_local, trans) == -1) {
+ if(remove_commit(trans, handle->db_local) == -1) {
+ /* pm_errno is set by remove_prepare() */
return(-1);
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_commit(handle->db_local, trans) == -1) {
+ if(sync_commit(trans, handle->db_local) == -1) {
+ /* pm_errno is set by sync_commit() */
return(-1);
}
break;
diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h
index 98732fbf..c097d897 100644
--- a/lib/libalpm/trans.h
+++ b/lib/libalpm/trans.h
@@ -45,6 +45,7 @@ typedef struct __pmtrans_t {
pmtrans_t *trans_new();
void trans_free(pmtrans_t *trans);
int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_trans_cb cb);
+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);