FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Infrastructure

 
 
LinkBack Thread Tools
 
Old 03-21-2012, 01:09 PM
Chris Lumens
 
Default Add spaceRequired property so YumPayload can tell its disk space needs.

> @@ -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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-21-2012, 01:14 PM
David Lehman
 
Default 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


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 08:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org