summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:21:36 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-15 00:21:36 (EST)
commit8c9c7528c65a2e5c9ba7e92521e00fa04052131e (patch)
tree96bd542757e1117db13aae2cf54a65e64a144753
parent53737805077d2f83df7d030cb4e43e7a9be8aed1 (diff)
opkg: consolidate error enums and add an error for when no package matches
current architecture git-svn-id: http://opkg.googlecode.com/svn/trunk@128 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg.c33
-rw-r--r--libopkg/opkg_cmd.c11
-rw-r--r--libopkg/opkg_error.h25
-rw-r--r--libopkg/opkg_install.c37
-rw-r--r--libopkg/opkg_install.h15
-rw-r--r--libopkg/opkg_upgrade.c2
-rw-r--r--libopkg/pkg.c2
-rw-r--r--libopkg/pkg_depends.c4
-rw-r--r--libopkg/pkg_hash.c24
-rw-r--r--libopkg/pkg_hash.h4
10 files changed, 87 insertions, 70 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 69dba4e..038469e 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -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;
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index d883c7b..94cfb99 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -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"
diff --git a/libopkg/opkg_error.h b/libopkg/opkg_error.h
index 54fa7fc..b04bd0b 100644
--- a/libopkg/opkg_error.h
+++ b/libopkg/opkg_error.h
@@ -17,11 +17,26 @@
#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;
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 1c73b5c..3db224f 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -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);
}
-
+#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);
}
diff --git a/libopkg/opkg_install.h b/libopkg/opkg_install.h
index 0c01cc0..4bed953 100644
--- a/libopkg/opkg_install.h
+++ b/libopkg/opkg_install.h
@@ -22,21 +22,6 @@
#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);
diff --git a/libopkg/opkg_upgrade.c b/libopkg/opkg_upgrade.c
index e002c37..ed2fc3a 100644
--- a/libopkg/opkg_upgrade.c
+++ b/libopkg/opkg_upgrade.c
@@ -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,
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index a4f242b..e15fc24 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -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;
diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
index bc2ac27..b0aacb3 100644
--- a/libopkg/pkg_depends.c
+++ b/libopkg/pkg_depends.c
@@ -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)) {
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 2fb0d1d..917f433 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -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)
diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h
index 6b1473c..a1b64a6 100644
--- a/libopkg/pkg_hash.h
+++ b/libopkg/pkg_hash.h
@@ -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,