summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-11-01 01:06:39 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-11-01 01:06:39 +0000
commit71a64a9876dcd5343dcc2e1321e3c1fbbf5f7179 (patch)
treee7a6e819114caa05883e00f36d3f12dfb7b68fb2
parentPqArray should be public (diff)
downloadgentoobrowse-api-71a64a9876dcd5343dcc2e1321e3c1fbbf5f7179.tar.bz2
gentoobrowse-api-71a64a9876dcd5343dcc2e1321e3c1fbbf5f7179.tar.xz
gentoobrowse-api-71a64a9876dcd5343dcc2e1321e3c1fbbf5f7179.zip
Fix get package uses for cases when grouped flag contains _ (that's you python targets!)
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackageUses.sql17
1 files changed, 8 insertions, 9 deletions
diff --git a/gentoobrowse-api/service/sql/portage/getPackageUses.sql b/gentoobrowse-api/service/sql/portage/getPackageUses.sql
index 0d14a64..5e74e35 100644
--- a/gentoobrowse-api/service/sql/portage/getPackageUses.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackageUses.sql
@@ -1,4 +1,4 @@
-SELECT SUBSTRING(COALESCE(ugg.use, eu.use), 1, 1) = '+' isdefault, ul.packageid, ugg.name AS group, LTRIM(COALESCE(ugg.use, eu.use), '+') AS use,
+SELECT SUBSTRING(COALESCE(ugg.use, eu.use), 1, 1) = '+' isdefault, ul.packageid, ugs.name 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
@@ -8,12 +8,11 @@ FROM gentoobrowse.ebuilds e
LEFT OUTER JOIN gentoobrowse.use_local ul
ON LTRIM(eu.use, '+') = ul.use
AND ul.packageid = e.packageid
- LEFT OUTER JOIN (
- SELECT ugs.usegroupid, ugs.name, ugg.use, ugg.description
- FROM gentoobrowse.use_group ugg, gentoobrowse.use_groups ugs
- WHERE ugs.usegroupid = ugg.usegroupid) ugg
- ON REVERSE(SPLIT_PART(REVERSE(eu.use), '_', 1)) = ugg.use
- AND LEFT(eu.use, LENGTH(eu.use) - LENGTH(SPLIT_PART(REVERSE(eu.use), '_', 1)) - 1) = ugg.name
+ LEFT OUTER JOIN gentoobrowse.use_groups ugs
+ 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, ugg.name, ugg.usegroupid, ugg.use, ugg.description
-ORDER BY ugg.name nulls first, eu.use
+GROUP BY eu.use, ul.use, ul.packageid, ug.use, ugs.name, ugg.usegroupid, ugg.use, ugg.description
+ORDER BY ugs.name nulls first, eu.use