diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-19 19:52:09 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-01-19 19:52:09 +0000 |
commit | 654e8273bd74efa42936321086b03ddafe7d53af (patch) | |
tree | 01ae0e0bbb431f0bf0faec8b594f5d706719cb48 | |
parent | Use libtidy instead of messy shelling out to tidy (diff) | |
download | gentoobrowse-api-0.7.2.tar.bz2 gentoobrowse-api-0.7.2.tar.xz gentoobrowse-api-0.7.2.zip |
Add missing method to get package URLsgentoobrowse-api-0.7.2
-rw-r--r-- | gentoobrowse-api/api/portage.ice | 1 | ||||
-rw-r--r-- | gentoobrowse-api/service/portageimpl.cpp | 7 | ||||
-rw-r--r-- | gentoobrowse-api/service/portageimpl.h | 1 | ||||
-rw-r--r-- | gentoobrowse-api/service/sql/portage/getPackageUrls.sql | 4 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testPortage.cpp | 7 |
5 files changed, 20 insertions, 0 deletions
diff --git a/gentoobrowse-api/api/portage.ice b/gentoobrowse-api/api/portage.ice index 1671c91..fe159ad 100644 --- a/gentoobrowse-api/api/portage.ice +++ b/gentoobrowse-api/api/portage.ice @@ -31,6 +31,7 @@ module Gentoo { idempotent Uses getPackageUses(int id); idempotent Packages getUserTrackedPackages(int userid); idempotent Ebuilds getUserTrackedRecentVersions(int userid, int limit); + idempotent StringList getPackageUrls(int id); idempotent Use getUse(string flag) throws Slicer::NoRowsReturned; idempotent Uses getGlobalUses(); diff --git a/gentoobrowse-api/service/portageimpl.cpp b/gentoobrowse-api/service/portageimpl.cpp index ac83557..bb8a215 100644 --- a/gentoobrowse-api/service/portageimpl.cpp +++ b/gentoobrowse-api/service/portageimpl.cpp @@ -40,6 +40,7 @@ #include <sql/portage/getNewsRecent.sql.h> #include <sql/portage/getRepository.sql.h> #include <sql/portage/getRepositories.sql.h> +#include <sql/portage/getPackageUrls.sql.h> namespace Gentoo { namespace Service { @@ -174,6 +175,12 @@ Portage::getUserTrackedRecentVersions(Ice::Int userid, Ice::Int limit, const Ice return fetchCache<Gentoo::Ebuilds>(sql::portage::getUserTrackedRecentVersions, 30, userid, limit); } +Gentoo::StringList +Portage::getPackageUrls(Ice::Int id, const Ice::Current &) +{ + return fetchCache<Gentoo::StringList>(sql::portage::getPackageUrls, 30, id); +} + Gentoo::Categories Portage::getCategoriesWithRecentAdditions(Ice::Int syncs, const Ice::Current &) { diff --git a/gentoobrowse-api/service/portageimpl.h b/gentoobrowse-api/service/portageimpl.h index b27f2a0..be8742a 100644 --- a/gentoobrowse-api/service/portageimpl.h +++ b/gentoobrowse-api/service/portageimpl.h @@ -38,6 +38,7 @@ class DLL_PUBLIC Portage : public Gentoo::Portage, IceTray::AbstractCachingDatab Gentoo::Uses getPackageUses(Ice::Int id, const Ice::Current &) override; Gentoo::Packages getUserTrackedPackages(Ice::Int userid, const Ice::Current &) override; Gentoo::Ebuilds getUserTrackedRecentVersions(Ice::Int userid, Ice::Int limit, const Ice::Current &) override; + Gentoo::StringList getPackageUrls(Ice::Int id, const Ice::Current &) override; Gentoo::UsePtr getUse(const std::string &, const Ice::Current &) override; Gentoo::Uses getGlobalUses(const Ice::Current &) override; diff --git a/gentoobrowse-api/service/sql/portage/getPackageUrls.sql b/gentoobrowse-api/service/sql/portage/getPackageUrls.sql new file mode 100644 index 0000000..109b0d9 --- /dev/null +++ b/gentoobrowse-api/service/sql/portage/getPackageUrls.sql @@ -0,0 +1,4 @@ +SELECT url +FROM gentoobrowse.package_urls +WHERE packageid = ? +ORDER BY url diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp index 588ad8c..b235c4e 100644 --- a/gentoobrowse-api/unittests/testPortage.cpp +++ b/gentoobrowse-api/unittests/testPortage.cpp @@ -283,6 +283,13 @@ BOOST_AUTO_TEST_CASE( getUserTrackedRecentVersions ) BOOST_REQUIRE_EQUAL("2015-10-17T15:00:13.238126", ps.back()->firstseen); } +BOOST_AUTO_TEST_CASE( getPackageUrls ) +{ + auto urls = p->getPackageUrls(54144); + BOOST_REQUIRE_EQUAL(1, urls.size()); + BOOST_REQUIRE_EQUAL("http://www.git-scm.com/", urls.front()); +} + BOOST_AUTO_TEST_CASE( getPackageRuntimeDependencies ) { auto d = p->getPackageRuntimeDependencies(54144); |