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

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

 



> @@ -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.

> +        """ 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux