From 01e8ee77b605b747d971106017a817e0c15c87e8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 7 Aug 2015 21:52:40 +0100 Subject: Replace use flag import --- gentoobrowse/console/use.global.xml | 23 ++++-------- gentoobrowse/console/use.grouped.xml | 69 ++++++------------------------------ gentoobrowse/console/use.local.xml | 52 +++++---------------------- 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 @@ - - - - - - - - - ([^ ]+) - (.+) - - - - - - - - + + 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 + 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"> - SELECT split_part(f.filename, '.', 1) AS name + SELECT DISTINCT split_part(pathparts[3], '.', 1) AS name FROM files f WHERE f.filetypeid = 9 @@ -11,66 +11,19 @@ - + - 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] - - - - - - - - - - - ([^ ]+) - (.+) - - + + - - - - - a.usegroupid = - - - - - - - - - - - - - - - - - - - - - - - - - - - - UPDATE files SET - cachedat = moddate - WHERE filetypeid = 9 - - + 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 @@ - - - - - - - - - ([^/]+)/([^:]+):([^ ]+) - (.+) - - - - - - - - - - - - - - - - - SELECT p.packageid, c.name AS category, p.name AS package - FROM packages p, categories c - WHERE p.categoryid = c.categoryid - - - - - - - - - - - - - - - + + 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 + -- cgit v1.2.3