r3968 - trunk/src/target/opkg

thomas at sita.openmoko.org thomas at sita.openmoko.org
Mon Jan 28 15:16:58 CET 2008


Author: thomas
Date: 2008-01-28 15:16:57 +0100 (Mon, 28 Jan 2008)
New Revision: 3968

Modified:
   trunk/src/target/opkg/opkg_cmd.c
   trunk/src/target/opkg/opkg_download.c
Log:
opkg: improve download error reporting


Modified: trunk/src/target/opkg/opkg_cmd.c
===================================================================
--- trunk/src/target/opkg/opkg_cmd.c	2008-01-28 13:42:16 UTC (rev 3967)
+++ trunk/src/target/opkg/opkg_cmd.c	2008-01-28 14:16:57 UTC (rev 3968)
@@ -287,6 +287,7 @@
 	  err = opkg_download(conf, url, tmp_file_name);
 	  if (err) {
 	    failures++;
+		opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
 	  } else {
 	    int err;
 	    err = opkg_verify_file (list_file_name, tmp_file_name);
@@ -296,6 +297,7 @@
 		opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
 	  }
 	  unlink (tmp_file_name);
+	  unlink (tmp);
 	  free (tmp_file_name);
 
 	  free (url);

Modified: trunk/src/target/opkg/opkg_download.c
===================================================================
--- trunk/src/target/opkg/opkg_download.c	2008-01-28 13:42:16 UTC (rev 3967)
+++ trunk/src/target/opkg/opkg_download.c	2008-01-28 14:16:57 UTC (rev 3968)
@@ -60,6 +60,12 @@
     }
 #endif
 
+    /* skip progress bar if we haven't done started yet
+     * this prevents drawing the progress bar if we receive an error such as
+     * file not found */
+    if (t == 0)
+	return 0;
+
     printf ("\r%3d%% |", p);
     for (i = 1; i < 73; i++)
     {
@@ -166,7 +172,12 @@
 	curl_easy_cleanup (curl);
 	fclose (file);
 	if (res)
+	{
+	    long error_code;
+	    curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &error_code);
+	    opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, error_code);
 	    return res;
+	}
 
     }
     else





More information about the commitlog mailing list