[Yum-devel] [PATCH] Create "strong requires", and use that for recheck on upgrade. BZ 785690

James Antill james at fedoraproject.org
Wed Feb 8 13:53:09 UTC 2012


On Wed, 2012-02-08 at 09:15 +0200, Panu Matilainen wrote:
> 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?

 Well script_requires don't really work, because PREUN/POSTUN are always
there ... I thought it might map well to the idea of a "weak reference",
in that what you are pointing to can go away. So did weak/strong.
 I tried to think of a way of splitting them by type so you'd have
"requires needed to do an install" and "requires needed for the package
to be installed", but installed_requires would probably be really
confusing.

 Meh, unless anyone shouts I'll push it with the current naming.



More information about the Yum-devel mailing list