[med-svn] r1271 - trunk/community/infrastructure/test

tille at alioth.debian.org tille at alioth.debian.org
Sat Feb 2 22:38:38 UTC 2008


Author: tille
Date: 2008-02-02 22:38:38 +0000 (Sat, 02 Feb 2008)
New Revision: 1271

Modified:
   trunk/community/infrastructure/test/cddtasktools.py
Log:
Further alpha quality commit, several fixes, other bugs remain


Modified: trunk/community/infrastructure/test/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/test/cddtasktools.py	2008-02-02 21:02:20 UTC (rev 1270)
+++ trunk/community/infrastructure/test/cddtasktools.py	2008-02-02 22:38:38 UTC (rev 1271)
@@ -175,6 +175,7 @@
                     continue
 
                 if key in dependency_keys:
+                    print "DEBUG", key,':', stanza[key]
                     # turn alternatives ('|') into real depends for this purpose
                     # because we are finally interested in all alternatives
                     dependencies = stanza[key].replace('|',',').split(',')
@@ -185,17 +186,23 @@
                         deps_in_one_line.append(dependency.strip())
 
                     for dep_in_line in deps_in_one_line:
-                        dep = DependantPackage(self.cddname, task)
+                        # If there are more than one dependencies in one line
+                        # just put the current one into the right list of dependencies
+                        # before initiating the next instance
+                        if dep != None:
+                            self.dependencies[self._FindDependencyType(dep)].append(dep)
+                        dep = DependantPackage(self.cddname, self.task)
                         # Store the comments in case they might be usefull for later applications
                         dep.why            = why
                         dep.responsible    = responsible
                         dep.dependencytype = key
-                        dep.pkg            = stanza[key]
+                        dep.pkg            = dep_in_line
                         dep.dists.append(self.available.dist)
                         # Find the component the Dependency might be in
-                        print "DEBUG", self.available.components
                         for component in self.available.components:
+                            # print "DEB:", component, self.available.pkgnames[component]
                             if dep.pkg in self.available.pkgnames[component]:
+                                # print "D:", component, self.available.pkgnames[component]
                                 dep.component = component
                                 break # The same package should be only in one component
                                       # At least I currently see no reason for having a
@@ -241,16 +248,22 @@
                 else:
                     print "Unknown key '%s': %s" % (key, stanza[key])
             if dep != None:
-                if dep.component != None:
-                    self.dependencies['official'].append(dep)
-                elif dep.pkgURL != None:
-                    self.dependencies['unofficial'].append(dep)
-                else:
-                    self.dependencies['prospective'].append(dep)
+                self.dependencies[self._FindDependencyType(dep)].append(dep)
                 
         f.close()
 
+    def _FindDependencyType(self, dep):
+        # Return the name of the Dependencytype to append the Dependency to the right list
+        if dep.component != None:
+            print "DEBUG official:", dep.pkg
+            return 'official'
+        if dep.pkgURL != None:
+            print "DEBUG unofficial:", dep.pkg
+            return 'unofficial'
+        print "DEBUG prospective:", dep.pkg
+        return 'prospective'
 
+
 class Available:
     # Information about available packages
 
@@ -278,9 +291,12 @@
     def GetPackageNames(self):
         # Fetch Packages / Sources file and get list of package names out of it
 
-        if self.pkgnames != {}:
-            # Just got the Package names
-            return
+        # Check whether package names are just known
+        for component in self.pkgnames:
+            if self.pkgnames[component] != []:
+                # Just got the Package names because at least one component
+                # has non zero elements
+                return
 
         for component in self.components:
             f = urllib.urlopen(BASEURL+'/'+self.dist+'/'+component+'/'+self.binary+'/'+self.source)
@@ -288,10 +304,7 @@
             compressedstream = StringIO.StringIO(compresseddata)
             g = gzip.GzipFile(fileobj=compressedstream)
             for stanza in deb822.Sources.iter_paragraphs(g, shared_storage=False):
-                pieces = stanza['version'].split('-')
-                description = stanza['description'].split('\n')
-                if len(pieces) < 2:
-                    self.pkgnames[component].append(stanza['package'])
+                self.pkgnames[component].append(stanza['package'])
             f.close()
 
 available = Available()




More information about the debian-med-commit mailing list