Add function that returns the Sum of the size of all the packages which depend 
on a package. Access get_total_source_deps_size via a packages's dependency
manager.

Signed-off-by: Michael Wood <[email protected]>
---
 bitbake/lib/toaster/orm/models.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/orm/models.py 
b/bitbake/lib/toaster/orm/models.py
index a4b0557..10f1cce 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -20,7 +20,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 from django.db import models, IntegrityError
-from django.db.models import F, Q, Avg, Max
+from django.db.models import F, Q, Avg, Max, Sum
 from django.utils import timezone
 
 from django.core.urlresolvers import reverse
@@ -594,6 +594,12 @@ class Package_DependencyManager(models.Manager):
     def get_query_set(self):
         return super(Package_DependencyManager, 
self).get_query_set().exclude(package_id = F('depends_on__id'))
 
+    def get_total_source_deps_size(self):
+        """ Returns the total file size of all the packages that depend on
+        thispackage.
+        """
+        return self.all().aggregate(Sum('depends_on__size'))
+
 class Package_Dependency(models.Model):
     TYPE_RDEPENDS = 0
     TYPE_TRDEPENDS = 1
-- 
2.1.4

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to