Author: jsuchome
Date: Wed Feb 2 15:56:01 2011
New Revision: 63306
URL: http://svn.opensuse.org/viewcvs/yast?rev=63306&view=rev
Log:
- added scr agent to access snapper library
Added:
branches/tmp/jsuchome/snapper/agent-snapper/
branches/tmp/jsuchome/snapper/agent-snapper/Makefile.am
branches/tmp/jsuchome/snapper/agent-snapper/conf/
branches/tmp/jsuchome/snapper/agent-snapper/conf/Makefile.am
branches/tmp/jsuchome/snapper/agent-snapper/conf/snapper.scr
branches/tmp/jsuchome/snapper/agent-snapper/doc/
branches/tmp/jsuchome/snapper/agent-snapper/doc/Makefile.am
branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/
branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/Makefile.am
branches/tmp/jsuchome/snapper/agent-snapper/src/
branches/tmp/jsuchome/snapper/agent-snapper/src/FPrintAgent.cc
branches/tmp/jsuchome/snapper/agent-snapper/src/Makefile.am
branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc
branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.h
branches/tmp/jsuchome/snapper/agent-snapper/src/Y2CCSnapperAgent.cc
branches/tmp/jsuchome/snapper/agent-snapper/testsuite/
branches/tmp/jsuchome/snapper/agent-snapper/testsuite/Makefile.am
Modified:
branches/tmp/jsuchome/snapper/VERSION
branches/tmp/jsuchome/snapper/configure.in.in
branches/tmp/jsuchome/snapper/package/yast2-snapper.changes
branches/tmp/jsuchome/snapper/yast2-snapper.spec.in
Modified: branches/tmp/jsuchome/snapper/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/VERSION?rev=63306&r1=63305&r2=63306&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/VERSION (original)
+++ branches/tmp/jsuchome/snapper/VERSION Wed Feb 2 15:56:01 2011
@@ -1 +1 @@
-2.15.0
+2.17.0
Added: branches/tmp/jsuchome/snapper/agent-snapper/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1 @@
+SUBDIRS = conf doc src testsuite
Added: branches/tmp/jsuchome/snapper/agent-snapper/conf/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/conf/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/conf/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/conf/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1,7 @@
+#
+# Makefile.am for .../agent-snapper/conf
+#
+
+scrconf_DATA = snapper.scr
+
+EXTRA_DIST = $(scrconf_DATA)
Added: branches/tmp/jsuchome/snapper/agent-snapper/conf/snapper.scr
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/conf/snapper.scr?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/conf/snapper.scr (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/conf/snapper.scr Wed Feb 2 15:56:01 2011
@@ -0,0 +1,14 @@
+/**
+ * File: snapper.scr
+ * Summary: snapper agent: access to snapper library
+ * Author: Jiri Suchomel
+ * Access: read / write / execute
+ *
+ * Example:
+ *
+ */
+.snapper
+
+`ag_snapper(
+ `SnapperAgent()
+)
Added: branches/tmp/jsuchome/snapper/agent-snapper/doc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/doc/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/doc/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/doc/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1 @@
+SUBDIRS = autodocs
Added: branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/doc/autodocs/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1,6 @@
+#
+# Makefile.am for .../agent-snapper/doc/autodocs
+#
+
+AUTODOCS_SUBDIR=agent-snapper
+include $(top_srcdir)/autodocs-cc.ami
Added: branches/tmp/jsuchome/snapper/agent-snapper/src/FPrintAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/FPrintAgent.cc?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/src/FPrintAgent.cc (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/src/FPrintAgent.cc Wed Feb 2 15:56:01 2011
@@ -0,0 +1,448 @@
+/* FPrintAgent.cc
+ *
+ * An agent for FPrint library (access to fingerprint reader)
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id: FPrintAgent.cc 62115 2010-06-14 05:58:30Z jsuchome $
+ */
+
+#include "FPrintAgent.h"
+
+#define PC(n) (path->component_str(n))
+
+// error exit values of the child process
+#define INIT_FAILED 200
+#define NO_DEVICES 201
+#define DEVICE_OPEN_FAILED 202
+#define ENROLL_FAILURE 255
+
+
+/**
+ * Constructor
+ */
+FPrintAgent::FPrintAgent() : SCRAgent()
+{
+ child_pid = -1;
+ child_retval = -1;
+}
+
+/**
+ * Destructor
+ */
+FPrintAgent::~FPrintAgent()
+{
+}
+
+// return the only instance of the class
+FPrintAPI& FPrintAPI::instance()
+{
+ static FPrintAPI _instance; // The singleton
+ return _instance;
+}
+
+// handler for SIGTERM signal (it is necessary to kill the process when
+// user his Cancel)
+void FPrintAPI::catch_sigterm (int sig_num)
+{
+ instance().finalize ();
+ _exit (256);
+}
+
+// de-initialize finger print reader (must be called at the end!)
+void FPrintAPI::finalize ()
+{
+ if (instance().data != NULL)
+ {
+ fp_print_data_free (instance().data);
+ instance().data = NULL;
+ }
+ fp_exit();
+}
+
+FPrintAPI::FPrintAPI()
+{
+ data = NULL;
+}
+
+FPrintAPI::~FPrintAPI ()
+{
+}
+
+/**
+ * wrapper for fp_enroll_finger function;
+ * - we need to take care of the errors and signals
+ * @param file descriptor of the pipe
+ * @param path to the temporary directory for storing fingerprints
+ */
+int FPrintAPI::acquire (int write_fd, string dir_path)
+{
+ // catch the abort signal to make proper cleanup
+ signal (15, catch_sigterm);
+
+ struct fp_print_data *enrolled_print = NULL;
+ int r;
+
+ struct fp_dscv_dev *ddev;
+ struct fp_dscv_dev **discovered_devs;
+ struct fp_dev *dev;
+
+ r = fp_init();
+ if (r < 0) {
+ y2error("Failed to initialize libfprint");
+ r = INIT_FAILED;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+
+ discovered_devs = fp_discover_devs();
+ if (!discovered_devs) {
+ y2error("Could not discover devices");
+ instance().finalize ();
+ r = NO_DEVICES;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+
+ ddev = discovered_devs[0];
+
+ if (!ddev) {
+ y2error("No devices detected.");
+ instance().finalize ();
+ r = NO_DEVICES;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+
+ /*
+ struct fp_driver *drv;
+ drv = fp_dscv_dev_get_driver(ddev);
+ y2milestone ("Found device claimed by %s driver",
+ fp_driver_get_full_name(drv));
+ */
+
+ dev = fp_dev_open(ddev);
+ fp_dscv_devs_free(discovered_devs);
+ if (!dev) {
+ y2error("Could not open device.");
+ instance().finalize ();
+ r = DEVICE_OPEN_FAILED;
+ write (write_fd, &r, sizeof(int));
+ return r;
+ }
+
+ y2milestone ("Device opened successfully.");
+
+ /* TODO how to pass the info about stages number to the parent?
+ y2milestone ("You will need to successfully scan your finger %d times to "
+ "complete the process.", fp_dev_get_nr_enroll_stages (dev));
+ */
+
+ do {
+ sleep (1);
+
+ r = fp_enroll_finger (dev, &enrolled_print);
+
+ y2internal ("retval: %d", r);
+
+ if (r < 0) {
+ y2error ("Enroll failed with error %d", r);
+ instance().finalize ();
+ signal (15, SIG_DFL);
+ return ENROLL_FAILURE;
+ }
+
+ if (write (write_fd, &r, sizeof (int)) == -1)
+ y2error ("write to pipe failed: %d (%m)", errno);
+
+
+ switch (r) {
+ case FP_ENROLL_COMPLETE:
+ y2milestone ("Enroll complete!");
+ break;
+ case FP_ENROLL_FAIL:
+ y2error ("Enroll failed, something wen't wrong :(");
+ instance().finalize ();
+ signal (15, SIG_DFL);
+ return ENROLL_FAILURE;
+ case FP_ENROLL_PASS:
+ break;
+ case FP_ENROLL_RETRY:
+ break;
+ case FP_ENROLL_RETRY_TOO_SHORT:
+ break;
+ case FP_ENROLL_RETRY_CENTER_FINGER:
+ break;
+ case FP_ENROLL_RETRY_REMOVE_FINGER:
+ break;
+ }
+ } while (r != FP_ENROLL_COMPLETE);
+
+ if (!enrolled_print) {
+ y2error ("Enroll complete but print is null");
+ r = ENROLL_FAILURE;
+ }
+ else {
+ // set the HOME to temporary path we know from argument
+ setenv ("HOME", dir_path.c_str(), 1);
+ data = enrolled_print;
+ int save_r = fp_print_data_save (data, RIGHT_INDEX);
+ if (save_r < 0)
+ {
+ y2error ("Data save failed with %d", r);
+ r = save_r;
+ }
+ y2milestone ("Enrollment completed, exiting with %d", r);
+ }
+
+ instance().finalize ();
+ signal (15, SIG_DFL);
+ return r;
+}
+
+/**
+ * Dir
+ */
+YCPList FPrintAgent::Dir(const YCPPath& path)
+{
+ y2error("Wrong path '%s' in Dir().", path->toString().c_str());
+ return YCPNull();
+}
+
+/**
+ * Read
+ */
+YCPValue FPrintAgent::Read(const YCPPath &path, const YCPValue& arg, const YCPValue& opt) {
+
+ y2internal ("Path in Read(): %s", path->toString().c_str());
+ YCPValue ret = YCPVoid();
+
+ if (path->length() == 0) {
+ ret = YCPString("0");
+ }
+ else if (path->length() == 1) {
+
+ if (PC(0) == "error") {
+ // return the last error message
+ ret = YCPString ("error_message");
+ }
+ else if (PC(0) == "state") {
+ YCPMap retmap;
+ if (child_pid == -1)
+ {
+ y2error ("FPrint not initialized yet!");
+ return ret;
+ }
+ int state;
+ size_t size = sizeof (int);
+ int retval = read (data_pipe[0], &state, size);
+ if (retval == -1)
+ {
+ if (errno != EINTR && errno != EAGAIN)
+ y2error ("error reading from pipe: %d (%m)", errno);
+ }
+ else if (retval == size) {
+ if (state == INIT_FAILED ||
+ state == NO_DEVICES || state == DEVICE_OPEN_FAILED)
+ {
+ y2warning ("some initialization failed (%d)...", state);
+ return ret;
+ }
+ retmap->add (YCPString ("state"), YCPInteger (state));
+ }
+ else if (retval == 0)
+ {
+ // check if child is still alive
+ int status;
+ if (waitpid (-1, &status, WNOHANG) != 0)
+ {
+ if (WIFSIGNALED (status))
+ {
+ y2error ("child process was killed");
+ child_pid = -1;
+ return ret;
+ }
+ if (WIFEXITED (status))
+ {
+ child_retval = WEXITSTATUS (status);
+ child_pid = -1;
+ return ret;
+ }
+ }
+ }
+ return retmap;
+ }
+ // check if child process exited
+ else if (PC(0) == "check_exit" ) {
+ int status;
+ ret = YCPBoolean (false);
+ if (child_pid != -1)
+ {
+ if (waitpid (child_pid, &status, WNOHANG) != 0)
+ {
+ child_pid = -1;
+ ret = YCPBoolean (true);
+ if (WIFSIGNALED (status))
+ {
+ y2error ("child process was killed");
+ }
+ if (WIFEXITED (status))
+ {
+ child_retval = WEXITSTATUS (status);
+ }
+ }
+ }
+ else
+ {
+ y2milestone ("child process already exited");
+ ret = YCPBoolean (true);
+ }
+ }
+ // wait for child exit if it still not exited (do not use this part)
+ // return child exit value
+ else if (PC(0) == "exit_status" ) {
+ int status;
+ int retval = 255;
+ if (child_pid != -1)
+ {
+ wait (&status);
+ if (WIFSIGNALED (status))
+ y2milestone ("child process was killed");
+ else if (WIFEXITED (status))
+ {
+ retval = WEXITSTATUS (status);
+ y2milestone ("retval is %d", retval);
+ }
+ }
+ else
+ {
+ y2milestone ("child process already exited");
+ if (child_retval)
+ retval = child_retval;
+ child_retval = -1;
+ }
+ ret = YCPInteger (retval);
+ close (data_pipe[0]); // close FD for reading
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ }
+ else {
+ y2error ("Unknown path in Read(): %s", path->toString().c_str());
+ }
+ return ret;
+}
+
+
+/**
+ * Write - nothing to do
+ */
+YCPBoolean FPrintAgent::Write(const YCPPath &path, const YCPValue& value,
+ const YCPValue& arg)
+{
+ return YCPBoolean(false);
+}
+
+/**
+ * Execute(.fprint.enroll) is action to acquire fingerprint
+ */
+YCPValue FPrintAgent::Execute(const YCPPath &path, const YCPValue& val, const YCPValue& arg)
+{
+ y2milestone ("Path in Execute(): %s", path->toString().c_str());
+ YCPValue ret = YCPBoolean(false);
+
+ if (path->length() == 1) {
+
+ if (PC(0) == "cancel") {
+ y2milestone ("terminanting child process with pid %d", child_pid);
+ if (child_pid)
+ {
+ if (kill (child_pid, 15) != -1)
+ {
+ sleep (3);
+ int status;
+ if (waitpid (-1, &status, WNOHANG) == 0)
+ {
+ y2milestone ("... still alive, killing it");
+ kill (child_pid, 9);
+ wait (&status);
+ }
+ child_pid = -1;
+ }
+ else
+ {
+ y2error ("error while killing: %d (%m)", errno);
+ }
+ }
+ ret = YCPBoolean (true);
+ }
+ /**
+ * parameter is whole path to target bir file, e.g.
+ * /tmp/YaST-123-456/hh.bir
+ */
+ else if (PC(0) == "enroll") {
+ string path;
+ if (!val.isNull())
+ {
+ path = val->asString()->value();
+ }
+ else
+ {
+ y2error ("path to tmp directory is missing");
+ return ret;
+ }
+ if (pipe (data_pipe) == -1) {
+ y2error ("pipe creation failed");
+ return ret;
+ }
+
+ long arg;
+ arg = fcntl (data_pipe[0], F_GETFL);
+ if (fcntl (data_pipe[0], F_SETFL, arg | O_NONBLOCK ) < 0)
+ {
+ y2error ("Couldn't set O_NONBLOCK: errno=%d: %m", errno);
+ close (data_pipe[0]);
+ close (data_pipe[1]);
+ return ret;
+ }
+ child_pid = fork ();
+ if (child_pid == -1)
+ {
+ y2error ("fork failed");
+ return ret;
+ }
+ else if (child_pid == 0)
+ {
+ close (data_pipe[0]); // close the read-only FD
+ int state =
+ FPrintAPI::instance().acquire (data_pipe[1], path);
+ y2milestone ("acquire done with state %d", state);
+ close (data_pipe[1]);
+ _exit (state);
+ }
+ else // parent -> return
+ {
+ close (data_pipe[1]); // close FD for writing
+ ret = YCPBoolean(true);
+ }
+ }
+ }
+ return ret;
+}
+
+/**
+ * otherCommand
+ */
+YCPValue FPrintAgent::otherCommand(const YCPTerm& term)
+{
+ string sym = term->name();
+
+ if (sym == "FPrintAgent") {
+
+ return YCPVoid();
+ }
+
+ return YCPNull();
+}
+
Added: branches/tmp/jsuchome/snapper/agent-snapper/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/src/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/src/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1,24 @@
+
+# Makefile.am for .../agent-snapper/src
+#
+
+AM_CXXFLAGS = -DY2LOG=\"agent-snapper\" -Wall
+
+plugin_LTLIBRARIES = libpy2ag_snapper.la
+noinst_LTLIBRARIES = liby2ag_snapper.la
+
+liby2ag_snapper_la_SOURCES = \
+ SnapperAgent.cc \
+ SnapperAgent.h
+liby2ag_snapper_la_LDFLAGS = -version-info 2:0
+liby2ag_snapper_la_LIBADD = @AGENT_LIBADD@ -lsnapper
+
+
+libpy2ag_snapper_la_SOURCES = \
+ $(liby2ag_snapper_la_SOURCES) \
+ Y2CCSnapperAgent.cc
+libpy2ag_snapper_la_LDFLAGS = -version-info 2:0
+libpy2ag_snapper_la_LIBADD = @AGENT_LIBADD@ -lsnapper
+
+
+INCLUDES = -I$(includedir)
Added: branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.cc Wed Feb 2 15:56:01 2011
@@ -0,0 +1,150 @@
+/* SnapperAgent.cc
+ *
+ * An agent for accessing snapper library
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id: SnapperAgent.cc 63174 2011-01-13 10:50:42Z jsuchome $
+ */
+
+#include "SnapperAgent.h"
+#include
+
+#define PC(n) (path->component_str(n))
+
+using namespace snapper;
+
+/*
+ * search the map for value of given key; both key and value have to be strings
+ */
+string SnapperAgent::getValue (const YCPMap map, const string key)
+{
+ if (!map->value(YCPString(key)).isNull()
+ && map->value(YCPString(key))->isString())
+ return map->value(YCPString(key))->asString()->value();
+ else
+ return "";
+}
+
+/**
+ * Constructor
+ */
+SnapperAgent::SnapperAgent() : SCRAgent()
+{
+}
+
+/**
+ * Destructor
+ */
+SnapperAgent::~SnapperAgent()
+{
+}
+
+
+/**
+ * Dir
+ */
+YCPList SnapperAgent::Dir(const YCPPath& path)
+{
+ y2error("Wrong path '%s' in Read().", path->toString().c_str());
+ return YCPNull();
+}
+
+/**
+ * Read
+ */
+YCPValue SnapperAgent::Read(const YCPPath &path, const YCPValue& arg, const YCPValue& opt) {
+
+ y2internal ("path in Read: '%s'.", path->toString().c_str());
+ YCPValue ret = YCPVoid();
+
+ YCPMap argmap;
+ if (!arg.isNull() && arg->isMap())
+ argmap = arg->asMap();
+
+ if (path->length() == 1) {
+
+ /**
+ * error: Read(.snapper.error) -> returns last error message
+ */
+ if (PC(0) == "error") {
+ YCPMap retmap;
+ return retmap;
+ }
+ /*
+ if (PC(0) == "status") {
+ YCPMap retmap;
+ string name = getValue (argmap, "name");
+ unsigned int status = getStatus (name, CMP_PRE_TO_POST);
+ y2internal ("status of '%s': '%d'.", name.c_str(), status);
+ return retmap;
+ }
+ */
+ /**
+ * Read(.snapper.snapshots) -> return list of snapshot description maps
+ */
+ if (PC(0) == "snapshots") {
+ YCPList retlist;
+ snapshots.assertInit();
+ for (vector<Snapshot>::const_iterator it = snapshots.begin(); it != snapshots.end(); ++it)
+ {
+ YCPMap s;
+ s->add (YCPString ("date"), YCPString (it->date));
+ s->add (YCPString ("description"), YCPString (it->description));
+ s->add (YCPString ("num"), YCPInteger (it->num));
+ y2internal ("snapshot date %s, desc %s num %d", it->date.c_str (), it->description.c_str (), it->num);
+ retlist->add (s);
+ }
+ return retlist;
+ }
+ else {
+ y2error("Wrong path '%s' in Read().", path->toString().c_str());
+ }
+ }
+ else if (path->length() == 2) {
+
+ y2error("Wrong path '%s' in Read().", path->toString().c_str());
+ }
+ else {
+ y2error("Wrong path '%s' in Read().", path->toString().c_str());
+ }
+ return YCPVoid();
+}
+
+/**
+ * Write
+ */
+YCPBoolean SnapperAgent::Write(const YCPPath &path, const YCPValue& arg,
+ const YCPValue& arg2)
+{
+ y2internal ("path in Write: '%s'.", path->toString().c_str());
+
+ YCPBoolean ret = YCPBoolean(true);
+ return ret;
+}
+
+/**
+ * Execute
+ */
+YCPValue SnapperAgent::Execute(const YCPPath &path, const YCPValue& arg,
+ const YCPValue& arg2)
+{
+ y2internal ("path in Execute: '%s'.", path->toString().c_str());
+ YCPValue ret = YCPBoolean (true);
+ return ret;
+}
+
+/**
+ * otherCommand
+ */
+YCPValue SnapperAgent::otherCommand(const YCPTerm& term)
+{
+ string sym = term->name();
+
+ if (sym == "SnapperAgent") {
+ /* Your initialization */
+ return YCPVoid();
+ }
+
+ return YCPNull();
+}
Added: branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.h?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.h (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/src/SnapperAgent.h Wed Feb 2 15:56:01 2011
@@ -0,0 +1,80 @@
+/* SnapperAgent.h
+ *
+ * Snapper agent implementation
+ *
+ * Authors: Jiri Suchomel
+ *
+ * $Id: SnapperAgent.h 63174 2011-01-13 10:50:42Z jsuchome $
+ */
+
+#ifndef _SnapperAgent_h
+#define _SnapperAgent_h
+
+#include
+#include
+
+#include
+#include
+
+/**
+ * @short An interface class between YaST2 and Snapper Agent
+ */
+class SnapperAgent : public SCRAgent
+{
+private:
+ /**
+ * Agent private variables and methods
+ */
+
+ /**
+ * search the map for value of given key; both key and value have to be strings
+ * when key is not present, empty string is returned
+ */
+ string getValue (const YCPMap map, const string key);
+
+public:
+ /**
+ * Default constructor.
+ */
+ SnapperAgent();
+
+ /**
+ * Destructor.
+ */
+ virtual ~SnapperAgent();
+
+ /**
+ * Provides SCR Read ().
+ * @param path Path that should be read.
+ * @param arg Additional parameter.
+ */
+ virtual YCPValue Read ( const YCPPath &path,
+ const YCPValue& arg = YCPNull(),
+ const YCPValue& opt = YCPNull());
+
+ /**
+ * Provides SCR Write ().
+ */
+ virtual YCPBoolean Write(const YCPPath &path,
+ const YCPValue& arg,
+ const YCPValue& arg2 = YCPNull());
+
+ /**
+ * Provides SCR Execute ().
+ */
+ virtual YCPValue Execute(const YCPPath &path,
+ const YCPValue& arg = YCPNull(),
+ const YCPValue& arg2 = YCPNull());
+
+ /**
+ * Provides SCR Dir ().
+ */
+ virtual YCPList Dir(const YCPPath& path);
+
+ /**
+ * Used for mounting the agent.
+ */
+ virtual YCPValue otherCommand(const YCPTerm& term);
+};
+
+#endif /* _SnapperAgent_h */
Added: branches/tmp/jsuchome/snapper/agent-snapper/src/Y2CCSnapperAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/src/Y2CCSnapperAgent.cc?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/src/Y2CCSnapperAgent.cc (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/src/Y2CCSnapperAgent.cc Wed Feb 2 15:56:01 2011
@@ -0,0 +1,14 @@
+/* Y2CCSnapperAgent.cc
+ *
+ * Authors: Jiri Suchomel
+ *
+ */
+
+#include
+#include
+
+#include "SnapperAgent.h"
+
+typedef Y2AgentComp <SnapperAgent> Y2SnapperAgentComp;
+
+Y2CCAgentComp <Y2SnapperAgentComp> g_y2ccag_snapper ("ag_snapper");
Added: branches/tmp/jsuchome/snapper/agent-snapper/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/agent-snapper/testsuite/Makefile.am?rev=63306&view=auto
==============================================================================
--- branches/tmp/jsuchome/snapper/agent-snapper/testsuite/Makefile.am (added)
+++ branches/tmp/jsuchome/snapper/agent-snapper/testsuite/Makefile.am Wed Feb 2 15:56:01 2011
@@ -0,0 +1,8 @@
+#
+# Makefile.am for .../agent-snapper/testsuite
+#
+
+AUTOMAKE_OPTIONS = dejagnu
+
+clean-local:
+ rm -f tmp.err.* tmp.out.* site.exp site.bak
Modified: branches/tmp/jsuchome/snapper/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/configure.in.in?rev=63306&r1=63305&r2=63306&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/configure.in.in (original)
+++ branches/tmp/jsuchome/snapper/configure.in.in Wed Feb 2 15:56:01 2011
@@ -3,10 +3,13 @@
## Initialize
@YAST2-INIT-COMMON@
@YAST2-INIT-YCP@
+@YAST2-INIT-PROGRAM@
## some common checks
@YAST2-CHECKS-COMMON@
@YAST2-CHECKS-YCP@
+@YAST2-CHECKS-PROGRAM@
+
## and generate the output...
@YAST2-OUTPUT@
Modified: branches/tmp/jsuchome/snapper/package/yast2-snapper.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/package/yast2-snapper.changes?rev=63306&r1=63305&r2=63306&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/package/yast2-snapper.changes (original)
+++ branches/tmp/jsuchome/snapper/package/yast2-snapper.changes Wed Feb 2 15:56:01 2011
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Wed Feb 2 15:55:03 CET 2011 - jsuchome@suse.cz
+
+- added scr agent to access snapper library
+
+-------------------------------------------------------------------
Mon Dec 13 18:51:43 2010 - jsuchome@suse.cz
- initial version
Modified: branches/tmp/jsuchome/snapper/yast2-snapper.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jsuchome/snapper/yast2-snapper.spec.in?rev=63306&r1=63305&r2=63306&view=diff
==============================================================================
--- branches/tmp/jsuchome/snapper/yast2-snapper.spec.in (original)
+++ branches/tmp/jsuchome/snapper/yast2-snapper.spec.in Wed Feb 2 15:56:01 2011
@@ -2,7 +2,7 @@
@HEADER@
Requires: yast2
-BuildRequires: perl-XML-Writer update-desktop-files yast2 yast2-devtools yast2-testsuite
+BuildRequires: update-desktop-files yast2 yast2-devtools yast2-testsuite libsnapper libsnapper-devel
BuildArchitectures: noarch
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org