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

Debian Pure Blends Subversion Commit noreply at alioth.debian.org
Thu Aug 20 07:28:33 UTC 2009


Author: tille
Date: Thu Aug 20 07:28:33 2009
New Revision: 1802
URL: http://svn.debian.org/viewsvn/blends?rev=1802&view=rev

Log:
Print available Enhances to logfile for the moment


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=1802&view=diff&r1=1802&r2=1801&p1=blends/trunk/webtools/blendstasktools.py&p2=blends/trunk/webtools/blendstasktools.py
==============================================================================
--- blends/trunk/webtools/blendstasktools.py	(original)
+++ blends/trunk/webtools/blendstasktools.py	Thu Aug 20 07:28:33 2009
@@ -329,6 +329,19 @@
                   ORDER BY version DESC, image ;"""
 curs.execute(query)
 
+# This query might result in more packages than wanted, because when seeking for a
+# package 'foo'  it also matches an enhances field of 'bar, xfoo-xx, foo-doc, bazz'
+# and thus we get a false positive.  We have to preprocess the resultset by splitting
+# it into single packages and check again the whole word for matching.  This is
+# implemented below in Python
+######################################################################################
+# ATTENTION: Call this "EXECUTE query_check_enhances('%"+pkg+"%')"                   #
+#            I have no idea how to otherwise mask the '%' in the prepared statement. #
+######################################################################################
+query = """PREPARE query_check_enhances (text) AS
+            SELECT DISTINCT package, enhances FROM packages WHERE enhances LIKE $1"""
+curs.execute(query)
+
 #########################################################################################
 
 def ReadConfig(blendname=''):
@@ -696,6 +709,19 @@
                 self.desc[lang]['short'] = MarkupString(unicode(row['description'], 'utf-8'), self.pkg, 'ShortDesc - ' + lang)
                 self.desc[lang]['long']  = Markup(render_longdesc(row['long_description'].splitlines()))
 
+        query = "EXECUTE query_check_enhances ('%"+self.pkg+"%')"
+        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))
+
     # sort these objects according to the package name
     def __cmp__(self, other):
         # Comparing with None object has to return something reasonable



More information about the Blends-commit mailing list