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

tille at alioth.debian.org tille at alioth.debian.org
Sat Feb 2 23:49:25 UTC 2008


Author: tille
Date: 2008-02-02 23:49:25 +0000 (Sat, 02 Feb 2008)
New Revision: 1272

Modified:
   trunk/community/infrastructure/test/cddtasktools.py
   trunk/community/infrastructure/test/update-tasks_using_python-debian
Log:
testscript starts to produce reasonable results


Modified: trunk/community/infrastructure/test/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/test/cddtasktools.py	2008-02-02 22:38:38 UTC (rev 1271)
+++ trunk/community/infrastructure/test/cddtasktools.py	2008-02-02 23:49:25 UTC (rev 1272)
@@ -174,8 +174,9 @@
                     responsible = stanza['responsible']
                     continue
 
+                debug = 0
                 if key in dependency_keys:
-                    print "DEBUG", key,':', stanza[key]
+                    debug += 1
                     # turn alternatives ('|') into real depends for this purpose
                     # because we are finally interested in all alternatives
                     dependencies = stanza[key].replace('|',',').split(',')
@@ -200,15 +201,13 @@
                         dep.dists.append(self.available.dist)
                         # Find the component the Dependency might be in
                         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
                                       # package with the same name in main and contrib
                                       # at the same time for instance
-                    continue # at th
+                    continue
                 # The following keys will be mostly used for programs that
                 # are not yet existing in Debian and will go to our todo list
                 if key == 'Homepage':
@@ -255,12 +254,9 @@
     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'
 
 

Modified: trunk/community/infrastructure/test/update-tasks_using_python-debian
===================================================================
--- trunk/community/infrastructure/test/update-tasks_using_python-debian	2008-02-02 22:38:38 UTC (rev 1271)
+++ trunk/community/infrastructure/test/update-tasks_using_python-debian	2008-02-02 23:49:25 UTC (rev 1272)
@@ -9,25 +9,74 @@
 # (at your option) any later version.
 
 import sys
-import urllib
-import StringIO
-import gzip
 
-BASEURL='http://ftp.debian.de/debian/dists/'
-DIST='unstable'
+#import urllib
+#import StringIO
+#import gzip
 
-from debian_bundle import deb822
+#BASEURL='http://ftp.debian.de/debian/dists/'
+#DIST='unstable'
 
+from cddtasktools import Available, CddDependencies, Task, TaskDependencies
 
-for component in ('main', 'contrib', 'non-free' ):
-    f = urllib.urlopen(BASEURL+'/'+DIST+'/'+component+'/binary-i386/Packages.gz')
-    compresseddata = f.read()
-    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:
-            print stanza['package'] + ':' + description[0]
+
+tdeps=TaskDependencies('debian-med', 'bio')
+tdeps.GetTaskDependencies()
+
+print "---------- official ----------"
+for tdep in tdeps.dependencies['official']:
+    print tdep.pkg, ':', tdep.pkgShortDesc
+
+print "---------- unofficial ----------"
+for tdep in tdeps.dependencies['unofficial']:
+    print tdep.pkg, ':', tdep.pkgShortDesc
+
+print "---------- prospective ----------"
+for tdep in tdeps.dependencies['prospective']:
+    print tdep.pkg, ':', tdep.pkgShortDesc
+
+sys.exit(0)
+
+deps=CddDependencies('debian-science')
+deps.GetTasks()
+
+print deps.tasks
+
+sys.exit(0)
+
+available = Available()
+available.GetPackageNames()
+
+for pkg in available.pkgnames['main']:
+    print pkg
+
+sys.exit(0)
+
+# Some keys might be ignored because they work as
+# comments in the tasks file for the moment
+ignore_keys = [ "Why", "Responsible" ]
+
+# These keys might contain more than one item that
+# has to be separated to detect the dependency
+dependency_keys = [ "Depends", "Recommends", "Suggests" ] 
+
+
+for fname in sys.argv[1:]:
+    f = file(fname)
+    for stanza in deb822.Sources.iter_paragraphs(f):
+        #        pieces = stanza['version'].split('-')
+        #        if len(pieces) < 2:
+        for key in stanza:
+            if key in ignore_keys:
+                continue
+            if key in dependency_keys:
+                # turn alternatives ('|') into real depends for this purpose
+                # because we are finally interested in all alternatives
+                dependencies = stanza[key].replace('|',',').split(',')
+                for dep in dependencies:
+                    print key, ':', dep.strip()
+            else:
+                print key, ':', stanza[key]
+            
     f.close()
 




More information about the debian-med-commit mailing list