[pacman-dev] CVS update of pacman-lib/lib/libalpm (package.c trans.c)

Aaron Griffin aaron at archlinux.org
Thu Mar 1 00:42:53 EST 2007


    Date: Thursday, March 1, 2007 @ 00:42:53
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: package.c (1.79 -> 1.80) trans.c (1.38 -> 1.39)


-----------+
 package.c |   23 +++++++++++++++++++----
 trans.c   |    5 ++++-
 2 files changed, 23 insertions(+), 5 deletions(-)


Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.79 pacman-lib/lib/libalpm/package.c:1.80
--- pacman-lib/lib/libalpm/package.c:1.79	Wed Feb 28 11:37:24 2007
+++ pacman-lib/lib/libalpm/package.c	Thu Mar  1 00:42:53 2007
@@ -530,7 +530,7 @@
 
 void _alpm_pkg_update_requiredby(pmpkg_t *pkg)
 {
-	alpm_list_t *i, *j;
+	alpm_list_t *i, *j, *k;
 
 	pmdb_t *localdb = alpm_option_get_localdb();
 	for(i = _alpm_db_get_pkgcache(localdb, INFRQ_DEPENDS); i; i = i->next) {
@@ -543,11 +543,26 @@
 			if(!j->data) {
 				continue;
 			}
-			if(_alpm_splitdep(j->data, &dep) == 0
-				 && strcmp(dep.name, pkg->name) == 0) {
-				_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"), cachepkg->name, pkg->name);
+			if(_alpm_splitdep(j->data, &dep) != 0) {
+				continue;
+			}
+
+			/* check the actual package itself */
+			if(strcmp(dep.name, pkg->name) == 0) {
+				_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s'"),
+									cachepkg->name, pkg->name);
 				pkg->requiredby = alpm_list_add(pkg->requiredby, strdup(cachepkg->name));
 			}
+
+			/* check for provisions as well */
+			for(k = pkg->provides; k; k = k->next) {
+				const char *provname = k->data;
+				if(strcmp(dep.name, provname) == 0) {
+					_alpm_log(PM_LOG_DEBUG, _("adding '%s' in requiredby field for '%s' (provides: %s)"),
+										cachepkg->name, pkg->name, provname);
+					pkg->requiredby = alpm_list_add(pkg->requiredby, strdup(cachepkg->name));
+				}
+			}
 		}
 	}
 }
Index: pacman-lib/lib/libalpm/trans.c
diff -u pacman-lib/lib/libalpm/trans.c:1.38 pacman-lib/lib/libalpm/trans.c:1.39
--- pacman-lib/lib/libalpm/trans.c:1.38	Mon Feb 26 03:38:48 2007
+++ pacman-lib/lib/libalpm/trans.c	Thu Mar  1 00:42:53 2007
@@ -259,7 +259,10 @@
 	ASSERT(pkg != NULL, RET_ERR(PM_ERR_PKG_INVALID, -1));
 
 	if(pkg->depends) {
-		_alpm_log(PM_LOG_DEBUG, _("updating dependency packages 'requiredby' fields"));
+		_alpm_log(PM_LOG_DEBUG, _("updating dependency packages 'requiredby' fields for %s-%s"),
+							pkg->name, pkg->version);
+	} else {
+		_alpm_log(PM_LOG_DEBUG, _("package has no dependencies, no other packages to update"));
 	}
 
 	localdb = alpm_option_get_localdb();




More information about the pacman-dev mailing list