summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-08-10 23:21:59 +0000
committerrandomdan <randomdan@localhost>2010-08-10 23:21:59 +0000
commite496b95ba2a53cff85f88c41340e3e6185a1d6f8 (patch)
treef2c1f24e07da7f9f13695fd29656e92a5bf06172
parentFix date format of atom field items (diff)
downloadgentoobrowse-e496b95ba2a53cff85f88c41340e3e6185a1d6f8.tar.bz2
gentoobrowse-e496b95ba2a53cff85f88c41340e3e6185a1d6f8.tar.xz
gentoobrowse-e496b95ba2a53cff85f88c41340e3e6185a1d6f8.zip
Implement downloading and merging open Gentoo bugs into the database
-rw-r--r--gentoobrowse/console/bugimport.xml33
-rw-r--r--gentoobrowse/console/bugs.xslt11
2 files changed, 44 insertions, 0 deletions
diff --git a/gentoobrowse/console/bugimport.xml b/gentoobrowse/console/bugimport.xml
new file mode 100644
index 0000000..90b73ee
--- /dev/null
+++ b/gentoobrowse/console/bugimport.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<bugimport name="bugimport" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqlmerge name="bugimport" datasource="postgres" targettable="bugs">
+ <project2:prociterate name="bugsourceUnc" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ path="wget http://bugs.gentoo.org/data/cached/buglist-UNCONFIRMED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
+ <project2:prociterate name="bugsourceAss" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ path="wget http://bugs.gentoo.org/data/cached/buglist-ASSIGNED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
+ <project2:prociterate name="bugsourceROp" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ path="wget http://bugs.gentoo.org/data/cached/buglist-REOPENED.htmlgz -qO - | xsltproc console/bugs.xslt -" />
+ <project2:prociterate name="bugsourceNew" newline="&#10;" encoding="utf-8" fieldSep="|" quoteChar=""
+ path="wget http://bugs.gentoo.org/data/cached/buglist-NEW.htmlgz -qO - | xsltproc console/bugs.xslt -" />
+ <columns>
+ <column key="true">bugid</column>
+ <column>severity</column>
+ <column>status</column>
+ <column>summary</column>
+ </columns>
+ </project2:sqlmerge>
+ <project2:sqlmerge name="bugbind" datasource="postgres" targettable="package_bugs">
+ <sql>
+ SELECT b.bugid, p.packageid
+ FROM bugs b, packages p, categories c
+ WHERE p.categoryid = c.categoryid
+ AND TO_TSVECTOR('english', b.summary) @@ PLAINTO_TSQUERY('english', c.name || '/' || p.name)
+ </sql>
+ <columns>
+ <column key="true">bugid</column>
+ <column key="true">packageid</column>
+ </columns>
+ </project2:sqlmerge>
+</bugimport>
diff --git a/gentoobrowse/console/bugs.xslt b/gentoobrowse/console/bugs.xslt
new file mode 100644
index 0000000..66055ce
--- /dev/null
+++ b/gentoobrowse/console/bugs.xslt
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="http://www.w3.org/1999/xhtml">
+ <xsl:output encoding="utf-8" method="text" media-type="text/csv" indent="no"/>
+ <xsl:template match="/x:html">bug_id|summary|status|severity|
+ <xsl:apply-templates select="/x:html/x:body/x:div/x:ul/x:li/x:a" />
+ </xsl:template>
+ <xsl:template match="x:li/x:a">
+ <xsl:value-of select="substring-before(substring-after(.,'Bug:'),' ')" />|<xsl:value-of select="x:em" />|<xsl:value-of select="substring-before(substring-after(.,'status:'),' ')" />|<xsl:value-of select="substring-after(.,'severity:')" />|
+ </xsl:template>
+</xsl:stylesheet>
+