summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/util/update.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse-api/util/update.cpp')
-rw-r--r--gentoobrowse-api/util/update.cpp35
1 files changed, 35 insertions, 0 deletions
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;
+}
+