The attached patch restricts the issues highlighted in the todo box to the self
cycles as these are the only "hard" result that we can get. All other results
are merely suggestions.

This information should only be included once it is possible to upload packages
with the build profile syntax.

Thanks!
Index: www/bin/other_to_xml.py
===================================================================
--- www/bin/other_to_xml.py	(revision 3141)
+++ www/bin/other_to_xml.py	(working copy)
@@ -81,6 +81,27 @@
             sources[source].append((size, pkg_a, pkg_b))
     return sources
 
+def read_bootstrap(fname):
+    sources = {}
+    with open(fname) as f:
+        data = json.load(f)
+    sources = {}
+    for (pkg,ver),stats in data:
+        # remove "src:" prefix from source package name
+        pkg = pkg[4:]
+        selfcycles = set()
+        for (strong_on,bd_on),_ in stats.get('type1cycles',[])+stats.get('type2cycles',[]):
+            # they should never be empty but just to be sure
+            if not strong_on or not bd_on:
+                continue
+            # remove version to be able to merge more
+            strong_on = [p for p,_ in strong_on]
+            bd_on = [p for p,_ in bd_on]
+            selfcycles.add((frozenset(strong_on),frozenset(bd_on)))
+        if pkg not in sources: sources[pkg] = set()
+        sources[pkg].update(selfcycles)
+    return sources
+
 def read_shortdesc(fname):
     global binary2sources
     source_descs = {} # source package -> (binary package -> short description)
@@ -556,6 +577,8 @@
 
 dedup_packages = read_dedup(os.path.join(dir, "dedup.txt"))
 
+bootstrap_packages = read_bootstrap(os.path.join(dir, "bootstrap.json"))
+
 upstream_info_packages = read_upstream_info(os.path.join(dir, "upstream-info.txt"))
 
 # read release goals information
@@ -1013,6 +1036,35 @@
         root_elt.setAttribute("dedup", "no")
         dedup_sig = ''
 
+    # add bootstrapping links
+    if pkg in bootstrap_packages:
+        root_elt.setAttribute("bootstrap", "yes")
+        if bootstrap_packages[pkg]:
+            elt = doc.createElement("selfcycles")
+            root_elt.appendChild(elt)
+            root_elt.setAttribute("selfcycles", "yes")
+            for strong_on,bd_on in bootstrap_packages[pkg]:
+                selfcycle_elt = doc.createElement("selfcycle")
+                strong_on = sorted(strong_on)
+                if len(strong_on) == 1:
+                    strong_on = strong_on[0]
+                else:
+                    strong_on = " and ".join([", ".join(strong_on[:-1]),strong_on[-1]])
+                bd_on = sorted(bd_on)
+                if len(bd_on) == 1:
+                    bd_on = bd_on[0]
+                else:
+                    bd_on = " and ".join([", ".join(bd_on[:-1]),bd_on[-1]])
+                selfcycle_elt.setAttribute("strong_on", strong_on)
+                selfcycle_elt.setAttribute("bd_on", bd_on)
+                elt.appendChild(selfcycle_elt)
+        else:
+            root_elt.setAttribute("selfcycles", "no")
+        bootstrap_sig = bootstrap_packages[pkg]
+    else:
+        root_elt.setAttribute("bootstrap", "no")
+        bootstrap_sig = ''
+
     # Add upstream info links
     if pkg in upstream_info_packages:
         root_elt.setAttribute("upstreaminfo", "yes")
@@ -1092,7 +1144,7 @@
             watchbroken_sig, watchavail_sig, depneedsmaint_sig, dms_sig,
             fonts_sig, sec_sig, logcheck_sig, rg_sig, url_issues_sig,
             screenshots_sig, clang_sig, dedup_sig, longdesc_sig,
-            upstream_info_sig, autoremoval_sig, testing_sig)
+            upstream_info_sig, autoremoval_sig, testing_sig, bootstrap_sig)
     if sigs.has_key(pkg) and sig == sigs[pkg] and \
             os.path.isfile("%s/%s/%s/other.xml" % (odir, hash, pkg)):
         continue
Index: www/bin/update_incoming.sh
===================================================================
--- www/bin/update_incoming.sh	(revision 3141)
+++ www/bin/update_incoming.sh	(working copy)
@@ -209,6 +209,9 @@
 
 get http://dedup.debian.net/static/ptslist.txt dedup.txt
 
+# download bootstrapping hints
+get http://bootstrap.debian.net/source/stats.json bootstrap.json
+
 nice_redirect_to upstream-info.txt svn ls -R svn://svn.debian.org/svn/collab-qa/packages-metadata
 
 # testing autoremoval info
Index: www/xsl/pts-issues.xsl
===================================================================
--- www/xsl/pts-issues.xsl	(revision 3141)
+++ www/xsl/pts-issues.xsl	(working copy)
@@ -422,6 +422,22 @@
     </xsl:if>
   </xsl:template>
 
+  <xsl:template name="issue-selfcycles">
+    <xsl:if test="$hasother and $other/@selfcycles='yes'">
+      <xsl:for-each select="$other/selfcycles/selfcycle">
+        <li>
+          It must be possible to build this source package without
+          <xsl:value-of select="@bd_on" />. Otherwise this source package
+          requires binary packages it builds
+          (<xsl:value-of select="@strong_on" />) to build itself and thus
+          creates a cyclic build dependency.
+          See <a href="http://bootstrap.debian.net/source/{$package}.html";>bootstrap.debian.net</a>
+          for a more detailed explanation.
+        </li>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+
   <xsl:template name="issue-testing-failed">
     <xsl:if test="$hasother and $other/@testing='yes' and $other/testing/@status!='pass'">
       <li>
Index: www/xsl/pts.xsl
===================================================================
--- www/xsl/pts.xsl	(revision 3141)
+++ www/xsl/pts.xsl	(working copy)
@@ -1202,6 +1202,11 @@
 	  <a title="duplicate and similar files" href="http://dedup.debian.net/source/{$package}";>dedup</a>
 	</li>
       </xsl:if>
+      <xsl:if test="$other/@bootstrap='yes'">
+	<li>
+	  <a title="bootstrapping issues" href="http://bootstrap.debian.net/source/{$package}.html";>bootstrap</a>
+	</li>
+      </xsl:if>
       <li>
 	<img src="../common/rdf.png" alt="rdf" /> <a title="Alternate RDF meta-data (Turtle)" href="{$package}.ttl">RDF meta-data</a>
       </li>
@@ -1241,6 +1246,7 @@
     <xsl:call-template name="issue-watchavail" />
     <xsl:call-template name="issue-depneedsmaint" />
     <xsl:call-template name="issue-dedup" />
+    <xsl:call-template name="issue-selfcycles" />
     <xsl:if test="$hasother">
       <xsl:for-each select="$other/todo/item">
 	<xsl:call-template name="outputitem" />

Reply via email to