summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-02-05 15:45:28 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-02-05 15:45:28 +0000
commitf7fca553be18c073ed455fee98a79ebd4765b239 (patch)
tree89b3af6e6fc0d8727ff25a4c985da256b0834b38
parentAdd explicit init and clean up of XML/XSLT things with the API instance (diff)
downloadgentoobrowse-api-0.7.4.tar.bz2
gentoobrowse-api-0.7.4.tar.xz
gentoobrowse-api-0.7.4.zip
Handle the case when a use flag looks like it belongs in a group, but isn't defined in that groupgentoobrowse-api-0.7.4
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackageUses.sql8
1 files changed, 5 insertions, 3 deletions
diff --git a/gentoobrowse-api/service/sql/portage/getPackageUses.sql b/gentoobrowse-api/service/sql/portage/getPackageUses.sql
index 0b06b20..9c61bcd 100644
--- a/gentoobrowse-api/service/sql/portage/getPackageUses.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackageUses.sql
@@ -1,4 +1,6 @@
-SELECT SUBSTRING(COALESCE(ugg.use, eu.use), 1, 1) = '+' isdefault, ul.packageid, ugs.name AS group, LTRIM(COALESCE(ugg.use, eu.use), '+') AS use,
+SELECT SUBSTRING(COALESCE(ugg.use, eu.use), 1, 1) = '+' isdefault, ul.packageid,
+ CASE WHEN ugg.usegroupid IS NOT NULL THEN ugs.name END AS group,
+ LTRIM(COALESCE(ugg.use, eu.use), '+') AS use,
COALESCE(ul.description, ugg.description, ug.description) description
FROM gentoobrowse.ebuilds e
JOIN gentoobrowse.ebuild_uses eu
@@ -9,10 +11,10 @@ FROM gentoobrowse.ebuilds e
ON LTRIM(eu.use, '+') = ul.use
AND ul.packageid = e.packageid
LEFT OUTER JOIN gentoobrowse.use_groups ugs
- ON eu.use like ugs.name || '\_%' escape '\'
+ ON eu.use like ugs.name || '#_%' escape '#'
LEFT OUTER JOIN gentoobrowse.use_group ugg
ON ugg.usegroupid = ugs.usegroupid
AND eu.use = ugs.name || '_' || ugg.use
WHERE e.packageid = ?
GROUP BY eu.use, ul.use, ul.packageid, ug.use, ugs.name, ugg.usegroupid, ugg.use, ugg.description
-ORDER BY ugs.name nulls first, LTRIM(COALESCE(ugg.use, eu.use), '+')
+ORDER BY ugg.usegroupid IS NOT NULL, ugs.name, LTRIM(COALESCE(ugg.use, eu.use), '+')