summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-08-07 21:52:40 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-08-07 21:52:40 +0100
commit01e8ee77b605b747d971106017a817e0c15c87e8 (patch)
treed043dd778bfa6ff92078228f2db9951d2f6408e1
parentReplace license import (diff)
downloadgentoobrowse-01e8ee77b605b747d971106017a817e0c15c87e8.tar.bz2
gentoobrowse-01e8ee77b605b747d971106017a817e0c15c87e8.tar.xz
gentoobrowse-01e8ee77b605b747d971106017a817e0c15c87e8.zip
Replace use flag import
-rw-r--r--gentoobrowse/console/use.global.xml23
-rw-r--r--gentoobrowse/console/use.grouped.xml69
-rw-r--r--gentoobrowse/console/use.local.xml52
3 files changed, 26 insertions, 118 deletions
diff --git a/gentoobrowse/console/use.global.xml b/gentoobrowse/console/use.global.xml
index 9139bcf..9ee2cfc 100644
--- a/gentoobrowse/console/use.global.xml
+++ b/gentoobrowse/console/use.global.xml
@@ -1,24 +1,13 @@
<?xml version="1.0"?>
<test name="test" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
- <project2:streamrows name="gcl" newline="&#10;" encoding="utf-8" fieldSep="" quoteChar="">
- <project2:filestream path="/usr/portage/profiles/use.desc" />
- <columns>
- <text />
- </columns>
- </project2:streamrows>
- <project2:regexrows name="gcla">
- <sourceText source="parent" name="text" depth="1" />
- <regex>([^ ]+) - (.+)</regex>
- <columns>
- <use />
- <description />
- </columns>
- </project2:regexrows>
<project2:sqlmerge name="mergeguse" datasource="postgres" targettable="use_global">
- <project2:iterate name="lines" source="gcl">
- <project2:iterate name="flags" source="gcla" />
- </project2:iterate>
+ <sql>
+ SELECT u.ud[1] AS use, u.ud[2] AS description
+ FROM (SELECT regexp_matches(u, '([^ ]+) - (.+)') ud
+ FROM files f, regexp_split_to_table(pg_read_file(f.filename), '\n') u
+ WHERE f.filetypeid = 5) u
+ </sql>
<columns>
<use key="true" />
<description />
diff --git a/gentoobrowse/console/use.grouped.xml b/gentoobrowse/console/use.grouped.xml
index b381a17..d54bb90 100644
--- a/gentoobrowse/console/use.grouped.xml
+++ b/gentoobrowse/console/use.grouped.xml
@@ -3,7 +3,7 @@
xmlns:project2="http://project2.randomdan.homeip.net">
<project2:sqlmerge name="categories" datasource="postgres" targettable="use_groups" useview="yes">
<sql>
- SELECT split_part(f.filename, '.', 1) AS name
+ SELECT DISTINCT split_part(pathparts[3], '.', 1) AS name
FROM files f
WHERE f.filetypeid = 9
</sql>
@@ -11,66 +11,19 @@
<name key="true" />
</columns>
</project2:sqlmerge>
- <project2:sqlrows name="updatedgroups" datasource="postgres">
+ <project2:sqlmerge datasource="postgres" targettable="use_group">
<sql>
- SELECT ft.searchroot || f.filename AS filename, u.usegroupid
- FROM files f, filetypes ft, use_groups u
- WHERE (f.cachedat IS NULL OR f.cachedat != f.moddate)
- AND f.filetypeid = 9
- AND f.filetypeid = ft.filetypeid
- AND u.name = SPLIT_PART(filename, '.', 1)
+ SELECT ug.usegroupid, u.ud[1] AS use, MIN(u.ud[2]) AS description
+ FROM (SELECT split_part(pathparts[3], '.', 1) AS name, regexp_matches(u, '([^ ]+) - (.*)') ud
+ FROM files f, regexp_split_to_table(pg_read_file(f.filename), '\n') u
+ WHERE f.filetypeid = 9) u, use_groups ug
+ WHERE ug.name = u.name
+ GROUP BY ug.usegroupid, u.ud[1]
</sql>
- </project2:sqlrows>
- <project2:streamrows name="usecontent" encoding="utf-8" fieldSep="" quoteChar="">
- <project2:filestream>
- <path source="parent" name="filename" depth="1" />
- </project2:filestream>
<columns>
- <text />
- </columns>
- </project2:streamrows>
- <project2:regexrows name="uses">
- <sourceText source="parent" name="text" depth="1" />
- <regex>([^ ]+) - (.+)</regex>
- <columns>
- <use />
+ <usegroupid key="true" />
+ <use key="true" />
<description />
</columns>
- </project2:regexrows>
- <project2:iterate source="updatedgroups">
- <project2:sqlmerge datasource="postgres" targettable="use_group">
- <updatewhere>
- a.usegroupid = <param source="parent" name="usegroupid" />
- </updatewhere>
- <project2:iterate source="usecontent" name="iusecontent">
- <project2:iterate source="uses">
- <project2:isdistinct scope="iusecontent">
- <parameters>
- <usegroupid source="parent" name="usegroupid" depth="3" />
- <use source="parent" name="use" />
- </parameters>
- </project2:isdistinct>
- <project2:sqlmergeinsert>
- <parameters>
- <usegroupid source="parent" name="usegroupid" depth="3" />
- <use source="parent" name="use" />
- <description source="parent" name="description" />
- </parameters>
- </project2:sqlmergeinsert>
- </project2:iterate>
- </project2:iterate>
- <columns>
- <usegroupid key="true" />
- <use key="true" />
- <description />
- </columns>
- </project2:sqlmerge>
- </project2:iterate>
- <project2:sqltask name="update" datasource="postgres">
- <sql>
- UPDATE files SET
- cachedat = moddate
- WHERE filetypeid = 9
- </sql>
- </project2:sqltask>
+ </project2:sqlmerge>
</packageimport>
diff --git a/gentoobrowse/console/use.local.xml b/gentoobrowse/console/use.local.xml
index 877b260..882ee82 100644
--- a/gentoobrowse/console/use.local.xml
+++ b/gentoobrowse/console/use.local.xml
@@ -1,50 +1,16 @@
<?xml version="1.0"?>
<test name="test" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
- <project2:streamrows name="cl" newline="&#10;" encoding="utf-8" fieldSep="" quoteChar="">
- <project2:filestream path="/usr/portage/profiles/use.local.desc" />
- <columns>
- <text />
- </columns>
- </project2:streamrows>
- <project2:regexrows name="cla">
- <sourceText source="parent" name="text" depth="1" />
- <regex>([^/]+)/([^:]+):([^ ]+) - (.+)</regex>
- <columns>
- <category />
- <package />
- <use />
- <description />
- </columns>
- </project2:regexrows>
<project2:sqlmerge name="mergeguse" datasource="postgres" targettable="use_local">
- <project2:iterate name="lines" source="cl">
- <project2:iterate name="flags" source="cla">
- <project2:handler>
- <try>
- <project2:sqlmergeinsert name="insertFile">
- <parameters>
- <packageid source="lookup" name="packageid">
- <project2:sqlrows name="packagelist" datasource="postgres">
- <sql>
- SELECT p.packageid, c.name AS category, p.name AS package
- FROM packages p, categories c
- WHERE p.categoryid = c.categoryid
- </sql>
- </project2:sqlrows>
- <parameters>
- <package source="parent" name="package" depth="1"/>
- <category source="parent" name="category" depth="1"/>
- </parameters>
- </packageid>
- <use source="parent" name="use" depth="1"/>
- <description source="parent" name="description" depth="1" />
- </parameters>
- </project2:sqlmergeinsert>
- </try>
- </project2:handler>
- </project2:iterate>
- </project2:iterate>
+ <sql>
+ SELECT p.packageid, u.ud[3] AS use, u.ud[4] AS description
+ FROM (SELECT regexp_matches(u, '([^/]+)/([^:]+):([^ ]+) - (.+)') ud
+ FROM files f, regexp_split_to_table(pg_read_file(f.filename), '\n') u
+ WHERE f.filetypeid = 6) u, categories c, packages p
+ WHERE c.name = u.ud[1]
+ AND p.name = u.ud[2]
+ AND c.categoryid = p.categoryid
+ </sql>
<columns>
<packageid key="true" />
<use key="true" />