diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-26 21:13:04 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-26 21:15:52 +0100 |
commit | 04162bd4a4e524f983c1b2e4bb0a19c84e70fd98 (patch) | |
tree | 2c5d7519d0bd367d02526fe973f3eee1e1945a96 | |
parent | Use SQL copy to upload file list faster (diff) | |
download | gentoobrowse-api-04162bd4a4e524f983c1b2e4bb0a19c84e70fd98.tar.bz2 gentoobrowse-api-04162bd4a4e524f983c1b2e4bb0a19c84e70fd98.tar.xz gentoobrowse-api-04162bd4a4e524f983c1b2e4bb0a19c84e70fd98.zip |
Add an update util for triggering database updates
-rw-r--r-- | gentoobrowse-api/Jamfile.jam | 5 | ||||
-rw-r--r-- | gentoobrowse-api/util/Jamfile.jam | 9 | ||||
-rw-r--r-- | gentoobrowse-api/util/update.cpp | 35 |
3 files changed, 48 insertions, 1 deletions
diff --git a/gentoobrowse-api/Jamfile.jam b/gentoobrowse-api/Jamfile.jam index 1766a46..e5607ec 100644 --- a/gentoobrowse-api/Jamfile.jam +++ b/gentoobrowse-api/Jamfile.jam @@ -17,6 +17,7 @@ lib dbppcore : : : : <include>/usr/include/dbpp ; build-project client ; build-project service ; build-project unittests ; +build-project util ; package.install install-libs : : : api//gentoobrowse-api @@ -27,7 +28,9 @@ package.install install-client : <dependency>install-libs : client//gbcli ; -package.install install-service : <dependency>install-libs : : +package.install install-service : <dependency>install-libs : + util//gbdbupdate + : service//gentoobrowse-service ; diff --git a/gentoobrowse-api/util/Jamfile.jam b/gentoobrowse-api/util/Jamfile.jam new file mode 100644 index 0000000..cb06c61 --- /dev/null +++ b/gentoobrowse-api/util/Jamfile.jam @@ -0,0 +1,9 @@ +lib boost_program_options ; + +exe gbdbupdate : update.cpp : + <library>..//adhocutil + <library>..//boost_system + <library>boost_program_options + <library>../api//gentoobrowse-api + <implicit-dependency>../api//gentoobrowse-api + ; diff --git a/gentoobrowse-api/util/update.cpp b/gentoobrowse-api/util/update.cpp new file mode 100644 index 0000000..43f894a --- /dev/null +++ b/gentoobrowse-api/util/update.cpp @@ -0,0 +1,35 @@ +#include <maintenance.h> +#include <Ice/Ice.h> +#include <boost/program_options.hpp> + +namespace po = boost::program_options; + +int +main(int c, char ** v) +{ + std::string endpoint; + po::options_description opts("Gentoo Browse Util::Update options"); + opts.add_options() + ("endpoint", po::value(&endpoint)->default_value("tcp -p 9001"), "Service endpoint") + ("help,h", "Show help") + ; + + po::variables_map vm; + po::store(po::command_line_parser(c, v).options(opts).run(), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cerr << opts << std::endl; + exit(1); + } + + auto ic = Ice::initialize(c, v); + auto m = Gentoo::MaintenancePrx::checkedCast(ic->stringToProxy("maintenance:" + endpoint)); + m->ice_ping(); + + m->refreshPackageTree(); + + ic->destroy(); + return 0; +} + |