diff options
-rw-r--r-- | gentoobrowse/console/changelogs.xml | 81 | ||||
-rw-r--r-- | gentoobrowse/console/packageimport.xml | 44 |
2 files changed, 85 insertions, 40 deletions
diff --git a/gentoobrowse/console/changelogs.xml b/gentoobrowse/console/changelogs.xml new file mode 100644 index 0000000..11235c4 --- /dev/null +++ b/gentoobrowse/console/changelogs.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<packageimport name="bugassociate" xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:project2="http://project2.randomdan.homeip.net"> + <project2:sqlrows name="updatedlogs" datasource="postgres"> + <sql> + SELECT f.filename, ft.searchroot || f.filename AS path, p.packageid + FROM files f, filetypes ft, packages p, categories c + WHERE f.filetypeid = ft.filetypeid + AND (f.cachedat IS NULL OR f.cachedat != f.moddate) + AND ft.filetypeid = 2 + AND p.name = SPLIT_PART(filename, '/', 2) + AND c.name = SPLIT_PART(filename, '/', 1) + AND c.categoryid = p.categoryid + </sql> + </project2:sqlrows> + <project2:filerows name="logcontent" encoding="utf-8" newline="" fieldSep=""> + <path source="parent" name="path" depth="1" /> + <columns><column>text</column></columns> + </project2:filerows> + <project2:regexrows name="logentries"> + <sourceText source="parent" name="text" depth="1" /> + <regex>(\d+ *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w* \d+); +([^<]+)? *<([^ >]+)[>\s]\s*(?:[^:]*:)?\s*(.*?)(?:\R\s*|$)</regex> + <columns> + <column>date</column> + <column>person</column> + <column>email</column> + <column>comment</column> + </columns> + </project2:regexrows> + <project2:sqlmerge name="changelogs" datasource="postgres" targettable="newchangelogs"> + <updatewhere> + a.packageid IN ( + SELECT p.packageid + FROM files f, packages p, categories c + WHERE f.filetypeid = 2 + AND (f.cachedat IS NULL OR f.cachedat != f.moddate) + AND p.name = SPLIT_PART(filename, '/', 2) + AND c.name = SPLIT_PART(filename, '/', 1) + AND c.categoryid = p.categoryid) + </updatewhere> + <project2:iterate name="seelogs" source="updatedlogs"> + <project2:iterate name="seelog" source="logcontent"> + <project2:iterate name="seeentries" source="logentries"> + <project2:if> + <project2:validdatecheck format="%d %b %Y"> + <apply-to source="parent" name="date" depth="1" warn="no" /> + </project2:validdatecheck> + <project2:regexcheck regex=".+@.+"> + <apply-to source="parent" name="email" depth="1" /> + </project2:regexcheck> + <project2:sqlmergeinsert> + <parameters> + <param name="packageid"><value source="parent" name="packageid" depth="3" /></param> + <param name="date"><value source="parent" name="date" depth="1" /></param> + <param name="n"><value source="parent" attribute="rownum" depth="1" /></param> + <param name="person"><value source="parent" name="person" depth="1" /></param> + <param name="email"><value source="parent" name="email" depth="1" /></param> + <param name="comment"><value source="parent" name="comment" depth="1" /></param> + </parameters> + </project2:sqlmergeinsert> + </project2:if> + </project2:iterate> + </project2:iterate> + </project2:iterate> + <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> + <project2:sqltask name="update" datasource="postgres"> + <sql> + UPDATE files SET + cachedat = moddate + WHERE filetypeid = 2 + </sql> + </project2:sqltask> +</packageimport> diff --git a/gentoobrowse/console/packageimport.xml b/gentoobrowse/console/packageimport.xml index b2c48ab..5dba528 100644 --- a/gentoobrowse/console/packageimport.xml +++ b/gentoobrowse/console/packageimport.xml @@ -169,46 +169,10 @@ </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 >= s.linebegin - AND m.content not like '*%' - AND (m.line < 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}); ?(.+)? <([^ >]+)') AS r, - (SELECT MIN(line) - FROM filecache nl - WHERE nl.fileid = f.fileid - AND nl.content ~ '([0-9]{2} [[:alnum:]]+ [0-9]{2,4}); ?(.+)? <([^ >]+)' - AND nl.line > 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="changelogs.xml" /> + <xi:include href="packagelicenses.xml" /> + <xi:include href="use.global.xml" /> + <xi:include href="use.local.xml" /> <xi:include href="categorymetadata.xml" /> <xi:include href="packagemetadata.xml" /> <xi:include href="packagemasks.xml" /> |