[pacman-dev] CVS update of pacman-lib (5 files)

Aaron Griffin aaron at archlinux.org
Thu Feb 22 21:10:56 EST 2007


    Date: Thursday, February 22, 2007 @ 21:10:56
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib

Modified: lib/libalpm/package.c (1.74 -> 1.75)
          lib/libalpm/package.h (1.31 -> 1.32)
          lib/libalpm/sync.c (1.102 -> 1.103) pactest/pactest.py (1.3 -> 1.4)
          src/pacman/trans.c (1.38 -> 1.39)

* Modified the handling and output w.r.t. IgnorePkg entries.  -Sy always ignores
  these packages, but -S explicitly asks for confirmation.


-----------------------+
 lib/libalpm/package.c |    8 +++++---
 lib/libalpm/package.h |    2 +-
 lib/libalpm/sync.c    |   44 +++++++++++++++++++++++---------------------
 pactest/pactest.py    |    1 +
 src/pacman/trans.c    |    6 +++++-
 5 files changed, 35 insertions(+), 26 deletions(-)


Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.74 pacman-lib/lib/libalpm/package.c:1.75
--- pacman-lib/lib/libalpm/package.c:1.74	Wed Feb 21 23:42:59 2007
+++ pacman-lib/lib/libalpm/package.c	Thu Feb 22 21:10:56 2007
@@ -141,27 +141,29 @@
 	}
 
 	/* compare versions and see if we need to upgrade */
-	cmp = _alpm_versioncmp(local_pkg->version, pkg->version);
+	cmp = _alpm_versioncmp(pkg->version, local_pkg->version);
 
 	if(cmp != 0 && pkg->force) {
 		cmp = 1;
 		_alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s"), local_pkg->name, pkg->version);
-	} else if(cmp > 0) {
+	} else if(cmp < 0) {
 		/* local version is newer */
 		pmdb_t *db = pkg->data;
 		_alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)"),
 							local_pkg->name, local_pkg->version, db->treename, pkg->version);
 		cmp = 0;
-	} else if(cmp < 0) {
+	} else if(cmp > 0) {
 		/* we have an upgrade, make sure we should actually do it */
 		if(alpm_list_find_str(handle->ignorepkg, pkg->name)) {
 			/* package should be ignored (IgnorePkg) */
 			_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
 								local_pkg->name, local_pkg->version, pkg->version);
+			cmp = 0;
 		} else if(_alpm_pkg_istoonew(pkg)) {
 			/* package too new (UpgradeDelay) */
 			_alpm_log(PM_LOG_WARNING, _("%s-%s: delaying upgrade of package (%s)"),
 								local_pkg->name, local_pkg->version, pkg->version);
+			cmp = 0;
 		}
 	}
 
Index: pacman-lib/lib/libalpm/package.h
diff -u pacman-lib/lib/libalpm/package.h:1.31 pacman-lib/lib/libalpm/package.h:1.32
--- pacman-lib/lib/libalpm/package.h:1.31	Sun Feb 18 17:07:11 2007
+++ pacman-lib/lib/libalpm/package.h	Thu Feb 22 21:10:56 2007
@@ -102,7 +102,7 @@
 pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
 void _alpm_pkg_free(void *data);
 int _alpm_pkg_cmp(const void *p1, const void *p2);
-int alpm_pkg_compare_versions(pmpkg_t *pkgA, pmpkg_t *pkgB);
+int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
 pmpkg_t *_alpm_pkg_load(char *pkgfile);
 pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack);
 int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
Index: pacman-lib/lib/libalpm/sync.c
diff -u pacman-lib/lib/libalpm/sync.c:1.102 pacman-lib/lib/libalpm/sync.c:1.103
--- pacman-lib/lib/libalpm/sync.c:1.102	Wed Feb 21 01:44:15 2007
+++ pacman-lib/lib/libalpm/sync.c	Thu Feb 22 21:10:56 2007
@@ -228,24 +228,19 @@
 
 			/* compare versions and see if we need to upgrade */
 			if(alpm_pkg_compare_versions(local, spkg)) {
-				if(alpm_list_find_str(handle->ignorepkg, local->name)) {
-					_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s => %s)"),
-										local->name, local->version, local->version, spkg->version);
-				} else {
-					_alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
-										local->name, local->version, local->version, spkg->version);
-					if(!find_pkginsync(spkg->name, trans->packages)) {
-						pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
-						if(dummy == NULL) {
-							goto error;
-						}
-						sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
-						if(sync == NULL) {
-							FREEPKG(dummy);
-							goto error;
-						}
-						trans->packages = alpm_list_add(trans->packages, sync);
+				_alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
+									local->name, local->version, local->version, spkg->version);
+				if(!find_pkginsync(spkg->name, trans->packages)) {
+					pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
+					if(dummy == NULL) {
+						goto error;
 					}
+					sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
+					if(sync == NULL) {
+						FREEPKG(dummy);
+						goto error;
+					}
+					trans->packages = alpm_list_add(trans->packages, sync);
 				}
 			}
 		}
@@ -331,10 +326,17 @@
 		if(alpm_pkg_compare_versions(local, spkg) == 0) {
 			/* spkg is NOT an upgrade, get confirmation before adding */
 			int resp = 0;
-			QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
-			if(!resp) {
-				_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"), local->name, local->version);
-				return(0);
+			if(alpm_list_find_str(handle->ignorepkg, local->name)) {
+				QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
+				if(!resp) {
+					return(0);
+				}
+			} else {
+				QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
+				if(!resp) {
+					_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"), local->name, local->version);
+					return(0);
+				}
 			}
 		}
 	}
Index: pacman-lib/pactest/pactest.py
diff -u pacman-lib/pactest/pactest.py:1.3 pacman-lib/pactest/pactest.py:1.4
--- pacman-lib/pactest/pactest.py:1.3	Thu Feb 22 03:06:54 2007
+++ pacman-lib/pactest/pactest.py	Thu Feb 22 21:10:56 2007
@@ -34,6 +34,7 @@
 def globTests(option, opt_str, value, parser):
     globlist = []
     globlist.extend(glob.glob(value))
+    print "globlist=%s" % globlist
     setattr(parser.values, option.dest, globlist)
 
 def createOptParser():
Index: pacman-lib/src/pacman/trans.c
diff -u pacman-lib/src/pacman/trans.c:1.38 pacman-lib/src/pacman/trans.c:1.39
--- pacman-lib/src/pacman/trans.c:1.38	Wed Feb 21 23:46:34 2007
+++ pacman-lib/src/pacman/trans.c	Thu Feb 22 21:10:56 2007
@@ -167,11 +167,15 @@
 				} else {
 					*response = 0;
 				}
-			} else {
+			} else if(data2) {
 				snprintf(str, LOG_STR_LEN, _(":: %s requires %s, but it is in IgnorePkg. Install anyway? [Y/n] "),
 				         alpm_pkg_get_name(data1),
 				         alpm_pkg_get_name(data2));
 				*response = yesno(str);
+			} else {
+				snprintf(str, LOG_STR_LEN, _(":: %s is in IgnorePkg. Install anyway? [Y/n] "),
+				         alpm_pkg_get_name(data1));
+				*response = yesno(str);
 			}
 			break;
 		case PM_TRANS_CONV_REMOVE_HOLDPKG:




More information about the pacman-dev mailing list