opkg: consolidate error enums and add an error for when no package matches
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:21:36 +0000 (05:21 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 15 Dec 2008 05:21:36 +0000 (05:21 +0000)
current architecture

git-svn-id: http://opkg.googlecode.com/svn/trunk@128 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libopkg/opkg.c
libopkg/opkg_cmd.c
libopkg/opkg_error.h
libopkg/opkg_install.c
libopkg/opkg_install.h
libopkg/opkg_upgrade.c
libopkg/pkg.c
libopkg/pkg_depends.c
libopkg/pkg_hash.c
libopkg/pkg_hash.h

index 69dba4e255366393d6f2f4df3ffb4700f104e1cc..038469e8f42309de256f1b9fd074af32b1b2cae4 100644 (file)
@@ -27,6 +27,7 @@
 #include "opkg_download.h"
 #include "opkg_remove.h"
 #include "opkg_upgrade.h"
+#include "opkg_error.h"
 
 #include "sprintf_alloc.h"
 #include "file_util.h"
@@ -385,7 +386,7 @@ opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
     return OPKG_PACKAGE_ALREADY_INSTALLED;
   }
 
-  new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name);
+  new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name, NULL);
   if (!new)
   {
     /* XXX: Error: Could not find package to install */
@@ -489,13 +490,13 @@ opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_call
     opkg_package_free (pdata.package);
     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;
+      case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
+      case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
+      case OPKG_INSTALL_ERR_DEPENDENCIES:
+      case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
+      case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
+      case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
+      case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
       default: return OPKG_UNKNOWN_ERROR;
     }
   }
@@ -625,13 +626,13 @@ opkg_upgrade_package (opkg_t *opkg, const char *package_name, opkg_progress_call
   {
     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;
+      case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;
+      case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;
+      case OPKG_INSTALL_ERR_DEPENDENCIES:
+      case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;
+      case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;
+      case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;
+      case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;
       default: return OPKG_UNKNOWN_ERROR;
     }
   }
@@ -917,7 +918,7 @@ opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, v
     if (old->state_status != SS_INSTALLED)
       continue;
 
-    new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name);
+    new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL);
     if (new == NULL) {
       /* XXX: Notice: Assuming locally install package is up to date */
       continue;
index d883c7b02b2e0fbf7efae44a40312d822886b869..94cfb9987c4a52567163c0879a01900294054a10 100644 (file)
@@ -116,7 +116,7 @@ static void write_status_files_if_changed(opkg_conf_t *conf)
          opkg_conf_write_status_files(conf);
          pkg_write_changed_filelists(conf);
      } else { 
-         opkg_message(conf, OPKG_NOTICE, "Nothing to be done\n");
+         opkg_message(conf, OPKG_DEBUG, "Nothing to be done\n");
      }
 }
 
@@ -146,7 +146,7 @@ int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **arg
 
        result = (cmd->fun)(conf, argc, argv);
 
-        if ( result != 0 ) {
+        if ( result != 0 && !error_list) {
            opkg_message(conf, OPKG_NOTICE, "An error ocurred, return value: %d.\n", result);
         }
 
@@ -156,7 +156,7 @@ int opkg_cmd_exec(opkg_cmd_t *cmd, opkg_conf_t *conf, int argc, const char **arg
            opkg_message(conf, OPKG_NOTICE, "Collected errors:\n");
            /* Here we print the errors collected and free the list */
            while (error_list != NULL) {
-                 opkg_message(conf, OPKG_NOTICE, "%s",error_list->errmsg);
+                 opkg_message(conf, OPKG_NOTICE, " * %s", error_list->errmsg);
                  error_list = error_list->next;
 
            }
@@ -593,8 +593,7 @@ static int opkg_install_cmd(opkg_conf_t *conf, int argc, char **argv)
           err = opkg_install_by_name(conf, arg);
          if (err == OPKG_PKG_HAS_NO_CANDIDATE) {
               opkg_message(conf, OPKG_ERROR,
-                           "Cannot find package %s.\n"
-                           "Check the spelling or perhaps run 'opkg update'\n",
+                           "Cannot find package %s.\n",
                            arg);
          }
      }
@@ -683,7 +682,7 @@ static int opkg_download_cmd(opkg_conf_t *conf, int argc, char **argv)
      for (i = 0; i < argc; i++) {
          arg = argv[i];
 
-         pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, arg);
+         pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, arg, &err);
          if (pkg == NULL) {
               opkg_message(conf, OPKG_ERROR,
                            "Cannot find package %s.\n"
index 54fa7fc4ec571bc89218b186d6f98f90d19938a0..b04bd0bf97c712051c8febe3bc19204b0dad7a79 100644 (file)
 #define OPKG_ERROR_H
 
 enum opkg_error {
-    OPKG_SUCCESS = 0,
-    OPKG_PKG_DEPS_UNSATISFIED,
-    OPKG_PKG_IS_ESSENTIAL,
-    OPKG_PKG_HAS_DEPENDENTS,
-    OPKG_PKG_HAS_NO_CANDIDATE
+  OPKG_ERR_UNKNOWN = -1,
+  OPKG_ERR_NONE = 0,
+
+  OPKG_PKG_DEPS_UNSATISFIED,
+  OPKG_PKG_IS_ESSENTIAL,
+  OPKG_PKG_HAS_DEPENDENTS,
+  OPKG_PKG_HAS_NO_CANDIDATE,
+  OPKG_PKG_HAS_NO_AVAILABLE_ARCH,
+
+  OPKG_INSTALL_ERR_NOT_TRUSTED,
+  OPKG_INSTALL_ERR_DOWNLOAD,
+  OPKG_INSTALL_ERR_CONFLICTS,
+  OPKG_INSTALL_ERR_ALREADY_INSTALLED,
+  OPKG_INSTALL_ERR_DEPENDENCIES,
+  OPKG_INSTALL_ERR_NO_DOWNGRADE,
+  OPKG_INSTALL_ERR_NO_SPACE,
+  OPKG_INSTALL_ERR_SIGNATURE,
+  OPKG_INSTALL_ERR_MD5,
+  OPKG_INSTALL_ERR_INTERNAL,
+
 };
 typedef enum opkg_error opkg_error_t;
 
index 1c73b5c0a2544475a253ec93edf461686fb3bb2f..3db224f191bd592e2317e7b7d660b60c979a86f2 100644 (file)
@@ -137,7 +137,7 @@ int opkg_install_from_file(opkg_conf_t *conf, const char *filename)
 
 opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name)
 {
-     int cmp;
+     int cmp, err;
      pkg_t *old, *new;
      char *old_version, *new_version;
 
@@ -147,7 +147,7 @@ opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name)
         opkg_message(conf, OPKG_DEBUG2, " Old versions from pkg_hash_fetch %s \n",  old->version );
     
      opkg_message(conf, OPKG_DEBUG2, " Getting new  from pkg_hash_fetch \n" );
-     new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name);
+     new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name, &err);
      if ( new ) 
         opkg_message(conf, OPKG_DEBUG2, " New versions from pkg_hash_fetch %s \n",  new->version );
 
@@ -165,7 +165,10 @@ opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name)
      opkg_message(conf, OPKG_DEBUG2, " \n");
 
      if (new == NULL) {
-         return OPKG_PKG_HAS_NO_CANDIDATE;
+         if (err)
+           return err;
+         else
+           return OPKG_PKG_HAS_NO_CANDIDATE;
      }
 
      new->state_flag |= SF_USER;
@@ -307,7 +310,7 @@ int pkg_mark_dependencies_for_installation(opkg_conf_t *conf, pkg_t *pkg, pkg_ve
 
      return 0;
 }
-
+#if 0
 int name_mark_dependencies_for_installation(opkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed)
 {
      int cmp;
@@ -360,7 +363,7 @@ int name_mark_dependencies_for_installation(opkg_conf_t *conf, const char *pkg_n
      return pkg_mark_dependencies_for_installation(conf, new, pkgs_needed);
 }
 
-\f
+#endif
 
 int satisfy_dependencies_for(opkg_conf_t *conf, pkg_t *pkg)
 {
@@ -762,7 +765,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      if (!pkg) {
          opkg_message(conf, OPKG_ERROR,
                       "INTERNAL ERROR: null pkg passed to opkg_install_pkg\n");
-         return PKG_INSTALL_ERR_INTERNAL;
+         return OPKG_INSTALL_ERR_INTERNAL;
      }
 
      opkg_message(conf, OPKG_DEBUG2, "Function: %s calling pkg_arch_supported %s \n", __FUNCTION__, __FUNCTION__);
@@ -770,11 +773,11 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      if (!pkg_arch_supported(conf, pkg)) {
          opkg_message(conf, OPKG_ERROR, "INTERNAL ERROR: architecture %s for pkg %s is unsupported.\n",
                       pkg->architecture, pkg->name);
-         return PKG_INSTALL_ERR_INTERNAL;
+         return OPKG_INSTALL_ERR_INTERNAL;
      }
      if (pkg->state_status == SS_INSTALLED && conf->force_reinstall == 0 && conf->nodeps == 0) {
          err = satisfy_dependencies_for(conf, pkg);
-         if (err) { return PKG_INSTALL_ERR_DEPENDENCIES; }
+         if (err) { return OPKG_INSTALL_ERR_DEPENDENCIES; }
 
          opkg_message(conf, OPKG_NOTICE,
                       "Package %s is already installed in %s.\n", 
@@ -789,7 +792,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      old_pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name);
 
      err = opkg_install_check_downgrade(conf, pkg, old_pkg, message);
-     if (err) { return PKG_INSTALL_ERR_NO_DOWNGRADE; }
+     if (err) { return OPKG_INSTALL_ERR_NO_DOWNGRADE; }
 
      pkg->state_want = SW_INSTALL;
      if (old_pkg){                          
@@ -799,7 +802,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
 
      /* Abhaya: conflicts check */
      err = check_conflicts_for(conf, pkg);
-     if (err) { return PKG_INSTALL_ERR_CONFLICTS; }
+     if (err) { return OPKG_INSTALL_ERR_CONFLICTS; }
     
      /* this setup is to remove the upgrade scenario in the end when
        installing pkg A, A deps B & B deps on A. So both B and A are
@@ -809,7 +812,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
         && conf->force_reinstall == 0) return 0;
     
      err = verify_pkg_installable(conf, pkg);
-     if (err) { return PKG_INSTALL_ERR_NO_SPACE; }
+     if (err) { return OPKG_INSTALL_ERR_NO_SPACE; }
 
      if (pkg->local_filename == NULL) {
          err = opkg_download_pkg(conf, pkg, conf->tmp_dir);
@@ -817,7 +820,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
               opkg_message(conf, OPKG_ERROR,
                            "Failed to download %s. Perhaps you need to run 'opkg update'?\n",
                            pkg->name);
-              return PKG_INSTALL_ERR_DOWNLOAD;
+              return OPKG_INSTALL_ERR_DOWNLOAD;
          }
      }
 
@@ -835,7 +838,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
      if (file_exists (sig_file_name))
      {
        if (opkg_verify_file (conf, list_file_name, sig_file_name))
-         return PKG_INSTALL_ERR_SIGNATURE;
+         return OPKG_INSTALL_ERR_SIGNATURE;
      }
 
      free (lists_dir);
@@ -853,7 +856,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
                            "Package %s md5sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
                            pkg->name);
               free(file_md5);
-              return PKG_INSTALL_ERR_MD5;
+              return OPKG_INSTALL_ERR_MD5;
          }
          free(file_md5);
      }
@@ -866,11 +869,11 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
 /* Pigi: check if it will pass from here when replacing. It seems to fail */
 /* That's rather strange that files don't change owner. Investigate !!!!!!*/
      err = update_file_ownership(conf, pkg, old_pkg);
-     if (err) { return PKG_INSTALL_ERR_UNKNOWN; }
+     if (err) { return OPKG_ERR_UNKNOWN; }
 
      if (conf->nodeps == 0) {
          err = satisfy_dependencies_for(conf, pkg);
-         if (err) { return PKG_INSTALL_ERR_DEPENDENCIES; }
+         if (err) { return OPKG_INSTALL_ERR_DEPENDENCIES; }
      }
 
      replacees = pkg_vec_alloc();
@@ -1019,7 +1022,7 @@ int opkg_install_pkg(opkg_conf_t *conf, pkg_t *pkg, int from_upgrade)
               sigprocmask(SIG_UNBLOCK, &newset, &oldset);
 
           pkg_vec_free (replacees);
-         return PKG_INSTALL_ERR_UNKNOWN;
+         return OPKG_ERR_UNKNOWN;
      }
      opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
 }
index 0c01cc06f1719e941bff23c5ae126033e24ddfdc..4bed953c3a7124c1f246d3c22db254c2beb3c1da 100644 (file)
 #include "opkg_conf.h"
 #include "opkg_error.h"
 
-enum {
-  PKG_INSTALL_ERR_NONE,
-  PKG_INSTALL_ERR_NOT_TRUSTED,
-  PKG_INSTALL_ERR_DOWNLOAD,
-  PKG_INSTALL_ERR_CONFLICTS,
-  PKG_INSTALL_ERR_ALREADY_INSTALLED,
-  PKG_INSTALL_ERR_DEPENDENCIES,
-  PKG_INSTALL_ERR_NO_DOWNGRADE,
-  PKG_INSTALL_ERR_NO_SPACE,
-  PKG_INSTALL_ERR_SIGNATURE,
-  PKG_INSTALL_ERR_MD5,
-  PKG_INSTALL_ERR_INTERNAL,
-  PKG_INSTALL_ERR_UNKNOWN
-};
-
 opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name);
 opkg_error_t opkg_install_multi_by_name(opkg_conf_t *conf, const char *pkg_name);
 int opkg_install_from_file(opkg_conf_t *conf, const char *filename);
index e002c37b1a6d7beba9b3037a3ef2d7b371d77c30..ed2fc3a9701d45121992846eb0bc430085d5836a 100644 (file)
@@ -33,7 +33,7 @@ int opkg_upgrade_pkg(opkg_conf_t *conf, pkg_t *old)
           return 0;
      }
 
-     new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name);
+     new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name, NULL);
      if (new == NULL) {
           old_version = pkg_version_str_alloc(old);
           opkg_message(conf, OPKG_NOTICE,
index a4f242bf3a9300b24fff95a7686573dc381b3bde..e15fc2430479c8b7088773d6ae436aa89062f7d4 100644 (file)
@@ -1713,7 +1713,7 @@ int pkg_info_preinstall_check(opkg_conf_t *conf)
          pkg_t *pkg = available_pkgs->pkgs[i];
          if (!pkg->arch_priority && (pkg->state_flag || (pkg->state_want != SW_UNKNOWN))) {
               /* clear flags and want for any uninstallable package */
-              opkg_message(conf, OPKG_NOTICE, "Clearing state_want and state_flag for pkg=%s (arch_priority=%d flag=%d want=%d)\n", 
+              opkg_message(conf, OPKG_DEBUG, "Clearing state_want and state_flag for pkg=%s (arch_priority=%d flag=%d want=%d)\n", 
                            pkg->name, pkg->arch_priority, pkg->state_flag, pkg->state_want);
               pkg->state_want = SW_UNKNOWN;
               pkg->state_flag = 0;
index bc2ac27886a19686ea318b8c43b8624e2b8773b9..b0aacb32edfee346e78362af1101832d7c58cbfc 100644 (file)
@@ -173,7 +173,7 @@ int pkg_hash_fetch_unsatisfied_dependencies(opkg_conf_t *conf, pkg_t * pkg,
               pkg_t *satisfying_pkg = 
                    pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, 
                                                               pkg_installed_and_constraint_satisfied, 
-                                                              dependence_to_satisfy, 1);
+                                                              dependence_to_satisfy, 1, NULL);
                /* Being that I can't test constraing in pkg_hash, I will test it here */
               if (satisfying_pkg != NULL) {
                   if (!pkg_installed_and_constraint_satisfied ( satisfying_pkg,dependence_to_satisfy)) {
@@ -197,7 +197,7 @@ int pkg_hash_fetch_unsatisfied_dependencies(opkg_conf_t *conf, pkg_t * pkg,
                    pkg_t *satisfying_pkg = 
                         pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, 
                                                                    pkg_constraint_satisfied, 
-                                                                   dependence_to_satisfy, 1);
+                                                                   dependence_to_satisfy, 1, NULL);
                     /* Being that I can't test constraing in pkg_hash, I will test it here too */
                    if (satisfying_pkg != NULL) {
                          if (!pkg_constraint_satisfied ( satisfying_pkg,dependence_to_satisfy)) {
index 2fb0d1d8bf4a44639816f11a057ed449326aa73f..917f43351ef45af58ed16f1994b1e4cf240e1dfd 100644 (file)
@@ -170,7 +170,7 @@ abstract_pkg_vec_t *pkg_hash_fetch_all_installation_candidates(hash_table_t *has
 
 
 pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pkg_t *apkg, 
-                                                 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet)
+                                                 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet, int *err)
 {
      int i; 
      int nprovides = 0;
@@ -185,6 +185,9 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pk
      pkg_t *held_pkg = NULL;
      pkg_t *good_pkg_by_name = NULL;
 
+     if (err)
+       *err = 0;
+
      if (matching_apkgs == NULL || providers == NULL || 
          apkg == NULL || apkg->provided_by == NULL || (apkg->provided_by->len == 0))
          return NULL;
@@ -251,6 +254,14 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pk
                         pkg_vec_insert(matching_pkgs, maybe);
                    }
               }
+
+               if (vec->len > 0 && matching_pkgs->len < 1)
+               {
+                 opkg_message (conf, OPKG_ERROR, "   Packages found, but none available for the current "
+                                                 "architecture\n");
+                 if (err)
+                   *err = OPKG_PKG_HAS_NO_AVAILABLE_ARCH;
+               }
          }
      }
 
@@ -351,15 +362,18 @@ static int pkg_name_constraint_fcn(pkg_t *pkg, void *cdata)
          return 0;   
 }
 
-pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name)
+pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name, int *err)
 {
      hash_table_t *hash = &conf->pkg_hash;
      abstract_pkg_t *apkg = NULL;
+     pkg_t *ret;
 
      if (!(apkg = abstract_pkg_fetch_by_name(hash, name)))
          return NULL;
-     
-     return pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0);
+
+     ret = pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0, err);
+
+     return ret;
 }
 
 
@@ -517,7 +531,7 @@ static void pkg_hash_dump_helper(const char *pkg_name, void *entry, void *data)
   if (dependents != NULL)
     while (dependents [i] != NULL && i < ab_pkg->provided_by->len)
       printf ("\tprovided by - %s\n", dependents [i ++]->name);
-  pkg = pkg_hash_fetch_best_installation_candidate_by_name (conf, ab_pkg->name);
+  pkg = pkg_hash_fetch_best_installation_candidate_by_name (conf, ab_pkg->name, NULL);
   if (pkg) {
     i = 0;
     while (i < pkg->depends_count)
index 6b1473c1b7e3db672ab8458227de7fad3b80bc84..a1b64a686d6235fb7bf775bbcdceb1175229f9fb 100644 (file)
@@ -45,8 +45,8 @@ pkg_t * pkg_hash_fetch_by_name_version(hash_table_t *hash,
                                       const char * version);
 abstract_pkg_vec_t *pkg_hash_fetch_all_installation_candidates(hash_table_t *hash, const char *name);
 pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pkg_t *apkg, 
-                                                 int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet);
-pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name);
+                                                 int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet, int *error);
+pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name, int *err);
 pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash,
                                        const char *pkg_name);
 pkg_t *pkg_hash_fetch_installed_by_name_dest(hash_table_t *hash,