[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 3/6] Add spaceRequired property so YumPayload can tell its disk space needs.



On Wed, 2012-03-21 at 10:09 -0400, Chris Lumens wrote:
> > @@ -617,6 +624,24 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
> >          log.debug("deselect package %s" % pkgid)
> >          self._yum.tsInfo.deselect(pkgid)
> >          super(YumPayload, self).deselectPackage(pkgid)
> > +        self._space_required = None
> > +
> > +    ###
> > +    ### METHODS FOR QUERYING STATE
> > +    ###
> > +    @property
> > +    def spaceRequired(self):
> 
> You'll want to add a spaceRequired property to the base class, too.

It's already there, raising NotImplementedError.

> 
> > +        """ The total disk space (Size) required for the current selection. """
> > +        # XXX this will only be useful if you've run checkSoftwareSelection
> > +        if not self._space_required:
> > +            total = 0
> > +            for txmbr in self._yum.tsInfo.getMembers():
> > +                total += getattr(txmbr.po, "installedsize", 0)
> > +
> > +            total += total * 0.10   # add 10% to account for metadata, &c
> > +            self._space_required = Size(bytes=total)
> > +
> > +        return self._space_required
> 
> It doesn't really matter, but you could shorten the total thing up a
> little like so:
> 
>     total *= 1.1
> 
> - Chris
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]