[Midnightbsd-cvs] src [6949] trunk/libexec/mport.list/mport.list.c: print out something if the package does not exist in the index.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Nov 13 20:31:51 EST 2014


Revision: 6949
          http://svnweb.midnightbsd.org/src/?rev=6949
Author:   laffer1
Date:     2014-11-13 20:31:50 -0500 (Thu, 13 Nov 2014)
Log Message:
-----------
print out something if the package does not exist in the index. This can happen if a newer blessed magus run does not contain a package due to removal or failure.

Modified Paths:
--------------
    trunk/libexec/mport.list/mport.list.c

Modified: trunk/libexec/mport.list/mport.list.c
===================================================================
--- trunk/libexec/mport.list/mport.list.c	2014-11-12 13:27:51 UTC (rev 6948)
+++ trunk/libexec/mport.list/mport.list.c	2014-11-14 01:31:50 UTC (rev 6949)
@@ -108,29 +108,30 @@
 	while (*packs != NULL) {
 		if (update) {
 			if (mport_index_lookup_pkgname(mport, (*packs)->name, &indexEntries) != MPORT_OK) {
-				fprintf(stderr, "Error Looking up package name %s: %d %s\n", (*packs)->name,  mport_err_code(), mport_err_string());
+				(void) fprintf(stderr, "Error Looking up package name %s: %d %s\n", (*packs)->name,  mport_err_code(), mport_err_string());
 				exit(mport_err_code());
 			}
+
+			if (indexEntries == NULL || *indexEntries == NULL) {
+				(void) printf("%-15s %8s is no longer available.\n", (*packs)->name, (*packs)->version);
+				packs++;
+				continue;
+			}
 			
-			if (indexEntries != NULL) {
-				iestart = indexEntries;
-				while (*indexEntries != NULL) {
-					if (((*indexEntries)->version != NULL && mport_version_cmp((*packs)->version, (*indexEntries)->version) < 0) 
-						|| ((*packs)->version != NULL && mport_version_cmp((*packs)->os_release, os_release) < 0)) {
-						if (verbose) {
-							(void) printf("%-15s %8s (%s)  <  %-s\n", (*packs)->name, (*packs)->version, (*packs)->os_release, (*indexEntries)->version);
-						} else {
-							(void) printf("%-15s %8s  <  %-8s\n", (*packs)->name, (*packs)->version, (*indexEntries)->version);
-						}
+			while (*indexEntries != NULL) {
+				if (((*indexEntries)->version != NULL && mport_version_cmp((*packs)->version, (*indexEntries)->version) < 0) 
+					|| ((*packs)->version != NULL && mport_version_cmp((*packs)->os_release, os_release) < 0)) {
+					if (verbose) {
+						(void) printf("%-15s %8s (%s)  <  %-s\n", (*packs)->name, (*packs)->version, (*packs)->os_release, (*indexEntries)->version);
+					} else {
+						(void) printf("%-15s %8s  <  %-8s\n", (*packs)->name, (*packs)->version, (*indexEntries)->version);
 					}
-					indexEntries++;
 				}
+				indexEntries++;
+			}
 				
-				mport_index_entry_free_vec(iestart);
-				iestart = NULL;
-			} else {
-				(void) printf("%-15s %8s is no longer available.\n", (*packs)->name, (*packs)->version);
-			}
+			mport_index_entry_free_vec(indexEntries);
+			indexEntries = NULL;
 		} else if (verbose) {
 			comment = str_remove((*packs)->comment, '\\');
 			snprintf(name_version, 30, "%s-%s", (*packs)->name, (*packs)->version);



More information about the Midnightbsd-cvs mailing list