[Yum-devel] [PATCH] Create "strong requires", and use that for recheck on upgrade. BZ 785690
Panu Matilainen
pmatilai at laiskiainen.org
Wed Feb 8 07:15:35 UTC 2012
On 02/07/2012 11:31 PM, James Antill wrote:
> ---
> yum/depsolve.py | 2 +-
> yum/packages.py | 10 ++++++++++
> 2 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/yum/depsolve.py b/yum/depsolve.py
> index 6b386c2..a8f9acb 100644
> --- a/yum/depsolve.py
> +++ b/yum/depsolve.py
> @@ -1003,7 +1003,7 @@ class Depsolve(object):
> oldreqs = []
> if not self.conf.recheck_installed_requires:
> for oldpo in txmbr.updates:
> - oldreqs.extend(oldpo.returnPrco('requires'))
> + oldreqs.extend(oldpo.returnPrco('strong_requires'))
> oldreqs = set(oldreqs)
>
> ret = []
> diff --git a/yum/packages.py b/yum/packages.py
> index 6bc909e..8dec8bf 100644
> --- a/yum/packages.py
> +++ b/yum/packages.py
> @@ -1409,6 +1409,12 @@ class YumHeaderPackage(YumAvailablePackage):
> continue
>
> lst = hdr[getattr(rpm, 'RPMTAG_%sFLAGS' % tag)]
> + if tag == 'REQUIRE':
> + # Rpm is a bit magic here, and if pkgA requires(pre/post): foo
> + # it will then let you remove foo _after_ pkgA has been
> + # installed. So we need to mark those deps. as "weak".
> + bits = rpm.RPMSENSE_SCRIPT_PRE | rpm.RPMSENSE_SCRIPT_POST
> + weakreqs = [bool(flag& bits) for flag in lst]
> flag = map(rpmUtils.miscutils.flagToString, lst)
> flag = map(misc.share_data, flag)
>
> @@ -1419,6 +1425,10 @@ class YumHeaderPackage(YumAvailablePackage):
>
> prcotype = tag2prco[tag]
> self.prco[prcotype] = map(misc.share_data, zip(name,flag,vers))
> + if tag == 'REQUIRE':
> + weakreqs = zip(weakreqs, self.prco[prcotype])
> + strongreqs = [wreq[1] for wreq in weakreqs if not wreq[0]]
> + self.prco['strong_requires'] = strongreqs
>
> def tagByName(self, tag):
> warnings.warn("tagByName() will go away in a furture version of Yum.\n",
ACK, although "strong" and "weak" requires make me think of something
entirely different :) Perhaps script_requires would be more to the point?
Also ACK for the recheck_installed_requires patch, with this patch in
the picture my earlier comments about that no longer apply.
- Panu -
More information about the Yum-devel
mailing list