summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-13 19:59:04 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-13 19:59:04 +0000
commite115a5829e6a9cbde3c16659d626abaca0a7095a (patch)
tree602f1b9d04f5c24ce800519ba078c270148c7391 /lib
parent45c7e10afc98ef66177841fe2b25b98a6200fbbf (diff)
downloadpacman-e115a5829e6a9cbde3c16659d626abaca0a7095a.tar.xz
- updated sync feature
- added 2 new transaction events
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/sync.c72
2 files changed, 36 insertions, 38 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 025196f2..1cc0c791 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -220,6 +220,8 @@ enum {
PM_TRANS_EVT_FILECONFLICTS_DONE,
PM_TRANS_EVT_RESOLVEDEPS_START,
PM_TRANS_EVT_RESOLVEDEPS_DONE,
+ PM_TRANS_EVT_INTERCONFLICTS_START,
+ PM_TRANS_EVT_INTERCONFLICTS_DONE,
PM_TRANS_EVT_ADD_START,
PM_TRANS_EVT_ADD_DONE,
PM_TRANS_EVT_REMOVE_START,
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index a5cef2d2..bf5df89c 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -311,21 +311,16 @@ int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
return(0);
}
- for(i = trans->packages; i; i = i->next) {
- pmsyncpkg_t *sync = i->data;
- list = pm_list_add(list, sync->spkg);
- }
-
- /* Resolve targets dependencies */
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
- TRANS_CB(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
-
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
list = pm_list_add(list, sync->spkg);
}
trail = pm_list_new();
+ /* Resolve targets dependencies */
+ TRANS_CB(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
+ _alpm_log(PM_LOG_FLOW1, "resolving targets dependencies");
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
pmpkg_t *spkg = sync->spkg;
@@ -338,7 +333,6 @@ int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
if called from makepkg, reason should be set to REASON_DEPEND
spkg->reason = PM_PKG_REASON_EXPLICIT;*/
}
-
for(i = list; i; i = i->next) {
pmpkg_t *spkg = i->data;
if(!find_pkginsync(spkg->name, trans->packages)) {
@@ -346,40 +340,42 @@ int sync_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data)
trans->packages = pm_list_add(trans->packages, sync);
}
}
-
- FREELISTPTR(list);
- FREELISTPTR(trail);
-
TRANS_CB(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
- }
- /* ORE
- check for inter-conflicts and whatnot */
- _alpm_log(PM_LOG_FLOW1, "looking for inter-conflicts");
- deps = checkdeps(db, PM_TRANS_TYPE_UPGRADE, list);
- if(deps) {
- int errorout = 0;
- for(i = deps; i; i = i->next) {
- pmdepmissing_t *miss = i->data;
- if(miss->type == PM_DEP_TYPE_DEPEND || miss->type == PM_DEP_TYPE_REQUIRED) {
- if(!errorout) {
- errorout = 1;
- }
- if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
- FREELIST(deps);
- FREELIST(*data);
- RET_ERR(PM_ERR_MEMORY, -1);
+ /* ORE
+ check for inter-conflicts and whatnot */
+ TRANS_CB(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
+ deps = checkdeps(db, PM_TRANS_TYPE_UPGRADE, list);
+ if(deps) {
+ int errorout = 0;
+ _alpm_log(PM_LOG_FLOW1, "looking for unresolvable dependencies");
+ for(i = deps; i; i = i->next) {
+ pmdepmissing_t *miss = i->data;
+ if(miss->type == PM_DEP_TYPE_DEPEND || miss->type == PM_DEP_TYPE_REQUIRED) {
+ if(!errorout) {
+ errorout = 1;
+ }
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(deps);
+ FREELIST(*data);
+ RET_ERR(PM_ERR_MEMORY, -1);
+ }
+ *miss = *(pmdepmissing_t *)i->data;
+ *data = pm_list_add(*data, miss);
}
- *miss = *(pmdepmissing_t *)i->data;
- *data = pm_list_add(*data, miss);
}
+ if(errorout) {
+ FREELIST(deps);
+ RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
+ }
+ /* ORE
+ no unresolvable deps, so look for conflicts */
+ _alpm_log(PM_LOG_FLOW1, "looking for conflicts");
}
- if(errorout) {
- FREELIST(deps);
- RET_ERR(PM_ERR_UNSATISFIED_DEPS, -1);
- }
- /* ORE
- then look for conflicts */
+ TRANS_CB(trans, PM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL);
+
+ FREELISTPTR(list);
+ FREELISTPTR(trail);
}
/* ORE