summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-11-14 03:29:47 +0000
committerrandomdan <randomdan@localhost>2010-11-14 03:29:47 +0000
commit50fcdea9977a29ad690cbb444b990b2d8c1092ae (patch)
treeb65ebba8d07edfba0cb1ba93f616f6c462d84082
parentRemove most uses of files table from website, data now in ebuilds table (diff)
downloadgentoobrowse-50fcdea9977a29ad690cbb444b990b2d8c1092ae.tar.bz2
gentoobrowse-50fcdea9977a29ad690cbb444b990b2d8c1092ae.tar.xz
gentoobrowse-50fcdea9977a29ad690cbb444b990b2d8c1092ae.zip
Populate and use new change logs table
-rw-r--r--gentoobrowse/console/packageimport.xml40
-rw-r--r--gentoobrowse/package.xslt17
-rw-r--r--gentoobrowse/views/package.xml13
3 files changed, 55 insertions, 15 deletions
diff --git a/gentoobrowse/console/packageimport.xml b/gentoobrowse/console/packageimport.xml
index 95743a4..fbfb25b 100644
--- a/gentoobrowse/console/packageimport.xml
+++ b/gentoobrowse/console/packageimport.xml
@@ -169,5 +169,45 @@
</columns>
</project2:sqlmerge>
+ <project2:sqlmerge name="changelogs" datasource="postgres" targettable="package_changelogs" useview="no">
+ <sql>
+ SELECT packageid,
+ CAST(r[1] AS DATE) AS DATE,
+ RANK() OVER(PARTITION BY packageid, CAST(r[1] AS DATE) ORDER BY s.linebegin) AS n,
+ r[2] AS person,
+ r[3] AS email,
+ (SELECT TRIM(SPLIT_PART(STRING_AGG(m.content, ' ' ORDER BY m.line), ':', 2))
+ FROM filecache m
+ WHERE m.fileid=s.fileid
+ AND m.line &gt;= s.linebegin
+ AND m.content not like '*%'
+ AND (m.line &lt; s.lineend OR s.lineend IS NULL)) AS comment
+ FROM (SELECT f.fileid,
+ p.packageid,
+ fc.line AS linebegin,
+ REGEXP_MATCHES(content, '([0-9]{2} [[:alnum:]]+ [0-9]{2,4}); ?(.+)? &lt;([^ &gt;]+)') AS r,
+ (SELECT MIN(line)
+ FROM filecache nl
+ WHERE nl.fileid = f.fileid
+ AND nl.content ~ '([0-9]{2} [[:alnum:]]+ [0-9]{2,4}); ?(.+)? &lt;([^ &gt;]+)'
+ AND nl.line &gt; fc.line) AS lineend
+ FROM filecache fc, files f, packages p, categories c
+ WHERE f.fileid=fc.fileid
+ AND f.filetypeid = 2
+ AND c.categoryid = p.categoryid
+ AND p.name = SPLIT_PART(f.filename, '/', 2)
+ AND c.name = SPLIT_PART(f.filename, '/', 1)) AS s
+ WHERE IS_DATE(s.r[1])
+ </sql>
+ <columns>
+ <column key="true">packageid</column>
+ <column key="true">date</column>
+ <column key="true">n</column>
+ <column>person</column>
+ <column>email</column>
+ <column>comment</column>
+ </columns>
+ </project2:sqlmerge>
+
<xi:include href="bugassociate.xml" />
</packageimport>
diff --git a/gentoobrowse/package.xslt b/gentoobrowse/package.xslt
index 5f0852d..37bf811 100644
--- a/gentoobrowse/package.xslt
+++ b/gentoobrowse/package.xslt
@@ -121,7 +121,7 @@
<xsl:if test="count(/gentoo/summary/package/maskdetails/mask) &gt; 0">
<h3 class="tabhandle"><a href="javascript:showTab('masks');">Masks</a></h3>
</xsl:if>
- <xsl:if test="count(/gentoo/summary/package/changelog/line) &gt; 0">
+ <xsl:if test="count(/gentoo/summary/package/changelog/entry) &gt; 0">
<h3 class="tabhandle"><a href="javascript:showTab('changelog');">Change log</a></h3>
</xsl:if>
</div>
@@ -173,13 +173,16 @@
<!-- Change log -->
<xsl:template match="/gentoo/summary/package/changelog">
- <xsl:if test="count(/gentoo/summary/package/changelog/line) &gt; 0">
- <pre class="tabhidden" id="changelog">
- <xsl:for-each select="line">
- <xsl:value-of select="content" /><xsl:text>
-</xsl:text>
+ <xsl:if test="count(/gentoo/summary/package/changelog/entry) &gt; 0">
+ <ul class="tabhidden" id="changelog">
+ <xsl:for-each select="entry">
+ <li><xsl:value-of select="substring-before(date, ' ')" /></li>
+ <ul>
+ <li><xsl:value-of select="person" /> &lt;<xsl:value-of select="email" />&gt;</li>
+ <li><xsl:value-of select="comment" /></li>
+ </ul>
</xsl:for-each>
- </pre>
+ </ul>
</xsl:if>
</xsl:template>
diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml
index d526df4..cbf9dfc 100644
--- a/gentoobrowse/views/package.xml
+++ b/gentoobrowse/views/package.xml
@@ -157,15 +157,12 @@
<param bind="0" value="^packageid" />
</parameters>
</project2:sqlview>
- <project2:sqlview name="changelog" recordname="line" datasource="postgres-web">
+ <project2:sqlview name="changelog" recordname="entry" datasource="postgres-web">
<sql>
- SELECT line, content
- FROM files f, filecache fc, packages p, categories c
- WHERE f.fileid = fc.fileid
- AND p.categoryid = c.categoryid
- AND f.filename = c.name || '/' || p.name || '/ChangeLog'
- AND p.packageid = ?
- ORDER BY line
+ SELECT date, person, email, comment
+ FROM package_changelogs
+ WHERE packageid = ?
+ ORDER BY date DESC, n DESC
</sql>
<parameters>
<param bind="0" value="^packageid" />