summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-09 17:59:49 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-09 17:59:49 +0000
commit4f7786b2341730d91066605668b1001c4c334b79 (patch)
tree1f527af5a519327bbf6e252e60e22dd9ef8f24c3
parentAdd bugs list support (diff)
downloadgentoobrowse-api-4f7786b2341730d91066605668b1001c4c334b79.tar.bz2
gentoobrowse-api-4f7786b2341730d91066605668b1001c4c334b79.tar.xz
gentoobrowse-api-4f7786b2341730d91066605668b1001c4c334b79.zip
Add previously omitted timestamp fields
-rw-r--r--gentoobrowse-api/Jamfile.jam1
-rw-r--r--gentoobrowse-api/domain/Jamfile.jam1
-rw-r--r--gentoobrowse-api/domain/portage-models.ice10
-rw-r--r--gentoobrowse-api/service/sql/portage/findPackage.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getBug.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getBugsSearch.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackage.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackageBugs.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackagesInCategory.sql2
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackagesSearch.sql2
-rw-r--r--gentoobrowse-api/unittests/testPortage.cpp4
11 files changed, 23 insertions, 7 deletions
diff --git a/gentoobrowse-api/Jamfile.jam b/gentoobrowse-api/Jamfile.jam
index d8b3812..bc057cc 100644
--- a/gentoobrowse-api/Jamfile.jam
+++ b/gentoobrowse-api/Jamfile.jam
@@ -11,6 +11,7 @@ lib IceBox ;
lib boost_filesystem ;
lib boost_system ;
lib boost_thread ;
+lib boost_date_time ;
lib dbppcore : : : : <include>/usr/include/dbpp ;
project
diff --git a/gentoobrowse-api/domain/Jamfile.jam b/gentoobrowse-api/domain/Jamfile.jam
index afe1fa2..89314b7 100644
--- a/gentoobrowse-api/domain/Jamfile.jam
+++ b/gentoobrowse-api/domain/Jamfile.jam
@@ -7,6 +7,7 @@ lib gentoobrowse-domain :
<library>..//Ice
<library>..//IceUtil
<library>..//pthread
+ <library>..//boost_date_time
<variant>release:<cflags>-flto
: :
<library>..//Ice
diff --git a/gentoobrowse-api/domain/portage-models.ice b/gentoobrowse-api/domain/portage-models.ice
index 2efe985..c1257db 100644
--- a/gentoobrowse-api/domain/portage-models.ice
+++ b/gentoobrowse-api/domain/portage-models.ice
@@ -1,6 +1,8 @@
#ifndef GENTOO_PORTAGE_MODELS
#define GENTOO_PORTAGE_MODELS
+[["cpp:include:boost/date_time/posix_time/posix_time.hpp"]]
+
module Gentoo {
sequence<byte> Image;
@@ -16,6 +18,8 @@ module Gentoo {
int packageid;
int categoryid;
string name;
+ [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ]
+ string firstseen;
string description;
optional(1) string summary;
optional(2) string maintainer;
@@ -31,6 +35,10 @@ module Gentoo {
int repoid;
string version;
string slot;
+ [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ]
+ string firstseen;
+ [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ]
+ string moddate;
optional(1) string license;
};
@@ -40,6 +48,8 @@ module Gentoo {
string severity;
string status;
string summary;
+ [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ]
+ string firstseen;
};
sequence<Category> Categories;
diff --git a/gentoobrowse-api/service/sql/portage/findPackage.sql b/gentoobrowse-api/service/sql/portage/findPackage.sql
index 4e305fc..7e45894 100644
--- a/gentoobrowse-api/service/sql/portage/findPackage.sql
+++ b/gentoobrowse-api/service/sql/portage/findPackage.sql
@@ -1,4 +1,4 @@
-SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.maintainer, p.maintainername, p.herd
+SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.firstseen, p.maintainer, p.maintainername, p.herd
FROM gentoobrowse.packages p, gentoobrowse.categories c
WHERE c.categoryid = p.categoryid
AND c.name = ?
diff --git a/gentoobrowse-api/service/sql/portage/getBug.sql b/gentoobrowse-api/service/sql/portage/getBug.sql
index b91b1a6..36d4586 100644
--- a/gentoobrowse-api/service/sql/portage/getBug.sql
+++ b/gentoobrowse-api/service/sql/portage/getBug.sql
@@ -1,3 +1,3 @@
-SELECT b.bugid, b.severity, b.status, b.summary
+SELECT b.bugid, b.severity, b.status, b.summary, b.firstseen
FROM gentoobrowse.bugs b
WHERE b.bugid = ?
diff --git a/gentoobrowse-api/service/sql/portage/getBugsSearch.sql b/gentoobrowse-api/service/sql/portage/getBugsSearch.sql
index 856dc7b..36d6f26 100644
--- a/gentoobrowse-api/service/sql/portage/getBugsSearch.sql
+++ b/gentoobrowse-api/service/sql/portage/getBugsSearch.sql
@@ -1,4 +1,4 @@
-SELECT b.bugid, b.severity, b.status, b.summary,
+SELECT b.bugid, b.severity, b.status, b.summary, b.firstseen,
ts_rank(gentoobrowse.bugfts(b), plainto_tsquery('english', ?)) rank
FROM gentoobrowse.bugs b
WHERE gentoobrowse.bugfts(b) @@ plainto_tsquery('english', ?)
diff --git a/gentoobrowse-api/service/sql/portage/getPackage.sql b/gentoobrowse-api/service/sql/portage/getPackage.sql
index 212b0c9..001bf88 100644
--- a/gentoobrowse-api/service/sql/portage/getPackage.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackage.sql
@@ -1,3 +1,3 @@
-SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.maintainer, p.maintainername, p.herd
+SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.firstseen, p.maintainer, p.maintainername, p.herd
FROM gentoobrowse.packages p
WHERE p.packageid = ?
diff --git a/gentoobrowse-api/service/sql/portage/getPackageBugs.sql b/gentoobrowse-api/service/sql/portage/getPackageBugs.sql
index ed9cee8..7361fa6 100644
--- a/gentoobrowse-api/service/sql/portage/getPackageBugs.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackageBugs.sql
@@ -1,4 +1,4 @@
-SELECT b.bugid, b.severity, b.status, b.summary
+SELECT b.bugid, b.severity, b.status, b.summary, b.firstseen
FROM gentoobrowse.bugs b, gentoobrowse.package_bugs pb
WHERE b.bugid = pb.bugid
AND pb.packageid = ?
diff --git a/gentoobrowse-api/service/sql/portage/getPackagesInCategory.sql b/gentoobrowse-api/service/sql/portage/getPackagesInCategory.sql
index 011d73c..70c661c 100644
--- a/gentoobrowse-api/service/sql/portage/getPackagesInCategory.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackagesInCategory.sql
@@ -1,4 +1,4 @@
-SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.maintainer, p.maintainername, p.herd
+SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.firstseen, p.maintainer, p.maintainername, p.herd
FROM gentoobrowse.packages p
WHERE p.categoryid = ?
ORDER BY p.name
diff --git a/gentoobrowse-api/service/sql/portage/getPackagesSearch.sql b/gentoobrowse-api/service/sql/portage/getPackagesSearch.sql
index fe97cee..82f695d 100644
--- a/gentoobrowse-api/service/sql/portage/getPackagesSearch.sql
+++ b/gentoobrowse-api/service/sql/portage/getPackagesSearch.sql
@@ -1,4 +1,4 @@
-SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.maintainer, p.maintainername, p.herd,
+SELECT p.packageid, p.categoryid, p.name, p.description, p.summary, p.firstseen, p.maintainer, p.maintainername, p.herd,
ts_rank(gentoobrowse.packagefts(p), plainto_tsquery('english', ?)) rank
FROM gentoobrowse.packages p
WHERE gentoobrowse.packagefts(p) @@ plainto_tsquery('english', ?)
diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp
index b6fa56a..8242580 100644
--- a/gentoobrowse-api/unittests/testPortage.cpp
+++ b/gentoobrowse-api/unittests/testPortage.cpp
@@ -91,6 +91,7 @@ BOOST_AUTO_TEST_CASE( getPackage )
BOOST_REQUIRE_EQUAL(53258, pkg->packageid);
BOOST_REQUIRE_EQUAL(311, pkg->categoryid);
BOOST_REQUIRE_EQUAL("archway", pkg->name);
+ BOOST_REQUIRE_EQUAL("2010-05-04T00:54:45.661860", pkg->firstseen);
BOOST_REQUIRE_EQUAL("A GUI for GNU Arch", pkg->description);
BOOST_REQUIRE(!pkg->summary);
BOOST_REQUIRE_EQUAL("maintainer-needed@gentoo.org", pkg->maintainer);
@@ -159,6 +160,7 @@ BOOST_AUTO_TEST_CASE( getBug )
BOOST_REQUIRE_EQUAL(567064, b->bugid);
BOOST_REQUIRE_EQUAL("normal", b->severity);
BOOST_REQUIRE_EQUAL("UNCONFIRMED", b->status);
+ BOOST_REQUIRE_EQUAL("2015-11-30T19:01:45.824590", b->firstseen);
BOOST_REQUIRE_EQUAL("Request for new package: dev-python/twine", b->summary);
}
@@ -169,6 +171,7 @@ BOOST_AUTO_TEST_CASE( getPackageBugs )
auto bs = p->getPackageBugs(55925);
BOOST_REQUIRE_EQUAL(1, bs.size());
BOOST_REQUIRE_EQUAL(567166, bs.front()->bugid);
+ BOOST_REQUIRE_EQUAL("2015-11-30T19:01:45.824590", bs.front()->firstseen);
}
BOOST_AUTO_TEST_CASE( getBugsSearch )
@@ -178,6 +181,7 @@ BOOST_AUTO_TEST_CASE( getBugsSearch )
auto bs = p->getBugsSearch("cpu");
BOOST_REQUIRE_EQUAL(3, bs.size());
BOOST_REQUIRE_EQUAL(567154, bs[0]->bugid);
+ BOOST_REQUIRE_EQUAL("2015-11-30T19:01:45.824590", bs[0]->firstseen);
BOOST_REQUIRE_CLOSE(0.06, bs[0]->rank, 2.0);
BOOST_REQUIRE_EQUAL(567250, bs[1]->bugid);
BOOST_REQUIRE_EQUAL(567682, bs[2]->bugid);