summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-28 04:00:21 +0000
committerDan McGee <dan@archlinux.org>2007-02-28 04:00:21 +0000
commitbd7eb9475cdf3bd6dff62e4a38243cac18ba0c8e (patch)
tree1b59860a7803d2b2511d50f9f45979f9cd535867 /lib/libalpm
parent820fae9d75be7527964d441164f0bce6eaaf5183 (diff)
* Added another test as suggested by Nagy on the ML- a package both provides
for and is a dependency of another package. (upgrade057) * Removed man2html stuff from doc/Makefile.am. * Patch: improved depends checking in _alpm_checkdeps Nagy Gabor <ngaba@petra.hos.u-szeged.hu> * Slight revisions to pmrule.py to allow for a PKG_PROVIDES test. * Very quick updates to the pactest README. * Added rules to some of the newer upgrade tests. Note: upgrade055 now fails due to requiredby entries not being written packages that are dependencies in a provides role.
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/deps.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index d1d79db4..d3195d39 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -187,10 +187,12 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
return(newtargs);
}
-/* Returns a alpm_list_t* of missing_t pointers.
- *
- * dependencies can include versions with depmod operators.
- *
+/** Checks dependencies and returns missing ones in a list. Dependencies can include versions with depmod operators.
+ * @param trans pointer to the transaction object
+ * @param db pointer to the local package database
+ * @param op transaction type
+ * @param packages an alpm_list_t* of packages to be checked
+ * @return an alpm_list_t* of missing_t pointers.
*/
alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
alpm_list_t *packages)
@@ -236,32 +238,19 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
continue;
}
_alpm_db_read(db, p, INFRQ_DEPENDS);
- for(k = p->depends; k && !found; k = k->next) {
- /* find the dependency info in p->depends */
- _alpm_splitdep(k->data, &depend);
- if(!strcmp(depend.name, oldpkg->name)) {
- found = 1;
- }
- }
- if(found == 0) {
- /* look for packages that list depend.name as a "provide" */
- alpm_list_t *provides = _alpm_db_whatprovides(db, depend.name);
- if(provides == NULL) {
- /* not found */
- continue;
- }
- /* we found an installed package that provides depend.name */
- FREELISTPTR(provides);
- }
- if(!_alpm_depcmp(tp, &depend)) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
- depend.name, p->name);
- miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
- depend.name, depend.version);
- if(!_alpm_depmiss_isin(miss, baddeps)) {
- baddeps = alpm_list_add(baddeps, miss);
- } else {
- FREE(miss);
+ for(k = p->depends; k; k = k->next) {
+ /* don't break any existing dependencies (possible provides) */
+ _alpm_splitdep(k->data, &depend);
+ if(_alpm_depcmp(oldpkg, &depend) && !_alpm_depcmp(tp, &depend)) {
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: updated '%s' won't satisfy a dependency of '%s'"),
+ oldpkg->name, p->name);
+ miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
+ depend.name, depend.version);
+ if(!_alpm_depmiss_isin(miss, baddeps)) {
+ baddeps = alpm_list_add(baddeps, miss);
+ } else {
+ FREE(miss);
+ }
}
}
}