[Cdd-commits] r1115 - cdd/trunk/webtools

CDD Subversion Commit noreply at alioth.debian.org
Thu Oct 2 07:35:14 UTC 2008


Author: tille
Date: Thu Oct  2 07:35:14 2008
New Revision: 1115

Modified:
   cdd/trunk/webtools/ddpo_register.py
   cdd/trunk/webtools/distasktools.py
Log:
Regard source packages for ddpo subscriptions


Modified: cdd/trunk/webtools/ddpo_register.py
==============================================================================
--- cdd/trunk/webtools/ddpo_register.py	(original)
+++ cdd/trunk/webtools/ddpo_register.py	Thu Oct  2 07:35:14 2008
@@ -16,12 +16,12 @@
 if cdeps.data['pkglist'] == '':
 	print >>stderr, "Config file webconf/%s.conf is lacking pkglist field." % (argv[1])
 	exit(-1)
-cdeps.GetAllDependencies()
-packages     = cdeps.GetNamesOnlyDict()
+cdeps.GetAllDependencies(source=1)
+# packages = cdeps.GetNamesOnlyDict()
+packages = cdeps.GetNamesOnlyDict(dependencytypes=('depends','recommends','suggests'))
 
 print "user", cdeps.data['pkglist']
-for task in cdeps.metapackagekeys:
-	for type in ['depends', 'recommends', 'suggests']:
-		for project in cdeps.tasks[task].dependencies[type]:
-			print "subscribe %s %s" % ( project.pkg, task )
+for task in packages.keys():
+	for pkg in packages[task]:
+		print "subscribe %s %s" % ( pkg, task )
 print "thanks"

Modified: cdd/trunk/webtools/distasktools.py
==============================================================================
--- cdd/trunk/webtools/distasktools.py	(original)
+++ cdd/trunk/webtools/distasktools.py	Thu Oct  2 07:35:14 2008
@@ -198,6 +198,7 @@
                                    # WNPP bug and finally can be used for packaging
         self.desc['en']     = {}   # An English description should be available in any case
         self.pkgURL         = None # URL of unofficial package
+        self.source         = None # Keep the source package name which is needed for ddpo subscription
 
     # sort these objects according to the package name
     def __cmp__(self, other):
@@ -243,7 +244,10 @@
                 self.metapackagekeys.append(task)
         self.metapackagekeys.sort()
 
-    def GetAllDependencies(self):
+    def GetAllDependencies(self, source=0):
+        # If we want to subscribe ddpo wee need the source package names.
+        # In this case set source=1
+
         if self.metapackagekeys == []:
             self._GetMetapackages()
 
@@ -263,7 +267,7 @@
         pipe.close()
         for task in self.metapackagekeys:
             td = TaskDependencies(self.disname, task=task, tasksdir=self.tasksdir, prefix=prefix)
-            td.GetTaskDependencies()
+            td.GetTaskDependencies(source)
             self.tasks[task] = td
 
     def GetNamesOnlyDict(self, dependencytypes=()):
@@ -459,7 +463,7 @@
         # This is NOT YET implemented
         self.metadepends     = None
 
-    def GetTaskDependencies(self):
+    def GetTaskDependencies(self, source=0):
         # First obtain information about Packages
         # available in Debian
         self.available.GetPackageNames()
@@ -468,6 +472,7 @@
         # has to be separated to detect the dependency
         dep_strength_keys = [ 'Depends', 'Recommends', 'Suggests', 'Ignore', 'Avoid' ] 
 
+        print >>stderr, "DEBUG: source = %i" % ( source )
         f = file(self.taskfile)
         for stanza in deb822.Sources.iter_paragraphs(f):
             # Why and Responsible can be valid for more than one dependency
@@ -489,6 +494,8 @@
                     continue
                 if key == 'Meta-Depends':
                     self.metadepends = stanza['meta-depends']
+                if key == 'Meta-Suggests':
+                    self.metadepends = stanza['meta-suggests']
                 if key == 'Why':
                     why = stanza['why']
                     continue
@@ -561,6 +568,16 @@
                                                    self.available.packages[component][dep.pkg].section + \
                                                    '/' + dep.pkg
                                 dep.filename     = self.available.packages[component][dep.pkg].filename
+
+                                # if we are seeking for source package names for ddpo subscription
+
+                                if self.available.packages[component][dep.pkg].source:
+                                    print >>stderr, "DEBUG: dep %s has source package %s" % ( dep.pkg, self.available.packages[component][dep.pkg].source )
+                                if source == 1 and self.available.packages[component][dep.pkg].source:
+                                    print >>stderr, "DEBUG: using source package %s instead of binary %s" % ( self.available.packages[component][dep.pkg].source, dep.pkg)
+                                    ## FIXME: some source packages will be mentioned twice!
+                                    dep.pkg = self.available.packages[component][dep.pkg].source
+                                    
                                 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
@@ -754,6 +771,8 @@
                 except:
                     deppkg.homepage = '.' # Something else in case unexpected things happen
                 deppkg.version      = stanza['version'].split('-')[0]
+                if stanza.has_key('source'):
+                    deppkg.source       = stanza['source']
                 deppkg.section      = stanza['section']
                 deppkg.responsible  = re.sub('\s*(.+)\s+<(.+ at .+)>\s*', '<a href="mailto:\\2">\\1</a>', \
                                              stanza['maintainer'])



More information about the Cdd-commits mailing list