[Blends-commit] [SCM] website branch, master, updated. 4c016db575165db9a75e26761169140835f9dff7

Ole Streicher ole at aip.de
Fri Mar 18 15:59:50 UTC 2016


The following commit has been merged in the master branch:
commit 4ca2a6aee24caa069770fdf399151b27c6dbbd74
Author: Ole Streicher <ole at aip.de>
Date:   Fri Mar 18 15:57:56 2016 +0100

    Put all (Debian) VCS properties in one dictionary

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 24b797a..636c6e2 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -62,7 +62,6 @@ HOMEPAGENONEFIELDS = (
     'homepage',
     'pkg-url',      # Link to packages.debian.org search interface with exact
                     # package matches or URL to inofficial package
-    'vcs-browser',  # Browser-URL to packaging stuff in Vcs
 )
 
 PKGURLMASK = 'http://packages.debian.org/search?keywords=%s&searchon=names&exact=1&suite=all&section=all'
@@ -126,7 +125,7 @@ pkgstatus = {
         'releases'     : (),
         'component'    : (),
         'dependencies' : ('Depends', 'Recommends', 'Suggests'),
-        'fields-set'   : ('vcs-svn', 'vcs-git', 'vcs-browser'),
+        'fields-set'   : (),
         'colorcode'    : 'Yellow: The packaging of project is <a href="#%s">has started and a developer might try the packaging code in VCS or help packaging.</a>',
         'order'        : 6
     },
@@ -1270,58 +1269,43 @@ class TaskDependencies:
                     else:
                         logger.error("Dep not initiated before Homepage %s -> something is wrong."
                                      % stanza['homepage'])
-                elif key == 'Vcs-Svn' or key == 'vcs-svn':  # strangely enough on alioth the later
-                                                            # spelling seems to be needed - no idea why
+                elif key.lower() in ('vcs-svn', 'vcs-git'):
                     if dep is not None:
                         if dep.vcs_found == 1:
                             fields_obsolete.append(key)
                             continue
-                        dep.properties['vcs-url']  = stanza['vcs-svn']
-                        dep.properties['vcs-type'] = 'SVN'
-                        # if Vcs-Svn is given we are able to obtain the Browser URL of wsvn
-                        if dep.properties['vcs-browser'] == HOMEPAGENONE:
+                        vcs = dep.properties.setdefault('vcs', {})
+                        vcs['url']  = stanza[key.lower()]
+                        vcs['type'] = key.split('-')[1].capitalize()
+                        if 'browser' not in vcs:
                             try:
-                                dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
+                                vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
                             except KeyError as err:
-                                logger.error("Vcs Property missing in packages file:", dep.properties, err)
+                                logger.error("Vcs Property missing in packages file:", vcs, err)
                     else:
-                        logger.error("Dep not initiated before Vcs-Svn %s -> something is wrong."
-                                     % stanza['vcs-svn'])
+                        logger.error("Dep not initiated before %s %s -> something is wrong."
+                                     % (key, stanza[key.lower()]))
                     if dep.pkgstatus == 'unknown':
                         dep.pkgstatus = 'pkgvcs'
-                elif key == 'Vcs-Git' or key == 'vcs-git':  # strangely enough on alioth the later
-                                                            # spelling seems to be needed - no idea why
+                elif key.lower() == 'vcs-browser':
                     if dep is not None:
                         if dep.vcs_found == 1:
                             fields_obsolete.append(key)
                             continue
-                        dep.properties['vcs-url']  = stanza['vcs-git']
-                        dep.properties['vcs-type'] = 'Git'
-                        # if Vcs-Git is given we are able to obtain the Browser URL of wsvn
-                        if dep.properties['vcs-browser'] == HOMEPAGENONE:
-                            dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
-                    else:
-                        logger.error("Dep not initiated before Vcs-Git %s -> something is wrong."
-                                     % stanza['vcs-git'])
-                elif key == 'Vcs-Browser' or key == 'vcs-browser':  # strangely enough on alioth the later
-                                                                    # spelling seems to be needed - no idea why
-                    if dep is not None:
-                        if dep.vcs_found == 1:
-                            fields_obsolete.append(key)
-                            continue
-                        dep.properties['vcs-browser'] = stanza['vcs-browser']
-                        if re.compile("[/.]git\.").search(dep.properties['vcs-browser']):
-                            dep.properties['vcs-type'] = 'Git'
-                        elif re.compile("[/.]svn\.").search(dep.properties['vcs-browser']):
-                            dep.properties['vcs-type'] = 'SVN'
+                        vcs = dep.properties.setdefault('vcs', {})
+                        vcs['browser'] = stanza['vcs-browser']
+                        if re.compile("[/.]git\.").search(vcs['browser']):
+                            vcs['type'] = 'Git'
+                        elif re.compile("[/.]svn\.").search(vcs['browser']):
+                            vcs['type'] = 'Svn'
                         else:
                             # no chance to guess Vcs type
-                            dep.properties['vcs-type'] = 'Vcs'
+                            vcs['type'] = 'Vcs'
                         # There is no need to specify the Vcs-{Git,SVN} field in the tasks file but property 'vcs-type' should be set in
                         # any case - so set it here in case it was not set before.  If an apropriate field is set later it becomes
                         # overriden anyway
-                        if 'vcs-url' not in dep.properties:
-                            dep.properties['vcs-url'] = dep.properties['vcs-browser']
+                        if 'url' not in vcs:
+                            vcs['url'] = vcs['browser']
                     else:
                         logger.error("Dep not initiated before Vcs-Browser %s -> something is wrong."
                                      % stanza['vcs-browser'])
@@ -1509,13 +1493,16 @@ class TaskDependencies:
                 dep.properties['license'] = license_in_component[dep.component]
                 for prop in PROPERTIES:
                     dep.properties[prop] = row[prop]
-                for prop in ('vcs-type', 'vcs-url', 'upstream_bugs', 'upstream_repository'):
+                for prop in ('upstream_bugs', 'upstream_repository'):
                     dep.properties[prop] = row[prop]
-                if row['vcs-browser']:
-                    dep.properties['vcs-browser'] = row['vcs-browser']
-                else:
-                    if dep.properties['vcs-browser'] == HOMEPAGENONE:
-                        dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
+                for prop in ('type', 'url', 'browser'):
+                    if row['vcs-'+prop]:
+                        vcs = dep.properties.setdefault('vcs', {})
+                        vcs[prop] = row['vcs-'+prop]
+                if 'vcs' in dep.properties:
+                    vcs = dep.properties['vcs']
+                    if 'browser' not in dep.properties['vcs']:
+                        vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
 
                 if row.get('enhanced'):
                     for pkg in row['enhanced']:
@@ -1718,8 +1705,11 @@ class TaskDependencies:
                     logger.info("The package %s is not yet in Debian but it is just in Blends %s Vcs. (Task %s)" % (dep.pkg, row['blend'], dep.taskname))
                 for prop in PROPERTIES:
                     dep.properties[prop] = row[prop]
-                for prop in ('vcs-url', 'vcs-browser', 'vcs-type', 'license'):
-                    dep.properties[prop] = row[prop]
+                dep.properties['license'] = row['license']
+                for prop in ('url', 'browser', 'type'):
+                    if row['vcs-' + prop]:
+                        vcs = dep.properties.setdefault('vcs', {})
+                        vcs[prop] = row['vcs-' + prop]
                 if int(row['wnpp']) > 0:
                     dep.properties['wnpp'] = row['wnpp']
                 dep.SetPublications(row)
@@ -1806,14 +1796,12 @@ class TaskDependencies:
                 for prop in row.keys():
                     if row[prop]:
                         self.properties[prop] = row[prop]
-                if self.properties.get('vcs-browser', HOMEPAGENONE) == HOMEPAGENONE:
-                    try:
-                        self.properties['vcs-browser'] = BrowserFromVcsURL(self.properties['vcs-type'], self.properties['vcs-url'])
-                    except KeyError as err:
-                        logger.warning("Vcs Property missing in Database:", self.properties, err)
-                if not self.properties.get('vcs-type'):
-                    if self.properties.get('vcs-browser', HOMEPAGENONE) != HOMEPAGENONE:
-                        self.properties['vcs-type']    = VcsTypeFromBrowserURL(self.properties['vcs-browser'])
+                if 'vcs' in self.properties:
+                    vcs = self.properties['vcs']
+                    if 'type' not in vcs:
+                        vcs['type'] = VcsTypeFromBrowserURL(vcs.get('browser', vcs['url']))
+                    if 'browser' not in self.properties['vcs']:
+                        vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
             # We are only interested in source packages (for instance for Bugs page)
             if source == 1:
                 self.pkg = self.properties['source']
@@ -1983,7 +1971,7 @@ class PackageBugs:
         self.pkgname    = pkgdict['pkgname']
         self.source     = pkgdict['source']
         self.homepage   = pkgdict['homepage']
-        self.vcsbrowser = pkgdict['vcs-browser']
+        self.vcsbrowser = pkgdict['vcs']['browser']
         self.bugs       = []      # open bugs
         self.nbugs      = 0
         self.severities = {}
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 7b70c47..041f734 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -58,7 +58,6 @@ HOMEPAGENONEFIELDS = (
     'homepage',
     'pkg-url',      # Link to packages.debian.org search interface with exact
                     # package matches or URL to inofficial package
-    'vcs-browser',  # Browser-URL to packaging stuff in Vcs
 )
 
 PKGURLMASK = 'http://packages.debian.org/search?keywords=%s&searchon=names&exact=1&suite=all&section=all'
@@ -122,7 +121,7 @@ pkgstatus = {
         'releases'     : (),
         'component'    : (),
         'dependencies' : ('Depends', 'Recommends', 'Suggests'),
-        'fields-set'   : ('vcs-svn', 'vcs-git', 'vcs-browser'),
+        'fields-set'   : (),
         'colorcode'    : 'Yellow: The packaging of project is <a href="#%s">has started and a developer might try the packaging code in VCS or help packaging.</a>',
         'order'        : 6
     },
@@ -1109,16 +1108,14 @@ class TaskDependencies:
             for prop in PROPERTIES:
                 dep.properties[prop] = row[prop]
                             
-            if 'vcs-type' in row:
-                dep.properties['vcs-type'] = row['vcs-type']
-
-            if 'vcs-url' in row:
-                dep.properties['vcs-url'] = row['vcs-url']
-
-            if 'vcs-browser' in row:
-                dep.properties['vcs-browser'] = row['vcs-browser']
-                if dep.properties['vcs-browser'] == HOMEPAGENONE: # and type_vcs != '' and type_url != '':
-                    dep.properties['vcs-browser'] = BrowserFromVcsURL(dep.properties['vcs-type'], dep.properties['vcs-url'])
+            for prop in ('type', 'url', 'browser'):
+                if row['vcs-'+prop]:
+                    vcs = dep.properties.setdefault('vcs', {})
+                    vcs[prop] = row['vcs-'+prop]
+            if 'vcs' in dep.properties:
+                vcs = dep.properties['vcs']
+                if 'browser' not in dep.properties['vcs']:
+                    vcs['browser'] = BrowserFromVcsURL(vcs['type'], vcs['url'])
 
             # enhanced by
             if row.get('enhanced'):
diff --git a/webtools/templates/packages.xhtml b/webtools/templates/packages.xhtml
index d67564b..5ae2ec7 100644
--- a/webtools/templates/packages.xhtml
+++ b/webtools/templates/packages.xhtml
@@ -535,17 +535,17 @@ function show_fulldesc(hash) {
 			    </a>
 			  </li>
 			</py:if>
-			<py:if test="project.properties['vcs-browser'] != '#'">
+			<py:if test="'vcs' in project.properties">
 			  <li>
 			    <py:choose>
-			      <py:when test="'vcs-url' in project.properties">
-				<a href="${project.properties['vcs-browser']}" title="${project.properties['vcs-url']}">
-				  ${project.properties['vcs-type']}
+			      <py:when test="'url' in project.properties['vcs']">
+				<a href="${project.properties['vcs']['browser']}" title="${project.properties['vcs']['url']}">
+				  ${project.properties['vcs']['type']}
 				</a>
 			      </py:when>
 			      <py:otherwise>
-				<a href="${project.properties['vcs-browser']}">
-				  ${project.properties['vcs-type']}
+				<a href="${project.properties['vcs']['browser']}">
+				  ${project.properties['vcs']['type']}
 				</a>
 			      </py:otherwise>
 			    </py:choose>
diff --git a/webtools/templates/tasks.xhtml b/webtools/templates/tasks.xhtml
index 8d557ea..c7a0415 100644
--- a/webtools/templates/tasks.xhtml
+++ b/webtools/templates/tasks.xhtml
@@ -138,10 +138,10 @@
                 <span py:when="'#'">${nopkgavail}</span>
                 <span py:otherwise=""><a href="${project.properties['pkg-url']}">${pdolinkname[pstatus]}</a></span>
              </div>
-	     <div py:if="project.properties['vcs-browser'] != '#'">
+	     <div py:if="'vcs' in project.properties">
 	       <span py:choose="">
-		 <span py:when="'vcs-url' in project.properties"><a href="${project.properties['vcs-browser']}" title="${project.properties['vcs-url']}">${project.properties['vcs-type']}</a></span>
-		 <span py:otherwise=""><a href="${project.properties['vcs-browser']}">${project.properties['vcs-type']}</a></span>
+		 <span py:when="'url' in project.properties['vcs'"><a href="${project.properties['vcs']['browser']}" title="${project.properties['vcs']['url']}">${project.properties['vcs']['type']}</a></span>
+		 <span py:otherwise=""><a href="${project.properties['vcs']['browser']}">${project.properties['vcs']['type']}</a></span>
 	       </span>
 	     </div>
             <div py:if="lang != 'en' and project.component == 'main' and project.pkgstatus != 'new' and project.pkgstatus != 'pkgvcs'">

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list