/* pkg_vec.c - the opkg package management system
Steven M. Ayer
-
+
Copyright (C) 2002 Compaq Computer Corporation
This program is free software; you can redistribute it and/or
/* look for a duplicate pkg by name, version, and architecture */
for (i = 0; i < vec->len; i++){
opkg_msg(DEBUG2, "%s %s arch=%s vs. %s %s arch=%s.\n",
- pkg->name, pkg->version, pkg->architecture,
+ pkg->name, pkg->version, pkg->architecture,
vec->pkgs[i]->name, vec->pkgs[i]->version,
vec->pkgs[i]->architecture);
- if ((strcmp(pkg->name, vec->pkgs[i]->name) == 0)
- && (pkg_compare_versions(pkg, vec->pkgs[i]) == 0)
- && (strcmp(pkg->architecture, vec->pkgs[i]->architecture) == 0)) {
+ /* if the name,ver,arch matches, or the name matches and the
+ * package is marked deinstall/hold */
+ if ((!strcmp(pkg->name, vec->pkgs[i]->name))
+ && ((pkg->state_want == SW_DEINSTALL
+ && (pkg->state_flag & SF_HOLD))
+ || ((pkg_compare_versions(pkg, vec->pkgs[i]) == 0)
+ && (!strcmp(pkg->architecture, vec->pkgs[i]->architecture))))) {
found = 1;
opkg_msg(DEBUG2, "Duplicate for pkg=%s version=%s arch=%s.\n",
pkg->name, pkg->version, pkg->architecture);
}
/* we didn't find one, add it */
- if (!found){
+ if (!found){
opkg_msg(DEBUG2, "Adding new pkg=%s version=%s arch=%s.\n",
pkg->name, pkg->version, pkg->architecture);
pkg_vec_insert(vec, pkg);
abstract_pkg_vec_t * abstract_pkg_vec_alloc(void)
{
- abstract_pkg_vec_t * vec ;
+ abstract_pkg_vec_t * vec ;
vec = xcalloc(1, sizeof(abstract_pkg_vec_t));
vec->pkgs = NULL;
vec->len = 0;
abstract_pkg_t * abstract_pkg_vec_get(abstract_pkg_vec_t *vec, int i)
{
- if (vec->len > i)
+ if (vec->len > i)
return vec->pkgs[i];
else
return NULL;