summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2013-07-12 11:48:52 +0200
committerMichael Schroeder <mls@suse.de>2013-07-12 11:48:52 +0200
commit9665e746338a78d717ef8156f0862e74b96a873e (patch)
treebb15df0fb7d0cd7faa5e2e460a69366ee56a9c27
parent091cdaec12c166c48a0e2126d52654137d96d524 (diff)
downloadlibsolv-9665e746338a78d717ef8156f0862e74b96a873e.tar.gz
libsolv-9665e746338a78d717ef8156f0862e74b96a873e.tar.bz2
libsolv-9665e746338a78d717ef8156f0862e74b96a873e.zip
bring installcheck up to speed
- noarch packages should not be part of an archlock - the archlock part is no longer needed as we have infarch rules - it makes no sense to try to install all packages and do the nocheck filtering on the results
-rw-r--r--tools/installcheck.c126
1 files changed, 52 insertions, 74 deletions
diff --git a/tools/installcheck.c b/tools/installcheck.c
index fe9473e..73fa61c 100644
--- a/tools/installcheck.c
+++ b/tools/installcheck.c
@@ -56,11 +56,11 @@ main(int argc, char **argv)
Queue job;
Queue rids;
Queue cand;
- Queue archlocks;
char *arch, *exclude_pat;
int i, j;
Id p;
- Id rpmarch, rpmrel, archlock;
+ Id archid, noarchid;
+ Id rpmrel;
#ifndef DEBIAN
Id rpmid;
#endif
@@ -70,13 +70,13 @@ main(int argc, char **argv)
int obsoletepkgcheck = 0;
exclude_pat = 0;
- archlock = 0;
if (argc < 3)
usage(argv);
arch = argv[1];
pool = pool_create();
pool_setarch(pool, arch);
+ noarchid = pool->solvables[SYSTEMSOLVABLE].arch;
for (i = 2; i < argc; i++)
{
FILE *fp;
@@ -160,30 +160,29 @@ main(int argc, char **argv)
}
pool_addfileprovides(pool);
pool_createwhatprovides(pool);
+ archid = pool_str2id(pool, arch, 0);
#ifndef DEBIAN
rpmid = pool_str2id(pool, "rpm", 0);
- rpmarch = pool_str2id(pool, arch, 0);
rpmrel = 0;
- if (rpmid && rpmarch)
+ if (rpmid && archid)
{
for (p = 1; p < pool->nsolvables; p++)
{
Solvable *s = pool->solvables + p;
- if (s->name == rpmid && s->arch == rpmarch)
+ if (s->name == rpmid && s->arch == archid && pool_installable(pool, s))
break;
}
if (p < pool->nsolvables)
- rpmrel = pool_rel2id(pool, rpmid, rpmarch, REL_ARCH, 1);
+ rpmrel = pool_rel2id(pool, rpmid, archid, REL_ARCH, 1);
}
#else
- rpmrel = rpmarch = 0;
+ rpmrel = 0;
#endif
queue_init(&job);
queue_init(&rids);
queue_init(&cand);
- queue_init(&archlocks);
- for (p = 1; p < pool->nsolvables; p++)
+ for (p = 1; p < (nocheck ? nocheck : pool->nsolvables); p++)
{
Solvable *s = pool->solvables + p;
if (!s->repo)
@@ -195,60 +194,59 @@ main(int argc, char **argv)
}
if (!pool_installable(pool, s))
continue;
- if (rpmrel && s->arch != rpmarch)
+ if (archid && s->arch != archid && s->arch != noarchid)
{
+ /* check if we will conflict with a infarch rule, if yes,
+ * don't bother checking the package */
Id rp, rpp;
FOR_PROVIDES(rp, rpp, s->name)
{
if (pool->solvables[rp].name != s->name)
continue;
- if (pool->solvables[rp].arch == rpmarch)
+ if (pool->solvables[rp].arch == archid)
break;
}
if (rp)
- {
- queue_push(&archlocks, p);
- continue;
- }
+ continue;
}
queue_push(&cand, p);
}
-
- if (archlocks.count)
- {
- archlock = pool_queuetowhatprovides(pool, &archlocks);
- }
-
-
if (obsoletepkgcheck)
- for (i = 0; i < cand.count; i++)
- {
- Solvable *s;
- s = pool->solvables + cand.elements[i];
+ {
+ int obsoleteusesprovides = pool_get_flag(pool, POOL_FLAG_OBSOLETEUSESPROVIDES);
+ int obsoleteusescolors = pool_get_flag(pool, POOL_FLAG_OBSOLETEUSESCOLORS);
- if (s->obsoletes)
- {
- Id op, opp;
- Id obs, *obsp = s->repo->idarraydata + s->obsoletes;
+ for (i = 0; i < cand.count; i++)
+ {
+ Solvable *s;
+ s = pool->solvables + cand.elements[i];
- while ((obs = *obsp++) != 0)
- {
- FOR_PROVIDES(op, opp, obs)
- {
- if (nocheck && op >= nocheck)
- continue;
+ if (s->obsoletes)
+ {
+ Id obs, *obsp = s->repo->idarraydata + s->obsoletes;
- if (!solvable_identical(s, pool_id2solvable(pool, op))
- && pool_match_nevr(pool, pool_id2solvable(pool, op), obs))
- {
- status = 2;
- printf("can't install %s:\n", pool_solvid2str(pool, op));
- printf(" package is obsoleted by %s\n", pool_solvable2str(pool, s));
- }
- }
- }
- }
- }
+ while ((obs = *obsp++) != 0)
+ {
+ Id op, opp;
+ FOR_PROVIDES(op, opp, obs)
+ {
+ Solvable *os = pool->solvables + op;
+ if (nocheck && op >= nocheck)
+ continue;
+ if (solvable_identical(s, os))
+ continue;
+ if (!obsoleteusesprovides && !pool_match_nevr(pool, os, obs))
+ continue;
+ if (obsoleteusescolors && !pool_colormatch(pool, s, os))
+ continue;
+ status = 2;
+ printf("can't install %s:\n", pool_solvid2str(pool, op));
+ printf(" package is obsoleted by %s\n", pool_solvable2str(pool, s));
+ }
+ }
+ }
+ }
+ }
solv = solver_create(pool);
@@ -259,19 +257,10 @@ main(int argc, char **argv)
for (i = 0; i < cand.count; i++)
{
p = cand.elements[i];
- queue_push(&job, SOLVER_INSTALL|SOLVER_SOLVABLE|SOLVER_WEAK);
- queue_push(&job, p);
+ queue_push2(&job, SOLVER_INSTALL|SOLVER_SOLVABLE|SOLVER_WEAK, p);
}
if (rpmrel)
- {
- queue_push(&job, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME);
- queue_push(&job, rpmrel);
- }
- if (archlock)
- {
- queue_push(&job, SOLVER_LOCK|SOLVER_SOLVABLE_ONE_OF);
- queue_push(&job, archlock);
- }
+ queue_push2(&job, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME, rpmrel);
solver_set_flag(solv, SOLVER_FLAG_IGNORE_RECOMMENDED, 1);
solver_solve(solv, &job);
/* prune... */
@@ -304,13 +293,11 @@ main(int argc, char **argv)
int problemcount;
p = cand.elements[i];
- if (nocheck && p >= nocheck)
- continue;
if (exclude_pat)
{
char *ptr, *save = 0, *pattern;
int match = 0;
- pattern = strdup(exclude_pat);
+ pattern = solv_strdup(exclude_pat);
for (ptr = strtok_r(pattern, " ", &save);
ptr;
@@ -322,24 +309,15 @@ main(int argc, char **argv)
break;
}
}
- free(pattern);
+ solv_free(pattern);
if (match)
continue;
}
s = pool->solvables + p;
queue_empty(&job);
- queue_push(&job, SOLVER_INSTALL|SOLVER_SOLVABLE);
- queue_push(&job, p);
+ queue_push2(&job, SOLVER_INSTALL|SOLVER_SOLVABLE, p);
if (rpmrel)
- {
- queue_push(&job, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME);
- queue_push(&job, rpmrel);
- }
- if (archlock)
- {
- queue_push(&job, SOLVER_LOCK|SOLVER_SOLVABLE_ONE_OF);
- queue_push(&job, archlock);
- }
+ queue_push2(&job, SOLVER_INSTALL|SOLVER_SOLVABLE_NAME, rpmrel);
solver_set_flag(solv, SOLVER_FLAG_IGNORE_RECOMMENDED, 1);
problemcount = solver_solve(solv, &job);
if (problemcount)