char *def_arch = HOST_CPU_STR; /* Default arch */
int def_prio = 0; /* Other archs override this */
- l = conf->arch_list.head;
-
- while (l) {
- nv_pair_t *nv = l->data;
+ list_for_each_entry(l , &conf->arch_list.head, node) {
+ nv_pair_t *nv = (nv_pair_t *)l->data;
int priority = strtol(nv->value, NULL, 0);
/* Check if this arch has higher priority, and is valid */
def_prio = priority;
def_arch = nv->name;
}
- l = l->next;
}
return strdup(def_arch);
abstract_pkg_vec_t *providers = abstract_pkg_vec_alloc();
pkg_t *latest_installed_parent = NULL;
pkg_t *latest_matching = NULL;
+ pkg_t *priorized_matching = NULL;
pkg_t *held_pkg = NULL;
pkg_t *good_pkg_by_name = NULL;
pkg_t *maybe = vec->pkgs[i];
opkg_message(conf, OPKG_DEBUG, " %s arch=%s arch_priority=%d version=%s \n",
maybe->name, maybe->architecture, maybe->arch_priority, maybe->version);
- if (maybe->arch_priority > 0) {
+ /* We make sure not to add the same package twice. Need to search for the reason why
+ they show up twice sometimes. */
+ if ((maybe->arch_priority > 0) && (! pkg_vec_contains(matching_pkgs, maybe))) {
max_count++;
abstract_pkg_vec_insert(matching_apkgs, maybe->parent);
pkg_vec_insert(matching_pkgs, maybe);
}
if (!good_pkg_by_name && !held_pkg && !latest_installed_parent && matching_apkgs->len > 1 && !quiet) {
- opkg_message(conf, OPKG_ERROR, "Package=%s, %d matching providers\n",
- apkg->name, matching_apkgs->len);
- for (i = 0; i < matching_apkgs->len; i++) {
- abstract_pkg_t *matching = matching_apkgs->pkgs[i];
- opkg_message(conf, OPKG_ERROR, " %s\n", matching->name);
- }
- opkg_message(conf, OPKG_ERROR, "Please select one with opkg install or opkg flag prefer\n");
- }
+ int prio = 0;
+ for (i = 0; i < matching_pkgs->len; i++) {
+ pkg_t *matching = matching_pkgs->pkgs[i];
+ if (matching->arch_priority > prio) {
+ priorized_matching = matching;
+ prio = matching->arch_priority;
+ opkg_message(conf, OPKG_DEBUG, "Match with priority %i %s\n", prio, matching->name);
+ }
+ }
+
+ }
if (matching_apkgs->len > 1 && conf->verbosity > 1) {
opkg_message(conf, OPKG_NOTICE, "%s: for apkg=%s, %d matching pkgs\n",
opkg_message(conf, OPKG_INFO, " using latest version of installed package %s\n", latest_installed_parent->name);
return latest_installed_parent;
}
+ if (priorized_matching) {
+ opkg_message(conf, OPKG_INFO, " using priorized matching %s %s %s\n",
+ priorized_matching->name, priorized_matching->version, priorized_matching->architecture);
+ return priorized_matching;
+ }
if (nmatching > 1) {
opkg_message(conf, OPKG_INFO, " no matching pkg out of matching_apkgs=%d\n", nmatching);
return NULL;
const char * version)
{
pkg_vec_t * vec;
- register int i;
+ int i;
char *version_str = NULL;
if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name)))
pkg_dest_t *dest)
{
pkg_vec_t * vec;
- register int i;
+ int i;
if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))) {
return NULL;
const char *pkg_name)
{
pkg_vec_t * vec;
- register int i;
+ int i;
if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))){
return NULL;
if(!ab_pkg->pkgs)
ab_pkg->pkgs = pkg_vec_alloc();
- /* pkg_vec_insert_merge might munge package, but it returns an unmunged pkg */
- pkg = pkg_vec_insert_merge(ab_pkg->pkgs, pkg, set_status,conf );
- pkg->parent = ab_pkg;
-
if (buildProvides(hash, ab_pkg, pkg)<0){
fprintf(stderr, "%s : This should never happen. Report this Bug in bugzilla please \n ",__FUNCTION__);
return NULL;
}
buildDependedUponBy(pkg, ab_pkg);
+
+ /* pkg_vec_insert_merge might munge package, but it returns an unmunged pkg */
+ pkg = pkg_vec_insert_merge(ab_pkg->pkgs, pkg, set_status,conf );
+ pkg->parent = ab_pkg;
+
return pkg;
}