int i3_process_pkg_conflicts(int indent, struct i3ctx *ictx, struct i3pkg *i3pkg) { struct pkgdb *db; struct pkg *pkg = i3pkg->pkg; int i, n, ncnfl = 0; db = ictx->ts->db; if (!ictx->ts->getop(ictx->ts, POLDEK_OP_CONFLICTS)) return 1; /* conflicts in install set */ if (pkg->cnflpkgs != NULL) for (i = 0; i < n_array_size(pkg->cnflpkgs); i++) { struct reqpkg *cpkg = n_array_nth(pkg->cnflpkgs, i); if ((cpkg->flags & REQPKG_CONFLICT) == 0) continue; if (i3_is_marked(ictx, cpkg->pkg)) { i3_error(ictx, pkg, I3ERR_CONFLICT, _("%s conflicts with %s"), pkg_id(pkg), pkg_id(cpkg->pkg)); ncnfl++; } } /* conflicts with db packages */ for (i = 0; i < n_array_size(pkg->caps); i++) { struct capreq *cap = n_array_nth(pkg->caps, i); if ((ictx->ps->flags & PSET_VRFY_MERCY) && capreq_is_bastard(cap)) continue; msg_i(3, indent, "cap %s\n", capreq_stra(cap)); n = find_db_conflicts_dbcnfl_with_cap(indent, ictx, pkg, cap); ncnfl += n; } if (pkg->cnfls != NULL) for (i = 0; i < n_array_size(pkg->cnfls); i++) { struct capreq *cnfl = n_array_nth(pkg->cnfls, i); if (capreq_is_obsl(cnfl)) continue; msg_i(3, indent, "cnfl %s\n", capreq_stra(cnfl)); n = find_db_conflicts_cnfl_with_db(indent, ictx, pkg, cnfl); ncnfl += n; } /* XXX: find file-based conflicts should be here, but it is too slow; rpmlib checks conflicts in special way and it is not available via API */ return ncnfl == 0; }
static void visit_badreqs(struct pkgmark_set *pms, struct pkg *pkg, int deep) { if (pkg_has_unmetdeps(pms, pkg)) return; pkg_set_unmetdeps(pms, pkg); msg_i(4, deep, " %s\n", pkg_id(pkg)); deep += 2; if (pkg->revreqpkgs) { unsigned int i; for (i=0; i<n_array_size(pkg->revreqpkgs); i++) { struct pkg *revpkg; revpkg = n_array_nth(pkg->revreqpkgs, i); if (!pkg_has_unmetdeps(pms, revpkg)) visit_badreqs(pms, revpkg, deep); } } }
/** * Callback from remote_dispatcher when a message is received. */ void message_service::handle_message_packet(const ID& remote_peer_id, darc::buffer::shared_buffer data) { inbound_data<serializer::boost_serializer, message_packet> msg_i(data); const ID& tag_id = msg_i.get().tag_id; //boost::mutex::scoped_lock lock(mutex_); dispatcher_list_type::iterator elem = dispatcher_list_.find(tag_id); if(elem != dispatcher_list_.end()) { elem->second->remote_message_recv(tag_id, data); } else { // silently ignore // iris::glog<iris::Warning>("message_service: remote msg for unknown tag id", // "tag_id", iris::arg<ID>(tag_id)); } }
/* check if cnfl conflicts with db */ static int find_db_conflicts_cnfl_with_db(int indent, struct i3ctx *ictx, struct pkg *pkg, const struct capreq *cnfl) { int i, ncnfl = 0; tn_hash *ht = NULL; tn_array *dbpkgs = NULL; pkgdb_search(ictx->ts->db, &dbpkgs, PMTAG_CAP, capreq_name(cnfl), iset_packages_by_recno(ictx->unset), PKG_LDWHOLE_FLDEPDIRS); if (dbpkgs == NULL) return 0; msgn_i(4, indent, "Processing conflict %s:%s...", pkg_id(pkg), capreq_stra(cnfl)); if (ictx->ts->getop(ictx->ts, POLDEK_OP_ALLOWDUPS) && n_array_size(dbpkgs) > 1) { ht = n_hash_new(21, NULL); n_hash_ctl(ht, TN_HASH_NOCPKEY); for (i=0; i<n_array_size(dbpkgs); i++) { struct pkg *dbpkg = n_array_nth(dbpkgs, i); if (n_hash_exists(ht, dbpkg->name)) continue; if (!pkg_match_req(dbpkg, cnfl, 1)) { msgn_i(5, indent, "%s: conflict disarmed by %s", capreq_stra(cnfl), pkg_id(dbpkg)); n_hash_insert(ht, dbpkg->name, pkg); } } } for (i=0; i < n_array_size(dbpkgs); i++) { struct pkg *dbpkg = n_array_nth(dbpkgs, i); msg_i(6, indent, "%d. %s (%s) <-> %s ?\n", i, pkg_id(pkg), capreq_stra(cnfl), pkg_id(dbpkg)); if (ht && n_hash_exists(ht, dbpkg->name)) continue; if (!pkg_is_colored_like(pkg, dbpkg)) continue; if (pkg_match_req(dbpkg, cnfl, 1)) { if (!resolve_conflict(indent, ictx, pkg, cnfl, dbpkg)) { i3_error(ictx, pkg, I3ERR_DBCONFLICT, _("%s (cnfl %s) conflicts with installed %s"), pkg_id(pkg), capreq_stra(cnfl), pkg_id(dbpkg)); logn(LOGERR, _("%s (cnfl %s) conflicts with installed %s"), pkg_id(pkg), capreq_stra(cnfl), pkg_id(dbpkg)); ncnfl++; } } } if (ht) n_hash_free(ht); n_array_free(dbpkgs); return ncnfl; }