From bf7b0b39318ca0152b60fb446207a24f64219109 Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 28 Jul 2011 23:58:39 +0000 Subject: Half decent error handling in scripts with project2:handler[try/catch/finally] Component to validate a date string Merge some code (fixes sqlmerge missing attachments to ifs) Minor fixes New changelog importer in GB --- gentoobrowse/console/changelogs.xml | 81 ++++++++++++++++++++++++++++++++++ gentoobrowse/console/packageimport.xml | 44 ++---------------- 2 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 gentoobrowse/console/changelogs.xml 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 @@ + + + + + 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 + + + + + text + + + + (\d+ *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w* \d+); +([^<]+)? *<([^ >]+)[>\s]\s*(?:[^:]*:)?\s*(.*?)(?:\R\s*|$) + + date + person + email + comment + + + + + 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) + + + + + + + + + + + + + + + + + + + + + + + + + + + packageid + date + n + person + email + comment + + + + + UPDATE files SET + cachedat = moddate + WHERE filetypeid = 2 + + + 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 @@ - - - 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]) - - - packageid - date - n - person - email - comment - - - + + + + -- cgit v1.2.3