#define ACTIVE_LIST_H
#include "list.h"
+#include "pkg.h"
struct active_list {
struct list_head node;
struct list_head depend;
struct active_list *depended;
+ pkg_t *pkg;
};
struct active_list *active_list_head_new(void);
head = prepare_upgrade_list();
for (node = active_list_next(head, head); node;
node = active_list_next(head, node)) {
- old = list_entry(node, pkg_t, list);
+ old = node->pkg;
new =
pkg_hash_fetch_best_installation_candidate_by_name(old->
name);
char *old_v, *new_v;
for (node = active_list_next(head, head); node;
node = active_list_next(head, node)) {
- _old_pkg = list_entry(node, pkg_t, list);
+ _old_pkg = node->pkg;
_new_pkg =
pkg_hash_fetch_best_installation_candidate_by_name
(_old_pkg->name);
pkg_hash_check_installed_pkg_helper(const char *pkg_name, void *entry,
void *data)
{
- struct active_list *head = (struct active_list *)data;
+ struct active_list *item, *head = (struct active_list *)data;
abstract_pkg_t *ab_pkg = (abstract_pkg_t *) entry;
pkg_vec_t *pkg_vec = ab_pkg->pkgs;
int j;
for (j = 0; j < pkg_vec->len; j++) {
pkg_t *pkg = pkg_vec->pkgs[j];
if (pkg->state_status == SS_INSTALLED
- || pkg->state_status == SS_UNPACKED)
- active_list_add(head, &pkg->list);
+ || pkg->state_status == SS_UNPACKED) {
+ printf("alloc item for pkg=%p\n", pkg);
+ item = active_list_head_new();
+ item->pkg = pkg;
+ active_list_add(head, item);
+ }
}
}
pkg_t *old, *new;
int cmp;
- old = list_entry(node, pkg_t, list);
+ old = node->pkg;
new =
pkg_hash_fetch_best_installation_candidate_by_name(old->
name);
cmp = pkg_compare_versions(old, new);
if (cmp < 0) {
- node = active_list_move_node(all, head, &old->list);
+ node = active_list_move_node(all, head, node);
}
}
active_list_head_delete(all);
pkg->state_flag = SF_OK;
pkg->state_status = SS_NOT_INSTALLED;
- active_list_init(&pkg->list);
-
pkg->installed_files = NULL;
pkg->installed_files_ref_cnt = 0;
pkg->essential = 0;
pkg->state_flag = SF_OK;
pkg->state_status = SS_NOT_INSTALLED;
- active_list_clear(&pkg->list);
-
deps = pkg_get_ptr(pkg, PKG_DEPENDS);
if (deps) {
pkg_state_want_t state_want:3;
pkg_state_flag_t state_flag:10;
pkg_state_status_t state_status:4;
- struct active_list list; /* Used for installing|upgrading */
abstract_pkg_t *parent;
abstract_pkg_vec_insert(ab_pkg->provided_by, ab_pkg);
pkg->provides = xcalloc(pkg->provides_count, sizeof(abstract_pkg_t *));
pkg->provides[0] = ab_pkg;
-
for (i = 1; i < pkg->provides_count; i++) {
abstract_pkg_t *provided_abpkg =
ensure_abstract_pkg_by_name(pkg->provides_str[i - 1]);