[Blends-commit] [SCM] website branch, master, updated. 7637dfe1ccc966f19a05a11866a7b65e02d0ad0e

Akshita Jha akshita-guest at users.alioth.debian.org
Tue Jul 21 21:27:50 UTC 2015


The following commit has been merged in the master branch:
commit 7637dfe1ccc966f19a05a11866a7b65e02d0ad0e
Author: Akshita Jha <akshita-guest at users.alioth.debian.org>
Date:   Wed Jul 22 02:53:31 2015 +0530

    Modify blendstasktools_udd.py to remove errors in previous commit : Solves i) UnicodeEncodeError, ii) correctly organises packages into their respective section, iii) Removes repetitive packages

diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 9be1fd4..c300956 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -1011,14 +1011,48 @@ class TaskDependencies:
         # no dupplication in case of source depencencies
         if dep == None:
             return
-        if dep.dep_strength == 'Ignore' or dep.dep_strength == 'Avoid':
+        if dep.dep_strength == 'i' or dep.dep_strength == 'a':
+	    #print "Ignore dep.pkg : ",dep.pkg
             return
+
+	# Solves UnicodeEncodeError because of characters present in the
+        # long description of the dependecies in 'unoficial','prospective' packages
+        try:
+       	    dep.desc['en']['long'] = dep.desc['en']['long'].encode('ascii','xmlcharrefreplace')
+        except:
+            pass
+
+        # Solves UnicodeEncodeError because of characters present in the
+        # authors name of the dependencies in 'wnpp' packages
+	try:
+           dep.properties['published']['authors'] = dep.properties['published']['authors'].encode('ascii','xmlcharrefreplace')
+        except:
+           pass
+
+	# Solves UnicodeEncodeError because of characters present in the title of 
+	# dependencies in blends debian-science, debian-pan
+	try:
+           dep.properties['published']['title'] = dep.properties['published']['title'].encode('ascii','xmlcharrefreplace')
+        except:
+           pass
+
+	#print "Appending dep.pkg : ",dep.pkg
         self.dependencies[dep.pkgstatus].append(dep)
         return
 
 
-    def GetDepInfo(self, curs, dependencies): 
+    def GetDepInfo(self, curs, dependencies, pkg_src): 
 
+	# official pacakage
+	# if pkg_src == 1: 
+	#	print "\n=============OFFICIAL==============\n"
+	# prospective package
+	# elif pkg_src == 2:
+	#	print "\n==============PROSPECTIVE==========\n"
+	# new package
+	# else: 
+	#	print "\n==============NEW==================\n"
+	
      	for row in RowDictionaries(curs):
 	    #for r in row:
 	    #	print r, ":", row[r]
@@ -1027,28 +1061,38 @@ class TaskDependencies:
             found = False
             for dep in dependencies:
                 if dep.pkg == row['package']:
+		    # print dep.pkg, ":",
                     found = True
                     break
 	
-            # Now set the information for the package found in the database
+            # Now set the information for the package found in the database (not for prospective packages)
             # Debian Edu contains packages from main/debian-installer - that's why we use startswith here
-            if row['component'].startswith('main'):
-                dep.component = 'main'
-            
-            if dep.dep_strength == 'd' or dep.dep_strength == 'r':
-                dep.pkgstatus = 'official_high'
-            elif dep.dep_strength == 's':
-                dep.pkgstatus = 'official_low'
-            else:
-                dep.component = row['component']
-                # If a package is not found in main its status can be maximum non-free
-                dep.pkgstatus = 'non-free'
+	    if pkg_src != 2:
+                if row['component'].startswith('main'):
+                    dep.component = 'main'
+	            if dep.dep_strength == 'd' or dep.dep_strength == 'r':
+                        dep.pkgstatus = 'official_high'
+                    elif dep.dep_strength == 's':
+                        dep.pkgstatus = 'official_low'
+		    else:
+		        dep.pkgstatus = 'new'
+                else:
+                    dep.component = row['component']
+                    # If a package is not found in main its status can be maximum non-free
+                    dep.pkgstatus = 'non-free'
+	    elif pkg_src == 2:
+		dep.pkgstatus = 'pkgvcs'
             
             # if a package is released *only* in experimental decrease package status
             if 'release' in row and row['release'] == 'experimental':
-	        dep.pkgstatus = 'experimental'
+	        dep.pkgstatus = 'experimental'		
 
-            # dep.properties['license'] is already correct
+            if dep.dep_strength == 'i':
+		dep.pkgstatus = 'ignore'
+	    elif dep.dep_strength == 'a':
+		dep.pkgstatus = 'avoid'
+
+	    # dep.properties['license'] is already correct
             for prop in PROPERTIES:
                 dep.properties[prop] = row[prop]
                             
@@ -1059,7 +1103,6 @@ class TaskDependencies:
 		type_vcs = 'vcs-type' 
 	    if type_vcs != '':
 	        dep.properties['vcs-type'] = row[type_vcs]
-		# print "vcs-type : ",dep.properties['vcs-type']
 
 	    type_url = ''
 	    if 'vcs_url' in row :
@@ -1068,7 +1111,6 @@ class TaskDependencies:
 		type_url = 'vcs-url' 
 	    if type_url != '':
                 dep.properties['vcs-url'] = row[type_url]
-		# print "vcs-url : ",dep.properties['vcs-url']
 
 	    type_browser = ''
 	    if 'vcs_browser' in row :
@@ -1078,9 +1120,7 @@ class TaskDependencies:
 	    if type_browser != '':
                 dep.properties['vcs-browser'] = row[type_browser]
             elif dep.properties['vcs-browser'] == HOMEPAGENONE and type_vcs != '' and type_url != '':
-		 # print "\n################ROW###################\n",row
                  dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
-		 # print "vcs-browser after: ",dep.properties['vcs-browser']
 
             # enhances to be written
             # if row['enhanced']:
@@ -1149,6 +1189,7 @@ class TaskDependencies:
                         dep.properties['last_uploader_simple'] = to_unicode('%s <%s>' % (_name, _url))
                     except UnicodeDecodeError, err:
                         logger.error("Encoding problem for last uploader - assume same as maintainer for package %s (%s)", dep.pkg, err)
+
            # link to packages.debian.org search page to see overview about all
            # package versions in all releases
            # dep.properties['pkg-url'] = PKGURLMASK % dep.pkg
@@ -1178,7 +1219,7 @@ class TaskDependencies:
 
         # Get the title and description of each task in a blend
         # Title, Description
-        query = "SELECT title, description, long_description FROM blends_tasks WHERE task='%s' AND blend='%s'" % (self.task, self.blendname)
+        query = "SELECT DISTINCT title, description, long_description FROM blends_tasks WHERE task='%s' AND blend='%s'" % (self.task, self.blendname)
         _execute_udd_query(query)
         if curs.rowcount > 0:
             self.metapkg.PrintedName, short, long = curs.fetchone()
@@ -1213,20 +1254,21 @@ class TaskDependencies:
         query = "EXECUTE query_pkgs ('%s', '%s')" % (List2PgArray(alldepends), List2PgSimilarArray(alldepends))
         _execute_udd_query(query)
         if curs.rowcount > 0:
-            self.GetDepInfo(curs, dependencies)
+            self.GetDepInfo(curs, dependencies, 1)
 	    #print "+++++++++++++++++++++", self.task
 	
 
         # Get the package_name, license, dependency of the prospective dependencies of the task
         query = "SELECT DISTINCT bp.package, bp.license, b.dependency \
-                FROM blends_prospectivepackages bp JOIN blends_dependencies b ON b.blend=bp.blend \
-                WHERE bp.blend='%s' and b.task='%s'" % (self.blendname, self.task)
+                FROM blends_prospectivepackages bp JOIN blends_dependencies b ON b.blend=bp.blend AND b.package=bp.package \
+                WHERE bp.blend='%s' and b.task='%s' ORDER BY bp.package" % (self.blendname, self.task)
         _execute_udd_query(query)
 
         alldepends = []
         dependencies = []
         if curs.rowcount > 0:
             pros_info = curs.fetchall() 
+	    #print "pros_info : ",pros_info
 
             for each_pros in pros_info:
                 dep = DependantPackage(self.blendname, self.task)
@@ -1244,7 +1286,7 @@ class TaskDependencies:
 	query = "SELECT DISTINCT bp.package, bp.license, b.dependency, bp.component, bp.homepage, bp.section, \
                         bp.source, bp.vcs_type, bp.vcs_url, bp.vcs_browser, bp.changed_by, \
                         bp.uploaders, bp.maintainer, pop.vote, pop.recent, tags.debtags, bp.description AS description_en, bp.long_description AS long_description_en\
-                FROM blends_prospectivepackages bp JOIN blends_dependencies b ON b.blend=bp.blend \
+                FROM blends_prospectivepackages bp JOIN blends_dependencies b ON b.blend=bp.blend AND b.package=bp.package \
                 LEFT OUTER JOIN popcon pop ON pop.package=bp.package \
                 LEFT OUTER JOIN ( \
                 SELECT package, array_agg(tag) AS debtags \
@@ -1255,24 +1297,25 @@ class TaskDependencies:
                     AND tag NOT LIKE '%%not-yet-tagged%%' \
                 GROUP BY package \
                 ) tags ON tags.package = bp.package \
-                WHERE bp.blend='%s' and b.task='%s'" % (self.blendname, self.task)
+                WHERE bp.blend='%s' and b.task='%s' ORDER BY bp.package" % (self.blendname, self.task)
         _execute_udd_query(query)
         if curs.rowcount > 0:
 	    #print "going into getdepinfo from prospective : "
-            self.GetDepInfo(curs, dependencies)
+            self.GetDepInfo(curs, dependencies, 2)
 	    #print "-----------------", self.task
 
 
         # Get information about new dependencies of the task
         query = "SELECT DISTINCT new.package FROM new_packages new JOIN blends_dependencies b ON b.package=new.package \
-                WHERE b.blend='%s' and b.task='%s'" % (self.blendname, self.task)
+                WHERE b.blend='%s' and b.task='%s' ORDER BY new.package" % (self.blendname, self.task)
         _execute_udd_query(query)
 	alldepends = []
 	dependencies = []
 	pkgs_new = []
         if curs.rowcount > 0:
             pkgs_new = curs.fetchall()
-	    # print "pkgs_new : ",pkgs_new
+	    #print "pkgs_new : ",pkgs_new
+
 	    for each_new_pkg in pkgs_new:
                 dep = DependantPackage(self.blendname, self.task)
               
@@ -1284,7 +1327,7 @@ class TaskDependencies:
         query = "EXECUTE query_new('%s')" % List2PgArray(alldepends)
         _execute_udd_query(query)
         if curs.rowcount > 0:
-            self.GetDepInfo(curs, dependencies)
+            self.GetDepInfo(curs, dependencies, 3)
 	    #print "xxxxxxxxxxxxxxxxxxx", self.task
 
 	return 1

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list