diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-02-18 22:07:11 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-02-18 22:07:11 +0000 |
commit | 119b3ab0437d83a483d46e43ce3e330b49f05096 (patch) | |
tree | fd64a9f9bd10d58e3a9dbfed1605c698da51cffe /lib/libalpm/package.c | |
parent | 7b4e2cd25d20e331b66c5163e0d43fe7acd2a420 (diff) | |
download | pacman-119b3ab0437d83a483d46e43ce3e330b49f05096.tar.xz |
Moved the update_depends function to trans.c, as it depends on a transaction
object
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r-- | lib/libalpm/package.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index c921e3e4..93e3aa9c 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -551,93 +551,6 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg) } } -void _alpm_pkg_update_depends(pmpkg_t *pkg, int remove) -{ - alpm_list_t *i, *j; - if(pkg->depends) { - _alpm_log(PM_LOG_DEBUG, _("updating dependency packages 'requiredby' fields")); - } - - pmdb_t *localdb = alpm_option_get_localdb(); - for(i = pkg->depends; i; i = i->next) { - pmdepend_t dep; - if(_alpm_splitdep(i->data, &dep) != 0) { - continue; - } - - /* XXX: this is a hack...if this dependency is in the transaction targets - * of a remove transaction no need to update its requiredby info: - * it is in the process of being removed (if not already done!) */ - /* TODO I wonder if we can just skip this, the few extra operations won't be - * a huge deal either way */ - if(handle->trans && handle->trans->packages - && handle->trans->type == PM_TRANS_TYPE_REMOVE) { - if(_alpm_pkg_isin(dep.name, handle->trans->packages)) { - continue; - } - } - - pmpkg_t *deppkg = _alpm_db_get_pkgfromcache(localdb, dep.name); - if(!deppkg) { - int found_provides = 0; - /* look for a provides package */ - alpm_list_t *provides = _alpm_db_whatprovides(localdb, dep.name); - for(j = provides; j; j = j->next) { - if(!j->data) { - continue; - } - pmpkg_t *provpkg = j->data; - deppkg = _alpm_db_get_pkgfromcache(localdb, provpkg->name); - - if(!deppkg) { - continue; - } - - found_provides = 1; - - /* Ensure package has the right newpkg */ - _alpm_db_read(localdb, INFRQ_DEPENDS, deppkg); - - _alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), deppkg->name); - if(remove) { - void *data = NULL; - deppkg->requiredby = alpm_list_remove(deppkg->requiredby, pkg->name, _alpm_str_cmp, &data); - FREE(data); - } else { - deppkg->requiredby = alpm_list_add(deppkg->requiredby, strdup(pkg->name)); - } - - if(_alpm_db_write(localdb, deppkg, INFRQ_DEPENDS)) { - _alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"), deppkg->name, deppkg->version); - } - } - FREELISTPTR(provides); - - if(!found_provides) { - _alpm_log(PM_LOG_DEBUG, _("could not find dependency '%s'"), dep.name); - continue; - } - } - - /* Ensure package has the right newpkg */ - _alpm_db_read(localdb, INFRQ_DEPENDS, deppkg); - - _alpm_log(PM_LOG_DEBUG, _("updating 'requiredby' field for package '%s'"), deppkg->name); - if(remove) { - void *data = NULL; - deppkg->requiredby = alpm_list_remove(deppkg->requiredby, pkg->name, _alpm_str_cmp, &data); - FREE(data); - } else { - deppkg->requiredby = alpm_list_add(deppkg->requiredby, strdup(pkg->name)); - } - - if(_alpm_db_write(localdb, deppkg, INFRQ_DEPENDS)) { - _alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"), deppkg->name, deppkg->version); - } - } - -} - const char *alpm_pkg_get_filename(pmpkg_t *pkg) { ALPM_LOG_FUNC; |