diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-26 14:29:47 +0100 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-26 14:29:47 +0100 |
commit | 43f4505b1e2be3745468b74771a08cca49148996 (patch) | |
tree | 7c90a9dbc2866a7fcb9aa8cabddf63123ae852d2 /lib/libalpm | |
parent | 10b0e0d9af0e396d30f6fb1f5d321488897746d3 (diff) | |
download | pacman-43f4505b1e2be3745468b74771a08cca49148996.tar.gz pacman-43f4505b1e2be3745468b74771a08cca49148996.tar.xz |
More backport from pacman 2.9.5 (mainly for resolvedeps)
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/deps.c | 39 | ||||
-rw-r--r-- | lib/libalpm/list.c | 2 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 21 | ||||
-rw-r--r-- | lib/libalpm/util.c | 11 |
4 files changed, 50 insertions, 23 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 66b72e58..2b117f2e 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -170,6 +170,7 @@ PMList *checkdeps(pmdb_t *db, unsigned short op, PMList *packages) } if(pkg_isin(p, packages)) { /* this package is also in the upgrade list, so don't worry about it */ + FREEPKG(p); continue; } for(k = p->depends; k && !found; k = k->next) { @@ -185,6 +186,7 @@ PMList *checkdeps(pmdb_t *db, unsigned short op, PMList *packages) PMList *provides = _alpm_db_whatprovides(db, depend.name); if(provides == NULL) { /* not found */ + FREEPKG(p); continue; } /* we found an installed package that provides depend.name */ @@ -223,8 +225,9 @@ PMList *checkdeps(pmdb_t *db, unsigned short op, PMList *packages) baddeps = pm_list_add(baddeps, miss); } } + FREEPKG(p); } - pkg_free(oldpkg); + FREEPKG(oldpkg); } } if(op == PM_TRANS_TYPE_ADD || op == PM_TRANS_TYPE_UPGRADE) { @@ -671,12 +674,38 @@ int resolvedeps(pmdb_t *local, PMList *databases, pmsync_t *sync, PMList *list, } if(!found) { - trail = pm_list_add(trail, sync); - if(resolvedeps(local, databases, sync, list, trail, data)) { + /* check pmo_ignorepkg and pmo_s_ignore to make sure we haven't pulled in + * something we're not supposed to. + */ + int usedep = 1; + found = 0; + /* ORE + for(j = pmo_ignorepkg; j && !found; j = j->next) { + if(!strcmp(j->data, sync->pkg->name)) { + found = 1; + } + } + for(j = pmo_s_ignore; j && !found; j = j->next) { + if(!strcmp(j->data, sync->pkg->name)) { + found = 1; + } + } + if(found) { + usedep = yesno("%s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] ", + miss->target, sync->pkg->name); + }*/ + if(usedep) { + trail = pm_list_add(trail, sync); + if(resolvedeps(local, databases, sync, list, trail, data)) { + goto error; + } + _alpm_log(PM_LOG_FLOW2, "adding %s-%s", sync->spkg->name, sync->spkg->version); + list = pm_list_add(list, sync); + } else { + _alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target); + pm_errno = PM_ERR_UNRESOLVABLE_DEPS; goto error; } - _alpm_log(PM_LOG_FLOW2, "adding %s-%s", sync->spkg->name, sync->spkg->version); - list = pm_list_add(list, sync); } else { /* cycle detected -- skip it */ _alpm_log(PM_LOG_FLOW2, "dependency cycle detected: %s", sync->spkg->name); diff --git a/lib/libalpm/list.c b/lib/libalpm/list.c index 8fda583f..bbd3c734 100644 --- a/lib/libalpm/list.c +++ b/lib/libalpm/list.c @@ -166,7 +166,7 @@ PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn) * list with item removed */ -PMList* list_remove(PMList* list, PMList* item) +PMList* _alpm_list_remove(PMList* list, PMList* item) { assert(_alpm_list_check(list)); diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index e361fc70..152a620f 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -133,8 +133,10 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) TRANS_CB(trans, PM_TRANS_EVT_REMOVE_START, info, NULL); /* run the pre-remove scriptlet if it exists */ - snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version); - _alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL); + if(info->scriptlet) { + snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version); + _alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL); + } } if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) { @@ -157,7 +159,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) continue; } if(S_ISDIR(buf.st_mode)) { - _alpm_log(PM_LOG_DEBUG, "removing directory %s", line); + _alpm_log(PM_LOG_DEBUG, "removing directory %s", (char *)lp->data); if(rmdir(line)) { /* this is okay, other packages are probably using it. */ } @@ -205,7 +207,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) /* update dependency packages' REQUIREDBY fields */ for(lp = info->depends; lp; lp = lp->next) { - PMList *last, *j; + PMList *j; pmpkg_t *depinfo = NULL; pmdepend_t depend; @@ -231,18 +233,9 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans) } } /* splice out this entry from requiredby */ - last = pm_list_last(depinfo->requiredby); - /* ORE - use list_remove here? */ for(j = depinfo->requiredby; j; j = j->next) { if(!strcmp((char*)j->data, info->name)) { - if(j == depinfo->requiredby) { - depinfo->requiredby = j->next; - } - if(j->prev) j->prev->next = j->next; - if(j->next) j->next->prev = j->prev; - /* free the spliced node */ - j->prev = j->next = NULL; - FREELIST(j); + depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, j); break; } } diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 12b81be3..174c3a66 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -387,11 +387,15 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha if(!_alpm_grep(scriptfn, script)) { /* script not found in scriptlet file */ + if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) { + /* ORE + _alpm_log(PM_LOG_WARNING, "could not remove tmpdir %s", tmpdir);*/ + } return(0); } /* ORE - _alpm_log(PM_LOG_FLOW2, "Executing %s script...\n", script);*/ + _alpm_log(PM_LOG_FLOW2, "Executing %s script...", script);*/ if(oldver) { snprintf(cmdline, PATH_MAX, "echo \"umask 0022; source %s %s %s %s\" | chroot %s /bin/sh", scriptpath, script, ver, oldver, root); @@ -400,11 +404,12 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha scriptpath, script, ver, root); } /* ORE - _alpm_log(PM_LOG_FLOW2, "%s\n", cmdline);*/ + _alpm_log(PM_LOG_FLOW2, "%s", cmdline);*/ system(cmdline); if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) { - fprintf(stderr, "warning: could not remove tmpdir %s\n", tmpdir); + /* ORE + _alpm_log(PM_LOG_WARNING, "could not remove tmpdir %s", tmpdir);*/ } return(0); } |