[Blends-commit] [SCM] website branch, master, updated. 89c601c11eb22ba6b62a0c62f1f6e255ac7b9803

Ole Streicher olebole at debian.org
Wed Mar 23 20:00:00 UTC 2016


The following commit has been merged in the master branch:
commit 89c601c11eb22ba6b62a0c62f1f6e255ac7b9803
Author: Ole Streicher <olebole at debian.org>
Date:   Wed Mar 23 20:52:33 2016 +0100

    Remove duplicates from package count, and use only existing packages

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index d6c1c18..7754a58 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -13,6 +13,7 @@ License: GPL
 '''
 
 from sys import stderr, exit
+import itertools
 from subprocess import Popen, PIPE
 import codecs
 import os
@@ -1015,8 +1016,9 @@ class Tasks:
                                         break
                             logger.debug(" %s -> %s" % (enh, dep.properties['Enhances'][enh]))
 
-    def getPackageCount(self):
-        return sum(task.getPackageCount() for task in self.tasks.values())
+    def getPackageNames(self, sections):
+        return set(*(task.getPackageNames(sections)
+                     for task in self.tasks.values()))
 
 class TaskDependencies:
     # List of depencencies defined in one metapackage
@@ -1702,8 +1704,11 @@ class TaskDependencies:
             self.dependencies[dependency].sort()
         return 1  # Success
 
-    def getPackageCount(self):
-        return sum(len(dep) for dep in self.dependencies.values())
+    def getPackageNames(self, sections):
+        return set(itertools.chain(*(
+            (dep.properties['name'] for dep in self.dependencies[d])
+            for d in sections
+        )))
 
     def _QueryUDD4Package(self, source):
         query = "EXECUTE pkg_releases ('%s', '%s')" % (self.properties['name'], self.properties['component'])
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index ef39ea9..bb302c2 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -13,6 +13,7 @@ License: GPL
 '''
 
 from sys import stderr, exit
+import itertools
 import codecs
 import os
 import grp
@@ -944,8 +945,9 @@ class Tasks:
                                         break
                             logger.debug(" %s -> %s" % (enh, dep.properties['Enhances'][enh]))
 
-    def getPackageCount(self):
-        return sum(task.getPackageCount() for task in self.tasks.values())
+    def getPackageNames(self, sections):
+        return set(*(task.getPackageNames(sections)
+                     for task in self.tasks.values()))
 
 class TaskDependencies:
     # List of depencencies defined in one metapackage
@@ -1264,8 +1266,11 @@ class TaskDependencies:
 
         return 1
 
-    def getPackageCount(self):
-        return sum(len(dep) for dep in self.dependencies.values())
+    def getPackageNames(self, sections):
+        return set(itertools.chain(*(
+            (dep.properties['name'] for dep in self.dependencies[d])
+            for d in sections
+        )))
 
     def __str__(self):
         ret = "Blend: " + self.blendname + ", " \
diff --git a/webtools/tasks.py b/webtools/tasks.py
index ae5f3ec..a2b1ceb 100755
--- a/webtools/tasks.py
+++ b/webtools/tasks.py
@@ -30,12 +30,13 @@ packages = tasks.GetNamesOnlyDict()
 tasks.GetAllDependentPackagesOfBlend()
 
 data = tasks.data
-data['timestamp']        = formatdate(time.mktime(datetime.now().timetuple()))
-data['tasks']            = tasks.GetTaskDescDict()
-data['taskskeys']        = tasks.metapackagekeys
-data['pkgcount']         = tasks.getPackageCount()
+data['timestamp'] = formatdate(time.mktime(datetime.now().timetuple()))
+data['tasks'] = tasks.GetTaskDescDict()
+data['taskskeys'] = tasks.metapackagekeys
+data['pkgcount'] = len(tasks.getPackageNames(['official_high', 'official_low',
+                                              'non-free', 'experimental']))
 data['popconsubmit'] = tasks.popconsubmit or 'unknown'
-data['languages']    = languages
+data['languages'] = languages
 
 # Define directories used
 current_dir  = os.path.dirname(__file__)
diff --git a/webtools/tasks_udd.py b/webtools/tasks_udd.py
index e069afc..2fe47de 100755
--- a/webtools/tasks_udd.py
+++ b/webtools/tasks_udd.py
@@ -30,12 +30,13 @@ packages = tasks.GetNamesOnlyDict()
 tasks.GetAllDependentPackagesOfBlend()
 
 data = tasks.data
-data['timestamp']        = formatdate(time.mktime(datetime.now().timetuple()))
-data['tasks']            = tasks.GetTaskDescDict()
-data['taskskeys']        = tasks.metapackagekeys
-data['pkgcount']         = tasks.getPackageCount()
+data['timestamp'] = formatdate(time.mktime(datetime.now().timetuple()))
+data['tasks'] = tasks.GetTaskDescDict()
+data['taskskeys'] = tasks.metapackagekeys
+data['pkgcount'] = len(tasks.getPackageNames(['official_high', 'official_low',
+                                              'non-free', 'experimental']))
 data['popconsubmit'] = tasks.popconsubmit or 'unknown'
-data['languages']    = languages
+data['languages'] = languages
 
 # Define directories used
 current_dir  = os.path.dirname(__file__)

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list