summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/sync.c72
-rw-r--r--src/pacman/sync.c176
-rw-r--r--src/pacman/trans.c4
4 files changed, 115 insertions, 139 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
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 7e9b92d5..1d7c2a22 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -366,14 +366,10 @@ int pacman_sync(list_t *targets)
int retval = 0;
list_t *final = NULL;
list_t *i;
- PM_LIST *data;
+ PM_LIST *packages, *data;
char *root;
char ldir[PATH_MAX];
int varcache = 1;
- int done;
- int count;
- sync_t *current = NULL;
- list_t *processed = NULL;
list_t *files = NULL;
if(pmc_syncs == NULL || !list_count(pmc_syncs)) {
@@ -549,11 +545,11 @@ int pacman_sync(list_t *targets)
/* list targets */
if(!pmo_s_printuris) {
- PM_LIST *packages, *lp;
list_t *list = NULL;
char *str;
unsigned long totalsize = 0;
double mb;
+ PM_LIST *lp;
/* ORE
for(i = rmtargs; i; i = i->next) {
list = list_add(list, strdup(i->data));
@@ -603,130 +599,108 @@ int pacman_sync(list_t *targets)
MSG(NL, "\nTotal Package Size: %.1f MB\n", mb);
FREELIST(list);
FREE(str);
- }
- /* get confirmation */
- if(pmo_s_downloadonly) {
- if(pmo_noconfirm) {
- MSG(NL, "\nBeginning download...\n");
- confirm = 1;
- } else {
- MSG(NL, "\n");
- confirm = yesno("Proceed with download? [Y/n] ");
- }
- } else {
- /* don't get any confirmation if we're called from makepkg */
- if(pmo_d_resolve || pmo_s_printuris) {
- confirm = 1;
- } else {
+ /* get confirmation */
+ if(pmo_s_downloadonly) {
if(pmo_noconfirm) {
- MSG(NL, "\nBeginning upgrade process...\n");
+ MSG(NL, "\nBeginning download...\n");
confirm = 1;
} else {
MSG(NL, "\n");
- confirm = yesno("Proceed with upgrade? [Y/n] ");
+ confirm = yesno("Proceed with download? [Y/n] ");
+ }
+ } else {
+ /* don't get any confirmation if we're called from makepkg */
+ if(pmo_d_resolve) {
+ confirm = 1;
+ } else {
+ if(pmo_noconfirm) {
+ MSG(NL, "\nBeginning upgrade process...\n");
+ confirm = 1;
+ } else {
+ MSG(NL, "\n");
+ confirm = yesno("Proceed with upgrade? [Y/n] ");
+ }
}
}
- }
- if(!confirm) {
- retval = 1;
- goto cleanup;
+ if(!confirm) {
+ retval = 1;
+ goto cleanup;
+ }
}
/* group sync records by repository and download */
alpm_get_option(PM_OPT_ROOT, (long *)&root);
- snprintf(ldir, PATH_MAX, "%s"CACHEDIR, root);
- done = 0;
- count = 0;
- processed = NULL;
- current = NULL;
- while(!done) {
+ snprintf(ldir, PATH_MAX, "%s" CACHEDIR, root);
+ for(i = pmc_syncs; i; i = i->next) {
PM_LIST *lp;
- printf("in while\n");
- if(current) {
- processed = list_add(processed, current);
- current = NULL;
- }
- for(lp = alpm_list_first(alpm_trans_getinfo(PM_TRANS_PACKAGES)); lp; lp = alpm_list_next(lp)) {
- PM_PKG *sync = alpm_list_getdata(lp);
- if(current == NULL) {
- PM_DB *dbs = alpm_pkg_getinfo(sync, PM_PKG_DB);
- /* we're starting on a new repository */
- if(!list_is_ptrin(dbs, processed)) {
- /* ORE
- current = dbs;*/
- current = NULL;
- }
- }
- /*if(current && !strcmp(current->treename, sync->dbs->sync->treename)) {
+ sync_t *current = i->data;
+
+ for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
+ PM_SYNCPKG *sync = alpm_list_getdata(lp);
+ PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_SYNCPKG);
+ PM_DB *dbs = alpm_pkg_getinfo(spkg, PM_PKG_DB);
+
+ if(current->db == dbs) {
struct stat buf;
char path[PATH_MAX];
+ char *pkgname, *pkgver;
+
+ pkgname = alpm_pkg_getinfo(spkg, PM_PKG_NAME);
+ pkgver = alpm_pkg_getinfo(spkg, PM_PKG_VERSION);
if(pmo_s_printuris) {
- snprintf(path, PATH_MAX, "%s-%s%s", sync->pkg->name, sync->pkg->version, PKGEXT);
- files = list_add(files, strdup(path));
+ server_t *server = (server_t*)current->servers->data;
+ snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
+ if(!strcmp(server->protocol, "file")) {
+ MSG(NL, "%s://%s%s\n", server->protocol, server->path, path);
+ } else {
+ MSG(NL, "%s://%s%s%s\n", server->protocol,
+ server->server, server->path, path);
+ }
} else {
- snprintf(path, PATH_MAX, "%s/%s-%s%s",
- ldir, sync->pkg->name, sync->pkg->version, PKGEXT);
+ snprintf(path, PATH_MAX, "%s/%s-%s" PM_EXT_PKG, ldir, pkgname, pkgver);
if(stat(path, &buf)) {
- // file is not in the cache dir, so add it to the list //
- snprintf(path, PATH_MAX, "%s-%s%s", sync->pkg->name, sync->pkg->version, PKGEXT);
+ /* file is not in the cache dir, so add it to the list */
+ snprintf(path, PATH_MAX, "%s-%s" PM_EXT_PKG, pkgname, pkgver);
files = list_add(files, strdup(path));
} else {
- vprint(" %s-%s%s is already in the cache\n", sync->pkg->name, sync->pkg->version, PKGEXT);
- count++;
+ vprint(" %s-%s" PM_EXT_PKG " is already in the cache\n", pkgname, pkgver);
}
}
- }*/
+ }
}
if(files) {
- if(pmo_s_printuris) {
- list_t *j;
- server_t *server = (server_t*)current->servers->data;
- for(j = files; j; j = j->next) {
- if(!strcmp(server->protocol, "file")) {
- MSG(NL, "%s://%s%s\n", server->protocol, server->path,
- (char *)j->data);
- } else {
- MSG(NL, "%s://%s%s%s\n", server->protocol,
- server->server, server->path, (char *)j->data);
- }
- }
- } else {
- struct stat buf;
-
- MSG(NL, "\n:: Retrieving packages from %s...\n", current->treename);
- fflush(stdout);
- if(stat(ldir, &buf)) {
- /* no cache directory.... try creating it */
- MSG(NL, "warning: no %s cache exists. creating...", ldir);
- alpm_logaction("warning: no %s cache exists. creating...", ldir);
- if(makepath(ldir)) {
- /* couldn't mkdir the cache directory, so fall back to /tmp and unlink
- * the package afterwards.
- */
- MSG(NL, "warning: couldn't create package cache, using /tmp instead");
- alpm_logaction("warning: couldn't create package cache, using /tmp instead");
- snprintf(ldir, PATH_MAX, "/tmp");
- varcache = 0;
- }
- }
- if(downloadfiles(current->servers, ldir, files)) {
- ERR(NL, "failed to retrieve some files from %s\n", current->treename);
- retval = 1;
- goto cleanup;
+ struct stat buf;
+ MSG(NL, "\n:: Retrieving packages from %s...\n", current->treename);
+ fflush(stdout);
+ if(stat(ldir, &buf)) {
+ /* no cache directory.... try creating it */
+ MSG(NL, "warning: no %s cache exists. creating...", ldir);
+ alpm_logaction("warning: no %s cache exists. creating...", ldir);
+ if(makepath(ldir)) {
+ /* couldn't mkdir the cache directory, so fall back to /tmp and unlink
+ * the package afterwards.
+ */
+ MSG(NL, "warning: couldn't create package cache, using /tmp instead");
+ alpm_logaction("warning: couldn't create package cache, using /tmp instead");
+ snprintf(ldir, PATH_MAX, "/tmp");
+ varcache = 0;
}
}
-
- count += list_count(files);
+ if(downloadfiles(current->servers, ldir, files)) {
+ ERR(NL, "failed to retrieve some files from %s\n", current->treename);
+ retval = 1;
+ goto cleanup;
+ }
FREELIST(files);
}
- if(count == list_count(final)) {
- done = 1;
- }
}
- printf("\n");
+ if(pmo_s_printuris) {
+ goto cleanup;
+ }
+ MSG(NL, "\n");
/* Check integrity of files */
MSG(NL, "checking package integrity... ");
@@ -735,7 +709,7 @@ int pacman_sync(list_t *targets)
char /*str[PATH_MAX],*/ pkgname[PATH_MAX] = "dummy";
char *md5sum1, *md5sum2;
- snprintf(pkgname, PATH_MAX, "%s-%s"PM_EXT_PKG, "", "");
+ snprintf(pkgname, PATH_MAX, "%s-%s" PM_EXT_PKG, "", "");
md5sum1 = NULL;
/* ORE
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index e58151f6..ad3337da 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -50,9 +50,13 @@ void cb_trans(unsigned short event, void *data1, void *data2)
case PM_TRANS_EVT_RESOLVEDEPS_START:
MSG(NL, "resolving dependencies... ");
break;
+ case PM_TRANS_EVT_INTERCONFLICTS_START:
+ MSG(NL, "looking inter-conflicts... ");
+ break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
case PM_TRANS_EVT_FILECONFLICTS_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
+ case PM_TRANS_EVT_INTERCONFLICTS_DONE:
MSG(CL, "done.\n");
break;
case PM_TRANS_EVT_ADD_START: