obs = pool->solvables + ob;
if (oas->name != obs->name)
{
+ /* bring "same name" obsoleters (i.e. upgraders) to front */
if (oas->name == s->name)
return -1;
if (obs->name == s->name)
return;
if (q > 0)
{
+ /* only a single obsoleting package */
queue_push(pkgs, q);
return;
}
/* find which packages obsolete us */
for (i = 0; i < ti->count; i += 2)
if (ti->elements[i + 1] == p)
- {
- queue_push(pkgs, p);
- queue_push(pkgs, ti->elements[i]);
- }
+ queue_push2(pkgs, p, ti->elements[i]);
/* sort obsoleters */
if (pkgs->count > 2)
solv_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool);
for (i = 0; i < pkgs->count; i += 2)
pkgs->elements[i / 2] = pkgs->elements[i + 1];
- pkgs->count /= 2;
+ queue_truncate(pkgs, pkgs->count / 2);
}
else
{
{
Pool *pool = trans->pool;
Solvable *s = pool->solvables + p;
- Queue ti;
- Id tibuf[5];
+ Queue *ti;
+ int i;
if (p <= 0 || !s->repo)
return 0;
p = trans->transaction_installed[p - pool->installed->start];
return p < 0 ? -p : p;
}
- queue_init_buffer(&ti, tibuf, sizeof(tibuf)/sizeof(*tibuf));
- transaction_all_obs_pkgs(trans, p, &ti);
- p = ti.count ? ti.elements[0] : 0;
- queue_free(&ti);
- return p;
+ ti = &trans->transaction_info;
+ for (i = 0; i < ti->count; i += 2)
+ if (ti->elements[i] == p)
+ return ti->elements[i + 1];
+ return 0;
}
}
else
{
- int noobs = trans->noobsmap.size && MAPTST(&trans->noobsmap, p);
- if (noobs)
- return p2 ? SOLVER_TRANSACTION_MULTIREINSTALL : SOLVER_TRANSACTION_MULTIINSTALL;
+ /* install or multiinstall */
+ int multi = trans->multiversionmap.size && MAPTST(&trans->multiversionmap, p);
+ if (multi)
+ {
+ if (p2)
+ {
+ s = pool->solvables + p;
+ s2 = pool->solvables + p2;
+ if (s->name == s2->name && s->arch == s2->arch && s->evr == s2->evr)
+ return SOLVER_TRANSACTION_MULTIREINSTALL;
+ }
+ return SOLVER_TRANSACTION_MULTIINSTALL;
+ }
if (!p2)
return SOLVER_TRANSACTION_INSTALL;
s = pool->solvables + p;
}
}
+static inline int
+is_pseudo_package(Pool *pool, Solvable *s)
+{
+ const char *n = pool_id2str(pool, s->name);
+ if (!strncmp(n, "patch:", 6))
+ return 1;
+ if (!strncmp(n, "pattern:", 8))
+ return 1;
+ return 0;
+}
+
+static int
+obsoleted_by_pseudos_only(Transaction *trans, Id p)
+{
+ Pool *pool = trans->pool;
+ Queue q;
+ Id op;
+ int i;
+
+ op = transaction_obs_pkg(trans, p);
+ if (op && !is_pseudo_package(pool, pool->solvables + op))
+ return 0;
+ queue_init(&q);
+ transaction_all_obs_pkgs(trans, p, &q);
+ for (i = 0; i < q.count; i++)
+ if (!is_pseudo_package(pool, pool->solvables + q.elements[i]))
+ break;
+ i = !q.count || i < q.count ? 0 : 1;
+ queue_free(&q);
+ return i;
+}
+
/*
* return type of transaction element
*
if (!s->repo)
return SOLVER_TRANSACTION_IGNORE;
- if (!(mode & SOLVER_TRANSACTION_KEEP_PSEUDO))
- {
- const char *n = pool_id2str(pool, s->name);
- if (!strncmp(n, "patch:", 6))
- return SOLVER_TRANSACTION_IGNORE;
- if (!strncmp(n, "pattern:", 8))
- return SOLVER_TRANSACTION_IGNORE;
- }
+ /* XXX: SUSE only? */
+ if (!(mode & SOLVER_TRANSACTION_KEEP_PSEUDO) && is_pseudo_package(pool, s))
+ return SOLVER_TRANSACTION_IGNORE;
type = transaction_base_type(trans, p);
if (type == SOLVER_TRANSACTION_ERASE || type == SOLVER_TRANSACTION_INSTALL || type == SOLVER_TRANSACTION_MULTIINSTALL)
return type;
if (s->repo == pool->installed)
- return SOLVER_TRANSACTION_IGNORE; /* ignore as we're being obsoleted */
+ {
+ /* check if we're obsoleted by pseudos only */
+ if (obsoleted_by_pseudos_only(trans, s - pool->solvables))
+ return SOLVER_TRANSACTION_ERASE;
+ return SOLVER_TRANSACTION_IGNORE; /* ignore as we're being obsoleted */
+ }
if (type == SOLVER_TRANSACTION_MULTIREINSTALL)
return SOLVER_TRANSACTION_MULTIINSTALL;
return SOLVER_TRANSACTION_INSTALL;
if (s->repo == pool->installed && (mode & SOLVER_TRANSACTION_SHOW_ACTIVE) == 0)
{
/* erase element and we're showing the passive side */
- if ((mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0 && type == SOLVER_TRANSACTION_OBSOLETED)
+ if (type == SOLVER_TRANSACTION_OBSOLETED && (mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0)
type = SOLVER_TRANSACTION_ERASE;
+ if (type == SOLVER_TRANSACTION_OBSOLETED && (mode & SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE) != 0)
+ type = SOLVER_TRANSACTION_UPGRADED;
return type;
}
if (s->repo != pool->installed && (mode & SOLVER_TRANSACTION_SHOW_ACTIVE) != 0)
{
/* install element and we're showing the active side */
- if ((mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0 && type == SOLVER_TRANSACTION_OBSOLETES)
+ if (type == SOLVER_TRANSACTION_OBSOLETES && (mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0)
type = SOLVER_TRANSACTION_INSTALL;
+ if (type == SOLVER_TRANSACTION_OBSOLETES && (mode & SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE) != 0)
+ type = SOLVER_TRANSACTION_UPGRADE;
return type;
}
Pool *pool = trans->pool;
Queue *ti = &trans->transaction_info;
Repo *installed = pool->installed;
- int i, j, noobs;
+ int i, j, multi;
Id p, p2, pp2;
Solvable *s, *s2;
s = pool->solvables + p;
if (!s->repo || s->repo == installed)
continue;
- noobs = trans->noobsmap.size && MAPTST(&trans->noobsmap, p);
+ multi = trans->multiversionmap.size && MAPTST(&trans->multiversionmap, p);
FOR_PROVIDES(p2, pp2, s->name)
{
if (!MAPTST(&trans->transactsmap, p2))
s2 = pool->solvables + p2;
if (s2->repo != installed)
continue;
- if (noobs && (s->name != s2->name || s->evr != s2->evr || s->arch != s2->arch))
+ if (multi && (s->name != s2->name || s->evr != s2->evr || s->arch != s2->arch))
continue;
if (!pool->implicitobsoleteusesprovides && s->name != s2->name)
continue;
- if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2))
+ if (pool->implicitobsoleteusescolors && !pool_colormatch(pool, s, s2))
continue;
queue_push2(ti, p, p2);
}
- if (s->obsoletes && !noobs)
+ if (s->obsoletes && (!multi || !pool->noobsoletesmultiversion))
{
Id obs, *obsp = s->repo->idarraydata + s->obsoletes;
while ((obs = *obsp++) != 0)
Transaction *
-transaction_create_decisionq(Pool *pool, Queue *decisionq, Map *noobsmap)
+transaction_create_decisionq(Pool *pool, Queue *decisionq, Map *multiversionmap)
{
Repo *installed = pool->installed;
- int i, neednoobs;
+ int i, needmulti;
Id p;
Solvable *s;
Transaction *trans;
trans = transaction_create(pool);
- if (noobsmap && !noobsmap->size)
- noobsmap = 0; /* ignore empty map */
+ if (multiversionmap && !multiversionmap->size)
+ multiversionmap = 0; /* ignore empty map */
queue_empty(&trans->steps);
map_init(&trans->transactsmap, pool->nsolvables);
- neednoobs = 0;
+ needmulti = 0;
for (i = 0; i < decisionq->count; i++)
{
p = decisionq->elements[i];
continue;
#endif
MAPSET(&trans->transactsmap, p);
- if (noobsmap && MAPTST(noobsmap, p))
- neednoobs = 1;
+ if (multiversionmap && MAPTST(multiversionmap, p))
+ needmulti = 1;
}
}
MAPCLR(&trans->transactsmap, SYSTEMSOLVABLE);
- if (neednoobs)
- map_init_clone(&trans->noobsmap, noobsmap);
+ if (needmulti)
+ map_init_clone(&trans->multiversionmap, multiversionmap);
create_transaction_info(trans, decisionq);
memcpy(trans->transaction_installed, srctrans->transaction_installed, (installed->end - installed->start) * sizeof(Id));
}
map_init_clone(&trans->transactsmap, &srctrans->transactsmap);
- map_init_clone(&trans->noobsmap, &srctrans->noobsmap);
+ map_init_clone(&trans->multiversionmap, &srctrans->multiversionmap);
if (srctrans->orderdata)
{
struct _TransactionOrderdata *od = srctrans->orderdata;
queue_free(&trans->transaction_info);
trans->transaction_installed = solv_free(trans->transaction_installed);
map_free(&trans->transactsmap);
- map_free(&trans->noobsmap);
+ map_free(&trans->multiversionmap);
transaction_free_orderdata(trans);
free(trans);
}
return;
/* make room */
steps = &trans->steps;
- queue_insertn(steps, 0, max);
+ queue_insertn(steps, 0, max, 0);
/* now add em */
map_init(&done, installed->end - installed->start);
Map ins, seen;
int i;
- POOL_DEBUG(SOLV_WARN, "\nchecking transaction order...\n");
+ POOL_DEBUG(SOLV_DEBUG_RESULT, "\nchecking transaction order...\n");
map_init(&ins, pool->nsolvables);
map_init(&seen, pool->nsolvables);
if (pool->installed)
}
map_free(&seen);
map_free(&ins);
- POOL_DEBUG(SOLV_WARN, "transaction order check done.\n");
+ POOL_DEBUG(SOLV_DEBUG_RESULT, "transaction order check done.\n");
}