summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/db/schema.sql12
-rw-r--r--gentoobrowse-api/service/maintenance/masksProcessor.cpp6
-rw-r--r--gentoobrowse-api/service/sql/maintenance/masksFixDates.sql3
-rw-r--r--gentoobrowse-api/unittests/fixtures/4156eb45cf3b0ce1d7125b84efd8688c2d6e831d/profiles/package.mask4
-rw-r--r--gentoobrowse-api/unittests/fixtures/756569aa764177340726dd3d40b41d89b11b20c7/profiles/package.mask2
5 files changed, 19 insertions, 8 deletions
diff --git a/gentoobrowse-api/db/schema.sql b/gentoobrowse-api/db/schema.sql
index 77dfe3c..066d297 100644
--- a/gentoobrowse-api/db/schema.sql
+++ b/gentoobrowse-api/db/schema.sql
@@ -37,7 +37,8 @@ CREATE TABLE changelog (
authoremail text NOT NULL,
summary text NOT NULL,
body text,
- files text[] NOT NULL
+ files text[] NOT NULL,
+ CONSTRAINT range_committime CHECK (((committime >= '1400-01-01'::date) AND (committime <= '9999-12-31'::date)))
);
ALTER TABLE ONLY changelog ALTER COLUMN commitid SET STORAGE PLAIN;
ALTER TABLE changelog OWNER TO gentoo;
@@ -356,7 +357,8 @@ CREATE TABLE ebuilds (
license text,
firstseen timestamp without time zone DEFAULT now() NOT NULL,
moddate timestamp without time zone NOT NULL,
- repoid integer NOT NULL
+ repoid integer NOT NULL,
+ CONSTRAINT range_moddate CHECK (((moddate >= '1400-01-01'::date) AND (moddate <= '9999-12-31'::date)))
);
ALTER TABLE ebuilds OWNER TO gentoo;
-- Name: TABLE ebuilds; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo
@@ -375,7 +377,8 @@ CREATE TABLE masksets (
dateadded date NOT NULL,
message text NOT NULL,
atomspec text[] NOT NULL,
- n smallint NOT NULL
+ n smallint NOT NULL,
+ CONSTRAINT range_dateadded CHECK (((dateadded >= '1400-01-01'::date) AND (dateadded <= '9999-12-31'::date)))
);
ALTER TABLE masksets OWNER TO gentoo;
-- Name: changeid_seq; Type: SEQUENCE; Schema: gentoobrowse; Owner: gentoo
@@ -407,7 +410,8 @@ CREATE TABLE news (
authoremail text,
atomspec text[],
body text[] NOT NULL,
- urls text[]
+ urls text[],
+ CONSTRAINT range_posted CHECK (((posted >= '1400-01-01'::date) AND (posted <= '9999-12-31'::date)))
);
ALTER TABLE news OWNER TO gentoo;
-- Name: newsfts(news); Type: FUNCTION; Schema: gentoobrowse; Owner: gentoo
diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
index b914bd4..5a0bf53 100644
--- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp
+++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp
@@ -10,10 +10,11 @@
#include <lexer-regex.h>
#include <lexer.h>
#include "sql/maintenance/masksSets.sql.h"
+#include "sql/maintenance/masksFixDates.sql.h"
#include "sql/maintenance/masksEbuilds.sql.h"
static AdHoc::Lexer::PatternPtr maskHead = AdHoc::LexerMatchers::regex(
- "^# ([^<\n]+)? ?(<(.+?@[^\n>]+)>?)? \\((\\d+ *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\w* \\d+)\\)$\n",
+ "^# ([^<\n]+)? ?(<(.+?@[^\n>]+)>?)? \\((\\d{1,2} *(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\w* \\d{4})\\)$\n",
(GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_CASELESS | G_REGEX_UNGREEDY | G_REGEX_MULTILINE));
static AdHoc::Lexer::PatternPtr maskDesc = AdHoc::LexerMatchers::regex("^# *([^\n]*)$\n", G_REGEX_MULTILINE);
static AdHoc::Lexer::PatternPtr atom = AdHoc::LexerMatchers::regex("^([^\n/]+/[^\n]*)$\n?", G_REGEX_MULTILINE);
@@ -86,6 +87,9 @@ namespace Gentoo {
{ { AdHoc::Lexer::InitialState }, discard, [&](auto) { } }
});
l.extract((gchar *)f.data, f.getStat().st_size);
+ // Dates are hand-typed and sometimes typos occur... ensure they're at
+ // least within the range of Boost ptimes.
+ while (sql::maintenance::masksFixDates.modify(dbc)->execute()) ;
DB::TablePatch p;
p.dest = "gentoobrowse.masksets";
diff --git a/gentoobrowse-api/service/sql/maintenance/masksFixDates.sql b/gentoobrowse-api/service/sql/maintenance/masksFixDates.sql
new file mode 100644
index 0000000..a06c863
--- /dev/null
+++ b/gentoobrowse-api/service/sql/maintenance/masksFixDates.sql
@@ -0,0 +1,3 @@
+UPDATE tmp_masks SET
+ dateadded = dateadded + INTERVAL '1000 years'
+WHERE dateadded < '1400-01-01'
diff --git a/gentoobrowse-api/unittests/fixtures/4156eb45cf3b0ce1d7125b84efd8688c2d6e831d/profiles/package.mask b/gentoobrowse-api/unittests/fixtures/4156eb45cf3b0ce1d7125b84efd8688c2d6e831d/profiles/package.mask
index c8c5513..9144672 100644
--- a/gentoobrowse-api/unittests/fixtures/4156eb45cf3b0ce1d7125b84efd8688c2d6e831d/profiles/package.mask
+++ b/gentoobrowse-api/unittests/fixtures/4156eb45cf3b0ce1d7125b84efd8688c2d6e831d/profiles/package.mask
@@ -30,13 +30,13 @@
#--- END OF EXAMPLES ---
-# James Le Cuirot <chewi@gentoo.org> (25 Apr 2016)
+# James Le Cuirot <chewi@gentoo.org> (25 Apr 1016)
# Long dead upstream and no longer needed. Removal in 30 days.
dev-java/charva
dev-java/jakarta-slide-webdavclient
dev-java/xml-im-exporter
-# Alex Brandt <alunduil@gentoo.org> (23 Apr 2016)
+# Alex Brandt <alunduil@gentoo.org> (23 Apr 3016)
# Contains collisions with dev-python/ipaddress. See #580388 for more details.
# Masked for removal in 30 days.
dev-python/py2-ipaddress
diff --git a/gentoobrowse-api/unittests/fixtures/756569aa764177340726dd3d40b41d89b11b20c7/profiles/package.mask b/gentoobrowse-api/unittests/fixtures/756569aa764177340726dd3d40b41d89b11b20c7/profiles/package.mask
index c8c5513..bc19511 100644
--- a/gentoobrowse-api/unittests/fixtures/756569aa764177340726dd3d40b41d89b11b20c7/profiles/package.mask
+++ b/gentoobrowse-api/unittests/fixtures/756569aa764177340726dd3d40b41d89b11b20c7/profiles/package.mask
@@ -36,7 +36,7 @@ dev-java/charva
dev-java/jakarta-slide-webdavclient
dev-java/xml-im-exporter
-# Alex Brandt <alunduil@gentoo.org> (23 Apr 2016)
+# Alex Brandt <alunduil@gentoo.org> (23 Apr 3016)
# Contains collisions with dev-python/ipaddress. See #580388 for more details.
# Masked for removal in 30 days.
dev-python/py2-ipaddress