diff options
author | Michael Schroeder <mls@suse.de> | 2010-05-28 16:17:06 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2010-05-28 16:17:06 +0200 |
commit | 7a6a10a3614b92a38a27d0b8fad6a8be7856f7be (patch) | |
tree | 9155be177541a1ee58f0c696becc25d85a786d97 /src/policy.c | |
parent | b0f3a66478ec01202820925f2d6ddd2816412290 (diff) | |
download | libsolv-7a6a10a3614b92a38a27d0b8fad6a8be7856f7be.tar.gz libsolv-7a6a10a3614b92a38a27d0b8fad6a8be7856f7be.tar.bz2 libsolv-7a6a10a3614b92a38a27d0b8fad6a8be7856f7be.zip |
- add SOLVER_SET bits to tell solver which properties of a job are intended by the user
- add policy_is_illegal check function
- rework solv package select function to use new SET bits
Diffstat (limited to 'src/policy.c')
-rw-r--r-- | src/policy.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/policy.c b/src/policy.c index 168400b..0dc3df8 100644 --- a/src/policy.c +++ b/src/policy.c @@ -441,6 +441,31 @@ policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2) return 1; /* no class matches */ } +/* check if it is illegal to replace installed + * package "is" with package "s" (which must obsolete "is") + */ +int +policy_is_illegal(Solver *solv, Solvable *is, Solvable *s, int ignore) +{ + Pool *pool = solv->pool; + int ret = 0; + if (!(ignore & POLICY_ILLEGAL_DOWNGRADE) && !solv->allowdowngrade) + { + if (is->name == s->name && evrcmp(pool, is->evr, s->evr, EVRCMP_COMPARE) > 0) + ret |= POLICY_ILLEGAL_DOWNGRADE; + } + if (!(ignore & POLICY_ILLEGAL_ARCHCHANGE) && !solv->allowarchchange) + { + if (is->arch != s->arch && policy_illegal_archchange(solv, s, is)) + ret |= POLICY_ILLEGAL_ARCHCHANGE; + } + if (!(ignore & POLICY_ILLEGAL_VENDORCHANGE) && !solv->allowvendorchange) + { + if (is->vendor != s->vendor && policy_illegal_vendorchange(solv, s, is)) + ret |= POLICY_ILLEGAL_VENDORCHANGE; + } + return ret; +} /*------------------------------------------------------------------- * |