summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-07 19:42:44 +0100
committerAurelien Foret <aurelien@archlinux.org>2006-01-07 19:42:44 +0100
commit86e5c8bc0649a6df814bdff850a787826612f366 (patch)
tree0c81099af96848c8c87f6a305fea2f64cd0e020d /lib/libalpm
parente405204915600340180cef61471471929fb0c275 (diff)
downloadpacman-86e5c8bc0649a6df814bdff850a787826612f366.tar.gz
pacman-86e5c8bc0649a6df814bdff850a787826612f366.tar.xz
sync_commit can now return conflicting files with a trans_prepare like data structure (patch from VMiklos <vmiklos@frugalware.org>)
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.c4
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/sync.c11
-rw-r--r--lib/libalpm/sync.h2
-rw-r--r--lib/libalpm/trans.c4
-rw-r--r--lib/libalpm/trans.h2
6 files changed, 12 insertions, 13 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 819807c6..610c3f64 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -619,7 +619,7 @@ int alpm_trans_prepare(PMList **data)
return(trans_prepare(handle->trans, data));
}
-int alpm_trans_commit()
+int alpm_trans_commit(PMList **data)
{
pmtrans_t *trans;
@@ -633,7 +633,7 @@ int alpm_trans_commit()
/* Check for database R/W permission */
ASSERT(handle->access == PM_ACCESS_RW, RET_ERR(PM_ERR_BADPERMS, -1));
- return(trans_commit(handle->trans));
+ return(trans_commit(handle->trans, data));
}
int alpm_trans_release()
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 59ea151c..321bdc5a 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -262,7 +262,7 @@ int alpm_trans_init(unsigned char type, unsigned char flags, alpm_trans_cb_event
int alpm_trans_sysupgrade(void);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(PM_LIST **data);
-int alpm_trans_commit(void);
+int alpm_trans_commit(PM_LIST **data);
int alpm_trans_release(void);
/*
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index fc962a36..fe655b8b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -616,10 +616,9 @@ error:
return(-1);
}
-int sync_commit(pmtrans_t *trans, pmdb_t *db_local)
+int sync_commit(pmtrans_t *trans, pmdb_t *db_local, PMList **data)
{
PMList *i;
- PMList *data;
pmtrans_t *tr = NULL;
int replaces = 0;
int removal = 0;
@@ -665,13 +664,13 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local)
}
if(replaces+removal != 0) {
_alpm_log(PM_LOG_FLOW1, "removing conflicting and to-be-replaced packages");
- if(trans_prepare(tr, &data) == -1) {
+ if(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) == -1) {
+ if(trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, "could not commit removal transaction");
goto error;
}
@@ -709,13 +708,13 @@ int sync_commit(pmtrans_t *trans, pmdb_t *db_local)
spkg->reason = PM_PKG_REASON_EXPLICIT;
}
}
- if(trans_prepare(tr, &data) == -1) {
+ if(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) == -1) {
+ if(trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, "could not commit transaction");
goto error;
}
diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h
index 5e4cae73..f8859977 100644
--- a/lib/libalpm/sync.h
+++ b/lib/libalpm/sync.h
@@ -41,7 +41,7 @@ PMList *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);
+int 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 8830a1ec..12441f01 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -179,7 +179,7 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
return(0);
}
-int trans_commit(pmtrans_t *trans)
+int trans_commit(pmtrans_t *trans, PMList **data)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -204,7 +204,7 @@ int trans_commit(pmtrans_t *trans)
}
break;
case PM_TRANS_TYPE_SYNC:
- if(sync_commit(trans, handle->db_local) == -1) {
+ if(sync_commit(trans, handle->db_local, data) == -1) {
/* pm_errno is set by sync_commit() */
return(-1);
}
diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h
index bc0ed2fa..aa0633b8 100644
--- a/lib/libalpm/trans.h
+++ b/lib/libalpm/trans.h
@@ -67,7 +67,7 @@ int trans_init(pmtrans_t *trans, unsigned char type, unsigned char flags, alpm_t
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);
+int trans_commit(pmtrans_t *trans, PMList **data);
#endif /* _ALPM_TRANS_H */