opkg: update error handling for opkg_update_pkg in opkg.c and bump version number
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:20:39 +0000 (05:20 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:20:39 +0000 (05:20 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@124 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

configure.ac
libopkg/opkg.c

index 8ecb2acb1224a7e50af18d6beea58d97ddb70adc..0397078fb05eff3fcee335cd0991837ec0e1e38f 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script
 AC_INIT(libopkg/libopkg.c)
-AM_INIT_AUTOMAKE([opkg], [0.1.4])
+AM_INIT_AUTOMAKE([opkg], [0.1.5])
 AM_CONFIG_HEADER(libopkg/config.h)
 
 AC_CANONICAL_HOST
index 6cd0423fcfd1d400873471507fa723ad2fdd0dbe..3d5447f0022b29808783224b7eb6f6390ba1c562 100644 (file)
@@ -620,8 +620,21 @@ opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_call
   progress (pdata, 0);
 
   err = opkg_upgrade_pkg (opkg->conf, pkg);
+  /* opkg_upgrade_pkg returns the error codes of opkg_install_pkg */
   if (err)
-    return OPKG_UNKNOWN_ERROR;
+  {
+    switch (err)
+    {
+      case PKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
+      case PKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
+      case PKG_INSTALL_ERR_DEPENDENCIES:
+      case PKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
+      case PKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
+      case PKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
+      case PKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
+      default: return OPKG_UNKNOWN_ERROR;
+    }
+  }
   progress (pdata, 75);
 
   err = opkg_configure_packages (opkg->conf, NULL);