More backport from pacman 2.9.5 (mainly for resolvedeps)
This commit is contained in:
parent
10b0e0d9af
commit
43f4505b1e
4 changed files with 50 additions and 23 deletions
|
@ -170,6 +170,7 @@ PMList *checkdeps(pmdb_t *db, unsigned short op, PMList *packages)
|
||||||
}
|
}
|
||||||
if(pkg_isin(p, packages)) {
|
if(pkg_isin(p, packages)) {
|
||||||
/* this package is also in the upgrade list, so don't worry about it */
|
/* this package is also in the upgrade list, so don't worry about it */
|
||||||
|
FREEPKG(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for(k = p->depends; k && !found; k = k->next) {
|
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);
|
PMList *provides = _alpm_db_whatprovides(db, depend.name);
|
||||||
if(provides == NULL) {
|
if(provides == NULL) {
|
||||||
/* not found */
|
/* not found */
|
||||||
|
FREEPKG(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* we found an installed package that provides depend.name */
|
/* 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);
|
baddeps = pm_list_add(baddeps, miss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FREEPKG(p);
|
||||||
}
|
}
|
||||||
pkg_free(oldpkg);
|
FREEPKG(oldpkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(op == PM_TRANS_TYPE_ADD || op == PM_TRANS_TYPE_UPGRADE) {
|
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) {
|
if(!found) {
|
||||||
|
/* 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);
|
trail = pm_list_add(trail, sync);
|
||||||
if(resolvedeps(local, databases, sync, list, trail, data)) {
|
if(resolvedeps(local, databases, sync, list, trail, data)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
_alpm_log(PM_LOG_FLOW2, "adding %s-%s", sync->spkg->name, sync->spkg->version);
|
_alpm_log(PM_LOG_FLOW2, "adding %s-%s", sync->spkg->name, sync->spkg->version);
|
||||||
list = pm_list_add(list, sync);
|
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;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* cycle detected -- skip it */
|
/* cycle detected -- skip it */
|
||||||
_alpm_log(PM_LOG_FLOW2, "dependency cycle detected: %s", sync->spkg->name);
|
_alpm_log(PM_LOG_FLOW2, "dependency cycle detected: %s", sync->spkg->name);
|
||||||
|
|
|
@ -166,7 +166,7 @@ PMList* pm_list_add_sorted(PMList *list, void *data, pm_fn_cmp fn)
|
||||||
* list with item removed
|
* list with item removed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PMList* list_remove(PMList* list, PMList* item)
|
PMList* _alpm_list_remove(PMList* list, PMList* item)
|
||||||
{
|
{
|
||||||
assert(_alpm_list_check(list));
|
assert(_alpm_list_check(list));
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,11 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
|
||||||
TRANS_CB(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
|
TRANS_CB(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
|
||||||
|
|
||||||
/* run the pre-remove scriptlet if it exists */
|
/* run the pre-remove scriptlet if it exists */
|
||||||
|
if(info->scriptlet) {
|
||||||
snprintf(pm_install, PATH_MAX, "%s%s/%s/%s-%s/install", handle->root, handle->dbpath, db->treename, info->name, info->version);
|
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);
|
_alpm_runscriptlet(handle->root, pm_install, "pre_remove", info->version, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
||||||
/* iterate through the list backwards, unlinking files */
|
/* iterate through the list backwards, unlinking files */
|
||||||
|
@ -157,7 +159,7 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(S_ISDIR(buf.st_mode)) {
|
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)) {
|
if(rmdir(line)) {
|
||||||
/* this is okay, other packages are probably using it. */
|
/* 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 */
|
/* update dependency packages' REQUIREDBY fields */
|
||||||
for(lp = info->depends; lp; lp = lp->next) {
|
for(lp = info->depends; lp; lp = lp->next) {
|
||||||
PMList *last, *j;
|
PMList *j;
|
||||||
pmpkg_t *depinfo = NULL;
|
pmpkg_t *depinfo = NULL;
|
||||||
pmdepend_t depend;
|
pmdepend_t depend;
|
||||||
|
|
||||||
|
@ -231,18 +233,9 @@ int remove_commit(pmdb_t *db, pmtrans_t *trans)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* splice out this entry from requiredby */
|
/* 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) {
|
for(j = depinfo->requiredby; j; j = j->next) {
|
||||||
if(!strcmp((char*)j->data, info->name)) {
|
if(!strcmp((char*)j->data, info->name)) {
|
||||||
if(j == depinfo->requiredby) {
|
depinfo->requiredby = _alpm_list_remove(depinfo->requiredby, j);
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,11 +387,15 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
|
||||||
|
|
||||||
if(!_alpm_grep(scriptfn, script)) {
|
if(!_alpm_grep(scriptfn, script)) {
|
||||||
/* script not found in scriptlet file */
|
/* 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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ORE
|
/* ORE
|
||||||
_alpm_log(PM_LOG_FLOW2, "Executing %s script...\n", script);*/
|
_alpm_log(PM_LOG_FLOW2, "Executing %s script...", script);*/
|
||||||
if(oldver) {
|
if(oldver) {
|
||||||
snprintf(cmdline, PATH_MAX, "echo \"umask 0022; source %s %s %s %s\" | chroot %s /bin/sh",
|
snprintf(cmdline, PATH_MAX, "echo \"umask 0022; source %s %s %s %s\" | chroot %s /bin/sh",
|
||||||
scriptpath, script, ver, oldver, root);
|
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);
|
scriptpath, script, ver, root);
|
||||||
}
|
}
|
||||||
/* ORE
|
/* ORE
|
||||||
_alpm_log(PM_LOG_FLOW2, "%s\n", cmdline);*/
|
_alpm_log(PM_LOG_FLOW2, "%s", cmdline);*/
|
||||||
system(cmdline);
|
system(cmdline);
|
||||||
|
|
||||||
if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) {
|
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);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue