diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-12-02 15:41:42 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-12-02 15:41:47 +0000 |
commit | 005f336416c4678b9e0962aec56421db21304c15 (patch) | |
tree | 2764d393b25c1eac560f3aaf47986c28a41d4f70 | |
parent | More fine grained package pruning (diff) | |
download | gentoobrowse-api-005f336416c4678b9e0962aec56421db21304c15.tar.bz2 gentoobrowse-api-005f336416c4678b9e0962aec56421db21304c15.tar.xz gentoobrowse-api-005f336416c4678b9e0962aec56421db21304c15.zip |
Remove the ~ operator for ebuildversionrange
And along with it, the need for a custom search path to be set.
Also updates remaining SQL and scripts to unnecessarily depend on
customer search path.
-rw-r--r-- | gentoobrowse-api/db/schema.sql | 15 | ||||
-rw-r--r-- | gentoobrowse-api/service/maintenanceGitOperations.cpp | 2 | ||||
-rw-r--r-- | gentoobrowse-api/service/sql/maintenance/masksEbuilds.sql | 2 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/data.sql | 1 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/gitdata.sql | 1 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testMaintenance.cpp | 2 |
6 files changed, 5 insertions, 18 deletions
diff --git a/gentoobrowse-api/db/schema.sql b/gentoobrowse-api/db/schema.sql index b7f8209..e449d36 100644 --- a/gentoobrowse-api/db/schema.sql +++ b/gentoobrowse-api/db/schema.sql @@ -118,9 +118,9 @@ end if; op = (regexp_matches(atomspec, '^([^a-z]*)'))[1]; cat = (regexp_matches(atomspec, '^[^a-z]*([^/]+)/'))[1]; pkg = (regexp_matches(atomspec, '/(.+?)((-[0-9])|$)'))[1]; -ver = ebuildversion_constructor((regexp_matches(atomspec, '-([0-9]+.*)$'))[1]); +ver = gentoobrowse.ebuildversion_constructor((regexp_matches(atomspec, '-([0-9]+.*)$'))[1]); return query select ebuildid -from ebuilds e, packages p, categories c +from gentoobrowse.ebuilds e, gentoobrowse.packages p, gentoobrowse.categories c where e.packageid = p.packageid and p.categoryid = c.categoryid and p.name = pkg @@ -131,7 +131,7 @@ and case when op = '<=' then e.versioninst <= ver when op = '<' then e.versioninst < ver when op = '>' then e.versioninst > ver - when op = '~' then e.versioninst ~ ver + when op = '~' then gentoobrowse.ebuildversionrange(e.versioninst, ver) when op = '' then true else false end @@ -144,7 +144,7 @@ CREATE FUNCTION ebuildversion_constructor(val text) RETURNS ebuildversion LANGUAGE plpgsql IMMUTABLE AS $_$ declare - v ebuildversion; + v gentoobrowse.ebuildversion; s text; begin v.ver = string_to_array((regexp_matches(val, '^([0-9.]+)'))[1], '.')::bigint[]; @@ -280,13 +280,6 @@ CREATE AGGREGATE sum(tsvector) ( STYPE = tsvector ); ALTER AGGREGATE gentoobrowse.sum(tsvector) OWNER TO gentoo; --- Name: ~; Type: OPERATOR; Schema: gentoobrowse; Owner: gentoo -CREATE OPERATOR ~ ( - PROCEDURE = ebuildversionrange, - LEFTARG = ebuildversion, - RIGHTARG = ebuildversion -); -ALTER OPERATOR gentoobrowse.~ (ebuildversion, ebuildversion) OWNER TO gentoo; -- Name: categories; Type: TABLE; Schema: gentoobrowse; Owner: gentoo; Tablespace: CREATE TABLE categories ( categoryid integer NOT NULL, diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index d532926..fd2df39 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -178,13 +178,11 @@ namespace Gentoo { auto properties = c.adapter->getCommunicator()->getProperties(); auto repoRoot = boost::filesystem::path(properties->getPropertyWithDefault("GentooBrowseAPI.RepoRoot", "/")); auto dbc = db->get(); - dbc->execute("SET search_path = gentoobrowse, pg_catalog"); DB::TransactionScope tx(dbc.get()); for (auto & repo : fetch<Gentoo::Repositories>(dbc.get(), sql::maintenance::reposToGitRefresh)) { auto changes = refreshRepository(dbc.get(), properties, repo); this->applyFileChanges(dbc.get(), repoRoot, repo, changes); } - dbc->execute("SET search_path = public, pg_catalog"); } AdHocFormatter(UpdatingFileContent, "Updating file content\n"); diff --git a/gentoobrowse-api/service/sql/maintenance/masksEbuilds.sql b/gentoobrowse-api/service/sql/maintenance/masksEbuilds.sql index f34343e..688694d 100644 --- a/gentoobrowse-api/service/sql/maintenance/masksEbuilds.sql +++ b/gentoobrowse-api/service/sql/maintenance/masksEbuilds.sql @@ -1,4 +1,4 @@ ( - SELECT DISTINCT s.setno, ebuildfilter(UNNEST(s.atomSpec)) ebuildid + SELECT DISTINCT s.setno, gentoobrowse.ebuildfilter(UNNEST(s.atomSpec)) ebuildid FROM gentoobrowse.masksets s ) diff --git a/gentoobrowse-api/unittests/data.sql b/gentoobrowse-api/unittests/data.sql index 074b3d3..a0fd815 100644 --- a/gentoobrowse-api/unittests/data.sql +++ b/gentoobrowse-api/unittests/data.sql @@ -4,7 +4,6 @@ SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; -SET search_path = gentoobrowse, pg_catalog; COPY gentoobrowse.bugs (bugid, severity, status, summary, firstseen) FROM '$SCRIPTDIR/fixtures/bugs.dat'; COPY gentoobrowse.categories (categoryid, name, summary) FROM '$SCRIPTDIR/fixtures/categories.dat'; diff --git a/gentoobrowse-api/unittests/gitdata.sql b/gentoobrowse-api/unittests/gitdata.sql index c4a1d52..0d15b98 100644 --- a/gentoobrowse-api/unittests/gitdata.sql +++ b/gentoobrowse-api/unittests/gitdata.sql @@ -4,7 +4,6 @@ SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; SET client_min_messages = warning; -SET search_path = gentoobrowse, pg_catalog; COPY gentoobrowse.categories (categoryid, name, summary) FROM '$SCRIPTDIR/fixtures/git/categories.tsv'; COPY gentoobrowse.packages (packageid, categoryid, name, firstseen, description, summary, maintainer, herd, image, maintainername) FROM '$SCRIPTDIR/fixtures/git/packages.tsv'; diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index ab9786d..e10e7b6 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -80,7 +80,6 @@ class M2 : public Gentoo::Service::Maintenance { auto dbc = db->get(); auto fromFiles = fileSet(from); auto toFiles = fileSet(to); - dbc->execute("SET search_path = gentoobrowse, pg_catalog"); DB::TransactionScope tx(dbc.get()); Gentoo::Service::ChangeSet changes; newFiles(changes, fromFiles, toFiles); @@ -91,7 +90,6 @@ class M2 : public Gentoo::Service::Maintenance { Gentoo::Repository repo = { 1, "gentoo", to.string(), "origin", "master", "" }; applyFileChanges(dbc.get(), "/", repo, changes); boost::filesystem::remove(treeDir); - dbc->execute("SET search_path = public, pg_catalog"); } static FileMap fileSet(const boost::filesystem::path & p) |