[pacman-dev] CVS update of pacman-lib/lib/libalpm (add.c conflict.c remove.c)

Dan McGee dan at archlinux.org
Sat Mar 3 15:22:48 EST 2007


    Date: Saturday, March 3, 2007 @ 15:22:48
  Author: dan
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: add.c (1.122 -> 1.123) conflict.c (1.44 -> 1.45)
          remove.c (1.71 -> 1.72)

* Remove unnecessary call to _alpm_trans_update_depends that was erroring
  anyway.
* Spelling/commenting etc.


------------+
 add.c      |    2 +-
 conflict.c |    2 ++
 remove.c   |   31 ++++++++++++++++++-------------
 3 files changed, 21 insertions(+), 14 deletions(-)


Index: pacman-lib/lib/libalpm/add.c
diff -u pacman-lib/lib/libalpm/add.c:1.122 pacman-lib/lib/libalpm/add.c:1.123
--- pacman-lib/lib/libalpm/add.c:1.122	Sat Mar  3 03:13:59 2007
+++ pacman-lib/lib/libalpm/add.c	Sat Mar  3 15:22:48 2007
@@ -402,7 +402,7 @@
 			alpm_list_t *old_noupgrade = alpm_list_strdup(handle->noupgrade);
 			for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) {
 				const char *backup = b->data;
-				_alpm_log(PM_LOG_DEBUG, _("adding %s to the NoUpgrade array temporarilly"), backup);
+				_alpm_log(PM_LOG_DEBUG, _("adding %s to the NoUpgrade array temporarily"), backup);
 				handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(backup));
 			}
 
Index: pacman-lib/lib/libalpm/conflict.c
diff -u pacman-lib/lib/libalpm/conflict.c:1.44 pacman-lib/lib/libalpm/conflict.c:1.45
--- pacman-lib/lib/libalpm/conflict.c:1.44	Sat Mar  3 04:43:16 2007
+++ pacman-lib/lib/libalpm/conflict.c	Sat Mar  3 15:22:48 2007
@@ -244,11 +244,13 @@
 			continue;
 		}
 
+		/* run three different conflict checks on each package */
 		baddeps = chk_pkg_vs_db(baddeps, pkg, db);
 		baddeps = chk_pkg_vs_targets(baddeps, pkg, db, packages);
 		baddeps = chk_db_vs_targets(baddeps, pkg, db, packages);
 	}
 
+	/* debug loop */
 	for(i = baddeps; i; i = i->next) {
 		pmdepmissing_t *miss = i->data;
 		_alpm_log(PM_LOG_DEBUG, _("\tCONFLICTS:: %s conflicts with %s"), miss->target, miss->depend.name);
Index: pacman-lib/lib/libalpm/remove.c
diff -u pacman-lib/lib/libalpm/remove.c:1.71 pacman-lib/lib/libalpm/remove.c:1.72
--- pacman-lib/lib/libalpm/remove.c:1.71	Sat Mar  3 03:14:00 2007
+++ pacman-lib/lib/libalpm/remove.c	Sat Mar  3 15:22:48 2007
@@ -277,22 +277,26 @@
 		char pm_install[PATH_MAX];
 		alpm_list_t *files;
 		info = (pmpkg_t*)targ->data;
+		const char *pkgname = NULL;
 
 		if(handle->trans->state == STATE_INTERRUPTED) {
 			break;
 		}
 
+		/* get the name now so we can use it after package is removed */
+		pkgname = alpm_pkg_get_name(info);
+
 		if(trans->type != PM_TRANS_TYPE_UPGRADE) {
 			EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
 			_alpm_log(PM_LOG_DEBUG, _("removing package %s-%s"),
-								alpm_pkg_get_name(info), alpm_pkg_get_version(info));
+								pkgname, alpm_pkg_get_version(info));
 
 			/* run the pre-remove scriptlet if it exists  */
 			if(alpm_pkg_has_scriptlet(info) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
 				snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path,
-										alpm_pkg_get_name(info), alpm_pkg_get_version(info));
+				         pkgname, alpm_pkg_get_version(info));
 				_alpm_runscriptlet(handle->root, pm_install, "pre_remove",
-													 alpm_pkg_get_version(info), NULL, trans);
+				                   alpm_pkg_get_version(info), NULL, trans);
 			}
 		}
 
@@ -302,7 +306,7 @@
 			for(lp = files; lp; lp = lp->next) {
 				if(!can_remove_file(trans, lp->data)) {
 					_alpm_log(PM_LOG_DEBUG, _("not removing package '%s', can't remove all files"),
-										alpm_pkg_get_name(info));
+					          pkgname);
 					RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1);
 				}
 			}
@@ -320,7 +324,7 @@
 			/* run the post-remove script if it exists  */
 			if(alpm_pkg_has_scriptlet(info) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
 				snprintf(pm_install, PATH_MAX, "%s/%s-%s/install", db->path,
-								 alpm_pkg_get_name(info), alpm_pkg_get_version(info));
+				         pkgname, alpm_pkg_get_version(info));
 				_alpm_runscriptlet(handle->root, pm_install, "post_remove",
 													 alpm_pkg_get_version(info), NULL, trans);
 			}
@@ -328,19 +332,20 @@
 
 		/* remove the package from the database */
 		_alpm_log(PM_LOG_DEBUG, _("updating database"));
-		_alpm_log(PM_LOG_DEBUG, _("removing database entry '%s'"), alpm_pkg_get_name(info));
+		_alpm_log(PM_LOG_DEBUG, _("removing database entry '%s'"), pkgname);
 		if(_alpm_db_remove(db, info) == -1) {
 			_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s-%s"),
-								alpm_pkg_get_name(info), alpm_pkg_get_version(info));
+			          pkgname, alpm_pkg_get_version(info));
 		}
+		/* remove the package from the cache */
 		if(_alpm_db_remove_pkgfromcache(db, info) == -1) {
-			_alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"), alpm_pkg_get_name(info));
+			_alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"),
+			          pkgname);
 		}
-
-		/* update dependency packages' REQUIREDBY fields */
-		_alpm_trans_update_depends(trans, info);
-
-		PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, alpm_pkg_get_name(info), 100, alpm_list_count(trans->packages), (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
+		
+		PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, pkgname, 100,
+		         alpm_list_count(trans->packages),
+		         (alpm_list_count(trans->packages) - alpm_list_count(targ) +1));
 		if(trans->type != PM_TRANS_TYPE_UPGRADE) {
 			EVENT(trans, PM_TRANS_EVT_REMOVE_DONE, info, NULL);
 		}




More information about the pacman-dev mailing list