summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-11 01:51:23 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-11 01:51:23 +0000
commit46702be9bb2ba37b47f129c46f447368fde69123 (patch)
tree2466b27a6f7b524487ad29a0747d349213e94b6a
parentTruncate file before slicer as slicer appends (diff)
downloadgentoobrowse-api-46702be9bb2ba37b47f129c46f447368fde69123.tar.bz2
gentoobrowse-api-46702be9bb2ba37b47f129c46f447368fde69123.tar.xz
gentoobrowse-api-46702be9bb2ba37b47f129c46f447368fde69123.zip
Get package change log
-rw-r--r--gentoobrowse-api/api/portage.ice1
-rw-r--r--gentoobrowse-api/domain/portage-models.ice11
-rw-r--r--gentoobrowse-api/service/portageimpl.cpp7
-rw-r--r--gentoobrowse-api/service/portageimpl.h1
-rw-r--r--gentoobrowse-api/service/sql/portage/getPackageChangeLog.sql4
-rw-r--r--gentoobrowse-api/unittests/testPortage.cpp20
6 files changed, 44 insertions, 0 deletions
diff --git a/gentoobrowse-api/api/portage.ice b/gentoobrowse-api/api/portage.ice
index 2101a76..faf8155 100644
--- a/gentoobrowse-api/api/portage.ice
+++ b/gentoobrowse-api/api/portage.ice
@@ -13,6 +13,7 @@ module Gentoo {
idempotent Packages getPackagesInCategory(int id);
idempotent SearchResultPackages getPackagesSearch(string query);
idempotent Ebuilds getPackageVersions(int id);
+ idempotent ChangeLog getPackageChangeLog(int id);
idempotent Bug getBug(int id);
idempotent Bugs getPackageBugs(int packageId);
diff --git a/gentoobrowse-api/domain/portage-models.ice b/gentoobrowse-api/domain/portage-models.ice
index c1257db..744cbf5 100644
--- a/gentoobrowse-api/domain/portage-models.ice
+++ b/gentoobrowse-api/domain/portage-models.ice
@@ -52,10 +52,21 @@ module Gentoo {
string firstseen;
};
+ class ChangeLogEntry {
+ int packageid;
+ [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ]
+ string date;
+ string comment;
+ optional(0) string person;
+ optional(1) string email;
+ int repoid;
+ };
+
sequence<Category> Categories;
sequence<Package> Packages;
sequence<Ebuild> Ebuilds;
sequence<Bug> Bugs;
+ sequence<ChangeLogEntry> ChangeLog;
};
#endif
diff --git a/gentoobrowse-api/service/portageimpl.cpp b/gentoobrowse-api/service/portageimpl.cpp
index f2c593a..7cbfea7 100644
--- a/gentoobrowse-api/service/portageimpl.cpp
+++ b/gentoobrowse-api/service/portageimpl.cpp
@@ -8,6 +8,7 @@
#include <sql/portage/getPackagesInCategory.h>
#include <sql/portage/getPackagesSearch.h>
#include <sql/portage/getPackageVersions.h>
+#include <sql/portage/getPackageChangeLog.h>
#include <sql/portage/getBug.h>
#include <sql/portage/getPackageBugs.h>
#include <sql/portage/getBugsSearch.h>
@@ -71,6 +72,12 @@ Portage::getPackageVersions(Ice::Int id, const Ice::Current &)
return fetch<Gentoo::Ebuilds, sql::getPackageVersions>(id);
}
+Gentoo::ChangeLog
+Portage::getPackageChangeLog(Ice::Int id, const Ice::Current &)
+{
+ return fetch<Gentoo::ChangeLog, sql::getPackageChangeLog>(id);
+}
+
Gentoo::BugPtr
Portage::getBug(Ice::Int id, const Ice::Current &)
{
diff --git a/gentoobrowse-api/service/portageimpl.h b/gentoobrowse-api/service/portageimpl.h
index e99807c..8624996 100644
--- a/gentoobrowse-api/service/portageimpl.h
+++ b/gentoobrowse-api/service/portageimpl.h
@@ -19,6 +19,7 @@ class DLL_PUBLIC Portage : public Gentoo::Portage, AbstractDatabaseClient {
Gentoo::Packages getPackagesInCategory(Ice::Int id, const Ice::Current &) override;
Gentoo::SearchResultPackages getPackagesSearch(const std::string & query, const Ice::Current &) override;
Gentoo::Ebuilds getPackageVersions(Ice::Int id, const Ice::Current &) override;
+ Gentoo::ChangeLog getPackageChangeLog(Ice::Int id, const Ice::Current &) override;
Gentoo::BugPtr getBug(Ice::Int id, const Ice::Current &) override;
Gentoo::Bugs getPackageBugs(Ice::Int packageId, const Ice::Current &) override;
diff --git a/gentoobrowse-api/service/sql/portage/getPackageChangeLog.sql b/gentoobrowse-api/service/sql/portage/getPackageChangeLog.sql
new file mode 100644
index 0000000..0917b72
--- /dev/null
+++ b/gentoobrowse-api/service/sql/portage/getPackageChangeLog.sql
@@ -0,0 +1,4 @@
+SELECT cl.packageid, cl.date, cl.person, cl.email, cl.comment, cl.repoid
+FROM gentoobrowse.package_changelogs cl
+WHERE packageid = ?
+ORDER BY cl.date DESC, cl.n DESC, cl.repoid
diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp
index 5f42bad..684390b 100644
--- a/gentoobrowse-api/unittests/testPortage.cpp
+++ b/gentoobrowse-api/unittests/testPortage.cpp
@@ -168,6 +168,26 @@ BOOST_AUTO_TEST_CASE( getPackageVersions )
BOOST_REQUIRE_EQUAL(629067, es.back()->ebuildid);
}
+BOOST_AUTO_TEST_CASE( getPackageChangeLog )
+{
+ MockPool mp;
+ auto p = Portage::PointerType(new Portage(mp));
+ auto cl = p->getPackageChangeLog(64582);
+ BOOST_REQUIRE_EQUAL(3, cl.size());
+ BOOST_REQUIRE_EQUAL(64582, cl.front()->packageid);
+ BOOST_REQUIRE_EQUAL("2015-10-21T00:00:00", cl.front()->date);
+ BOOST_REQUIRE(cl.front()->email);
+ BOOST_REQUIRE_EQUAL("jlec@gentoo.org", *cl.front()->email);
+ BOOST_REQUIRE(cl.front()->person);
+ BOOST_REQUIRE_EQUAL("Justin Lecher", *cl.front()->person);
+ BOOST_REQUIRE_EQUAL("Update remote-ids", cl.front()->comment);
+ BOOST_REQUIRE_EQUAL(17, cl.front()->repoid);
+ BOOST_REQUIRE_EQUAL("2015-10-17T00:00:00", cl.back()->date);
+ BOOST_REQUIRE(cl.back()->email);
+ BOOST_REQUIRE_EQUAL("tomboy64@sina.cn", *cl.back()->email);
+ BOOST_REQUIRE_EQUAL("revbump", cl.back()->comment);
+}
+
BOOST_AUTO_TEST_CASE( getBug )
{
MockPool mp;