[Blends-commit] r1862 - blends/trunk/webtools

Debian Pure Blends Subversion Commit noreply at alioth.debian.org
Tue Sep 1 12:01:10 UTC 2009


Author: tille
Date: Tue Sep  1 12:00:42 2009
New Revision: 1862
URL: http://svn.debian.org/viewsvn/blends?rev=1862&view=rev

Log:
More structured way to keep track of Enhances


Modified:
   blends/trunk/webtools/blendstasktools.py

Modified: blends/trunk/webtools/blendstasktools.py
URL: http://svn.debian.org/viewsvn/blends/blends/trunk/webtools/blendstasktools.py?rev=1862&view=diff&r1=1862&r2=1861&p1=blends/trunk/webtools/blendstasktools.py&p2=blends/trunk/webtools/blendstasktools.py
==============================================================================
--- blends/trunk/webtools/blendstasktools.py	(original)
+++ blends/trunk/webtools/blendstasktools.py	Tue Sep  1 12:00:42 2009
@@ -65,6 +65,8 @@
 
 DEFAULTCACHEDIR='/var/lib/gforge/chroot/home/groups/blends/cache'
 
+PKGURLMASK = 'http://packages.debian.org/search?keywords=%s%%26searchon=names%%26exact=1%%26suite=all%%26section=all'
+
 DEPENDENT  = 0
 SUGGESTED  = 1
 DONE       = 2
@@ -515,7 +517,9 @@
         self.properties     = {}
         self.properties['license']     = 'unknown'
         for field in HOMEPAGENONEFIELDS:
-            self.properties[field]    = HOMEPAGENONE 
+            self.properties[field]    = HOMEPAGENONE
+        self.properties['Enhances'] = {} # Dictionary Enhancing pkg name as key, Link to package information as value; empty in most cases
+                                         # because Enhances relations are quite seldom
         self.vcs_found      = 0    # we need a flag to store the fact whether Vcs information of a package is in UDD
         self.version        = []   # list of {'release', 'version', 'archs'} dictionary containing version and architecture information
         self.outdated       = {}   # If not empty directory then release='upstream' and package is outdated
@@ -657,8 +661,7 @@
 
         # link to packages.debian.org search page to see overview about all
         # package versions in all releases
-        self.properties['pkg-url'] = 'http://packages.debian.org/search?keywords=' + \
-            self.pkg + '%26searchon=names%26exact=1%26suite=all%26section=all'
+        self.properties['pkg-url'] = PKGURLMASK % self.pkg
 
         query = "EXECUTE query_pkg ('%s')" % self.pkg
         curs.execute(query)
@@ -713,14 +716,16 @@
         curs.execute(query)
 
         if curs.rowcount > 0:
-            enhances = []
             for row in RowDictionaries(curs):
                 enhancelist = row['enhances'].split(', ')
                 if self.pkg in enhancelist:
-                    if not row['package'] in enhances:
-                        enhances.append(row['package'])
-            if enhances != []:
-                print "The following packages are enhancing %s: %s" % (self.pkg, str(enhances))
+                    if not row['package'] in self.properties['Enhances'].keys():
+                        self.properties['Enhances'][row['package']] = PKGURLMASK % row['package']
+            # if self.properties['Enhances'] != {}:
+            #    print "The following packages are enhancing %s: " % self.pkg,
+            #    for enh in self.properties['Enhances'].keys():
+            #        print enh,
+            #    print
 
     # sort these objects according to the package name
     def __cmp__(self, other):
@@ -819,6 +824,7 @@
             curs.execute(query)
             if curs.rowcount > 0:
                 self.popconsubmit = curs.fetchone()[0]
+            self.LinkEnhances()
 
     def GetNamesOnlyDict(self, dependencystatus=[]):
         # David Paleino needs for his web tools a dictionary
@@ -921,6 +927,39 @@
 			return None
         return outputdir
 
+    def LinkEnhances(self):
+        # To provide a connection between packages enhancing other packages a set of links
+        # will be provided.  The links should point to paragraphs on the tasks pages if the
+        # Enhancing package is listed in the metapackages of the blend and to packages.debian.org
+        # otherwise
+        for task in self.metapackagekeys:
+            tdeps = self.tasks[task]
+            for dependency in tdeps.dependencies.keys():
+                for dep in tdeps.dependencies[dependency]:
+                    if dep.properties['Enhances'] != {}:
+                        print "Package %s is enhanced by:" % dep.pkg
+                        for enh in dep.properties['Enhances'].keys():
+                            # seek for Enhances on same page
+                            found = 0
+                            for enhdep in tdeps.dependencies[dependency]:
+                                if enh == enhdep.pkg:
+                                    dep.properties['Enhances'][enh] = '#'+enh
+                                    found = 1 # found enhances in same task
+                                    break
+                            if found == 0: # If not found seek in other tasks
+                                for enhtask in self.metapackagekeys:
+                                    if enhtask == task:
+                                        continue
+                                    enhtdeps = self.tasks[enhtask]
+                                    for enhdep in enhtdeps.dependencies[dependency]:
+                                        if enh == enhdep.pkg:
+                                            dep.properties['Enhances'][enh] = '../' + enhtask + '#'+enh
+                                            found = 1 # found enhances in other task
+                                            break
+                                    if found == 1:
+                                        break
+                            print " %s -> %s" % (enh, dep.properties['Enhances'][enh])
+
     def __str__(self):
         ret = "Blendname: "       + self.blendname  + ", " \
               "Metapackagekeys: " + str(self.metapackagekeys) + ", "



More information about the Blends-commit mailing list