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

dan at archlinux.org dan at archlinux.org
Wed Feb 14 00:34:21 EST 2007


    Date: Wednesday, February 14, 2007 @ 00:34:21
  Author: dan
    Path: /home/cvs-pacman/pacman-lib/lib/libalpm

Modified: add.c (1.113 -> 1.114) alpm.c (1.118 -> 1.119)

* Removed needless checking of package infolevel- leave it to the
  alpm_pkg_get functions to do this.


--------+
 add.c  |   11 ++---------
 alpm.c |   22 ++++++----------------
 2 files changed, 8 insertions(+), 25 deletions(-)


Index: pacman-lib/lib/libalpm/add.c
diff -u pacman-lib/lib/libalpm/add.c:1.113 pacman-lib/lib/libalpm/add.c:1.114
--- pacman-lib/lib/libalpm/add.c:1.113	Sat Feb 10 18:44:39 2007
+++ pacman-lib/lib/libalpm/add.c	Wed Feb 14 00:34:21 2007
@@ -400,20 +400,13 @@
 				/* we'll need to save some record for backup checks later */
 				oldpkg = _alpm_pkg_new(local->name, local->version);
 				if(oldpkg) {
-					if(!(local->infolevel & INFRQ_FILES)) {
-						_alpm_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), local->name);
-						_alpm_db_read(db, INFRQ_FILES, local);
-					}
-					oldpkg->backup = alpm_list_strdup(local->backup);
+					oldpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(local));
 					strncpy(oldpkg->name, local->name, PKG_NAME_LEN);
 					strncpy(oldpkg->version, local->version, PKG_VERSION_LEN);
 				}
 
 				/* copy over the install reason */
-				if(!(local->infolevel & INFRQ_DESC)) {
-					_alpm_db_read(db, INFRQ_DESC, local);
-				}
-				info->reason = local->reason;
+				info->reason = alpm_pkg_get_reason(local);
 
 				/* pre_upgrade scriptlet */
 				if(info->scriptlet && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) {
Index: pacman-lib/lib/libalpm/alpm.c
diff -u pacman-lib/lib/libalpm/alpm.c:1.118 pacman-lib/lib/libalpm/alpm.c:1.119
--- pacman-lib/lib/libalpm/alpm.c:1.118	Mon Feb 12 20:46:33 2007
+++ pacman-lib/lib/libalpm/alpm.c	Wed Feb 14 00:34:21 2007
@@ -476,18 +476,13 @@
 
 	sha1sum = _alpm_SHAFile(path);
 	if(sha1sum == NULL) {
-		_alpm_log(PM_LOG_ERROR, _("could not get sha1 checksum for package %s-%s"),
+		_alpm_log(PM_LOG_ERROR, _("could not get sha1sum for package %s-%s"),
 		          pkg->name, pkg->version);
 		pm_errno = PM_ERR_NOT_A_FILE;
 		retval = -1;
 	} else {
-		if(!(pkg->infolevel & INFRQ_DESC)) {
-			_alpm_log(PM_LOG_DEBUG, _("loading DESC info for '%s'"), pkg->name);
-			_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
-		}
-
-		if(strcmp(sha1sum, pkg->sha1sum) == 0) {
-			_alpm_log(PM_LOG_DEBUG, _("checksums for package %s-%s are matching"),
+		if(strcmp(sha1sum, alpm_pkg_get_sha1sum(pkg)) == 0) {
+			_alpm_log(PM_LOG_DEBUG, _("sha1sums for package %s-%s match"),
 			                        pkg->name, pkg->version);
 		} else {
 			_alpm_log(PM_LOG_ERROR, _("sha1sums do not match for package %s-%s"),
@@ -525,18 +520,13 @@
 
 	md5sum = _alpm_MDFile(path);
 	if(md5sum == NULL) {
-		_alpm_log(PM_LOG_ERROR, _("could not get md5 checksum for package %s-%s"),
+		_alpm_log(PM_LOG_ERROR, _("could not get md5sum for package %s-%s"),
 		          pkg->name, pkg->version);
 		pm_errno = PM_ERR_NOT_A_FILE;
 		retval = -1;
 	} else {
-		if(!(pkg->infolevel & INFRQ_DESC)) {
-			_alpm_log(PM_LOG_DEBUG, _("loading DESC info for '%s'"), pkg->name);
-			_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
-		}
-
-		if(strcmp(md5sum, pkg->md5sum) == 0) {
-			_alpm_log(PM_LOG_DEBUG, _("checksums for package %s-%s are matching"),
+		if(strcmp(md5sum, alpm_pkg_get_md5sum(pkg)) == 0) {
+			_alpm_log(PM_LOG_DEBUG, _("md5sums for package %s-%s match"),
 			                        pkg->name, pkg->version);
 		} else {
 			_alpm_log(PM_LOG_ERROR, _("md5sums do not match for package %s-%s"),




More information about the pacman-dev mailing list