commit yast2-core for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-core for openSUSE:Factory checked in at Mon Jun 29 16:33:29 CEST 2009. -------- --- yast2-core/yast2-core.changes 2009-06-15 18:19:51.000000000 +0200 +++ yast2-core/yast2-core.changes 2009-06-19 15:49:08.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Jun 19 14:14:13 CEST 2009 - mvidner@suse.cz + +- float::tolstring fixed to use the fixed notation +- 2.18.14 + +------------------------------------------------------------------- +Thu Jun 18 16:59:49 CEST 2009 - lslezak@suse.cz + +- DBus service - fixed returning "any" values (bnc#513503), + return correct signatures in DBus introspection data, return the + values according to it (bnc#513571), added basic testuite + +------------------------------------------------------------------- +Wed Jun 17 13:53:30 CEST 2009 - mvidner@suse.cz + +- DBusServerBase: exit properly if the connection got closed + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- yast2-core-2.18.13.tar.bz2 New: ---- yast2-core-2.18.14.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-core.spec ++++++ --- /var/tmp/diff_new_pack.Hz1648/_old 2009-06-29 16:30:43.000000000 +0200 +++ /var/tmp/diff_new_pack.Hz1648/_new 2009-06-29 16:30:43.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yast2-core (Version 2.18.13) +# spec file for package yast2-core (Version 2.18.14) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,12 +19,12 @@ Name: yast2-core -Version: 2.18.13 +Version: 2.18.14 Release: 1 -License: GPL v2 or later +License: GPL Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-core-2.18.13.tar.bz2 +Source0: yast2-core-2.18.14.tar.bz2 Prefix: /usr # obviously BuildRequires: gcc-c++ @@ -46,7 +46,7 @@ # libycp includes crypto built-ins BuildRequires: libxcrypt-devel # for SCR DBus service -BuildRequires: PolicyKit-devel dbus-1-devel +BuildRequires: PolicyKit-devel dbus-1-devel dbus-1-x11 Summary: YaST2 - Core Libraries Requires: perl = %{perl_version} Provides: liby2util = 2.16.1 @@ -56,20 +56,11 @@ This package contains the scanner, parser, and interpreter runtime library for the YCP scripting language used in YaST2. - - -Authors: --------- - Arvin Schnell <arvin@suse.de> - Klaus Kaempf <kkaempf@suse.de> - Mathias Kettner <kettner@suse.de> - Stefan Hundhammer <sh@suse.de> - %package devel -License: GPL v2 or later +License: GPL Requires: yast2-core = %version -Group: Development/Libraries/YaST -Summary: YaST2 - Include Files and Documentation for Core Libraries +Group: Development/Libraries +Summary: YaST2 - Core Libraries Provides: liby2util-devel = 2.16.1 Obsoletes: liby2util-devel < 2.16.1 Requires: libxcrypt-devel hwinfo-devel @@ -84,20 +75,11 @@ This package contains include and documentation files for developing applications using the YaST2 YCP interpreter. - - -Authors: --------- - Arvin Schnell <arvin@suse.de> - Klaus Kaempf <kkaempf@suse.de> - Mathias Kettner <kettner@suse.de> - Stefan Hundhammer <sh@suse.de> - Stanislav Visnovsky <visnov@suse.cz> - %prep -%setup -n yast2-core-2.18.13 +%setup -n yast2-core-2.18.14 %build +export SUSE_ASNEEDED=0 %{prefix}/bin/y2tool y2autoconf %{prefix}/bin/y2tool y2automake autoreconf --force --install ++++++ yast2-core-2.18.13.tar.bz2 -> yast2-core-2.18.14.tar.bz2 ++++++ ++++ 2412 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/agent-system/src/SystemAgent.cc new/yast2-core-2.18.14/agent-system/src/SystemAgent.cc --- old/yast2-core-2.18.13/agent-system/src/SystemAgent.cc 2009-04-10 09:50:28.000000000 +0200 +++ new/yast2-core-2.18.14/agent-system/src/SystemAgent.cc 2009-06-18 10:24:56.000000000 +0200 @@ -7,7 +7,7 @@ * Michal Svec <msvec@suse.cz> * Petr Blahos <pblahos@suse.cz> * - * $Id: SystemAgent.cc 54455 2009-01-07 16:34:16Z aschnell $ + * $Id: SystemAgent.cc 57633 2009-06-18 08:24:56Z mvidner $ */ #include "config.h" @@ -63,7 +63,7 @@ * @param path path to remove * @param depth max. depth */ -static const void +static void remove_directory (const string& path, int depth) { struct stat buf; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/configure.in new/yast2-core-2.18.14/configure.in --- old/yast2-core-2.18.13/configure.in 2009-06-15 18:10:10.000000000 +0200 +++ new/yast2-core-2.18.14/configure.in 2009-06-22 08:02:47.000000000 +0200 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 2.18.5 - DO NOT EDIT! -- dnl (edit configure.in.in instead) -AC_INIT(yast2-core, 2.18.13, http://bugs.opensuse.org/, yast2-core) +AC_INIT(yast2-core, 2.18.14, http://bugs.opensuse.org/, yast2-core) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="2.18.13" +VERSION="2.18.14" RPMNAME="yast2-core" MAINTAINER="Martin Vidner <mvidner@suse.cz>" @@ -477,6 +477,8 @@ dbus/SCR_service/Makefile dbus/namespace_service/src/Makefile dbus/namespace_service/doc/Makefile +dbus/namespace_service/testsuite/modules/Makefile +dbus/namespace_service/testsuite/Makefile dbus/namespace_service/Makefile dbus/Makefile) AC_OUTPUT diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/Makefile.am new/yast2-core-2.18.14/dbus/namespace_service/Makefile.am --- old/yast2-core-2.18.13/dbus/namespace_service/Makefile.am 2009-04-10 09:50:43.000000000 +0200 +++ new/yast2-core-2.18.14/dbus/namespace_service/Makefile.am 2009-06-17 11:10:45.000000000 +0200 @@ -2,4 +2,4 @@ # Makefile.am for core/dbus/namespace_service # -SUBDIRS=src doc +SUBDIRS=src doc testsuite diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/src/DBusModulesServer.cc new/yast2-core-2.18.14/dbus/namespace_service/src/DBusModulesServer.cc --- old/yast2-core-2.18.13/dbus/namespace_service/src/DBusModulesServer.cc 2009-05-14 15:06:13.000000000 +0200 +++ new/yast2-core-2.18.14/dbus/namespace_service/src/DBusModulesServer.cc 2009-06-19 14:50:43.000000000 +0200 @@ -1,4 +1,3 @@ - /* DBus server @@ -23,6 +22,7 @@ #include "yast_dbus_names.h" + void DBusModulesServer::init_wfm() { if (Y2WFMComponent::instance() == NULL) @@ -114,17 +114,31 @@ DBusSignature sig_marshalled; DBusSignature sig_raw; + bool params_ok_raw = true; - // add return type - std::string rett(Y2Dtype(rettype)); + std::string rett; - if (!rett.empty()) + try + { + // add return type + rett = DBusMsg::YCPTypeSignature(rettype); + } + catch (const SignatureException &excpt) { - sig_raw.retval = DBusArgument("ret", rett); + y2error("Ignoring function %s::%s in raw interface, unsupported return type: %s", nspace.c_str(), fname, rettype->toString().c_str()); + params_ok_raw = false; } - // TODO FIXME void() ? - sig_marshalled.retval = DBusArgument("ret", "(bsv)"); + // check void() + if (!rettype->isVoid() && !rettype->isNil()) + { + if (params_ok_raw) + { + sig_raw.retval = DBusArgument("ret", rett); + } + + sig_marshalled.retval = DBusArgument("ret", "(bsv)"); + } // add parameter types int params = fptr->parameterCount(); @@ -132,20 +146,20 @@ DBusSignature::Params p_marshalled; DBusSignature::Params p_raw; - bool params_ok_raw = true; while(parindex < params) { - std::string partype_raw(Y2Dtype(fptr->parameterType(parindex))); - - if (!partype_raw.empty()) + try { + std::string partype_raw(DBusMsg::YCPTypeSignature(fptr->parameterType(parindex))); + DBusArgument param("param", partype_raw); p_raw.push_back(param); } - else + catch (const SignatureException &excpt) { - y2warning("Function %s is not exported due to an unsupported parameter type", fname); + y2warning("Function %s::%s is not exported due to an unsupported type of parameter number %d", + nspace.c_str(), fname, parindex); params_ok_raw = false; } @@ -215,7 +229,12 @@ } -DBusModulesServer::DBusModulesServer(const NameSpaceList &name_spaces) : e(this), manager_callback(this), wfm(NULL) +DBusModulesServer::DBusModulesServer(const NameSpaceList &name_spaces, bool test_mode) + : DBusServerBase(test_mode) + , e(this) + , manager_callback(this) + , wfm(NULL) + , m_test_mode(test_mode) { init_wfm(); @@ -256,33 +275,6 @@ register_method(YAST_DBUS_OBJ_PREFIX, YAST_DBUS_MGR_INTERFACE, YAST_DBUS_MANAGER_LOCK_METHOD, void_sig, manager_callback); } -std::string DBusModulesServer::Y2Dtype(constTypePtr type) const -{ - YCPValueType vt = type->valueType(); - std::string ret; - - switch (vt) - { - case(YT_VOID) : ret = ""; break; - case(YT_BOOLEAN) : ret = DBUS_TYPE_BOOLEAN_AS_STRING; break; - case(YT_INTEGER) : ret = DBUS_TYPE_INT64_AS_STRING; break; - case(YT_FLOAT) : ret = DBUS_TYPE_DOUBLE_AS_STRING; break; - case(YT_STRING) : ret = DBUS_TYPE_STRING_AS_STRING; break; - case(YT_PATH) : ret = DBUS_TYPE_STRING_AS_STRING; break; - case(YT_SYMBOL) : ret = DBUS_TYPE_STRING_AS_STRING; break; - case(YT_LIST) : ret = DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_VARIANT_AS_STRING; break; /* av */ - case(YT_MAP) : ret = DBUS_TYPE_ARRAY_AS_STRING - DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING - DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING; break; /* a{sv} */ - case(YT_TERM) : ret = DBUS_TYPE_STRING_AS_STRING; break; -// case(YT_CODE) : ret = DBUS_TYPE_STRING_AS_STRING; break; - - default : y2warning("Value type %d is not supported", vt); break; - } - - return ret; -} - constTypePtr DBusModulesServer::searchFuncType(const std::string &objname, const std::string &fname) const { if (nsmap.find(objname) == nsmap.end()) @@ -326,7 +318,8 @@ bool DBusModulesServer::connect() { registerManager(); - return DBusServerBase::connect(SYSTEM, YAST_DBUS_SERVICE_NAME); + return DBusServerBase::connect(m_test_mode ? SESSION : SYSTEM, + YAST_DBUS_SERVICE_NAME); } /* @@ -409,6 +402,7 @@ y2debug("Requested object: %s, interface: %s, method: %s", object.c_str(), interface.c_str(), method.c_str()); constTypePtr t = searchFuncType(object, method); + constTypePtr rettype = NULL; if (t) { @@ -416,6 +410,8 @@ if (fptr) { + rettype = fptr->returnType(); + int reqarg = fptr->parameterCount(); if (request.arguments() == reqarg) @@ -524,7 +520,7 @@ if (interface == YAST_DBUS_RAW_INTERFACE) { y2debug("Returning direct DBus value"); - reply.addValue(ret); + reply.addValueAs(ret, rettype); } else { @@ -552,7 +548,7 @@ y2milestone("ModuleManager request: object: %s, method: %s, interface: %s", object.c_str(), method.c_str(), interface.c_str()); - YCPValue ret; + reply.createReply(request); if (object == YAST_DBUS_OBJ_PREFIX) { @@ -573,18 +569,20 @@ if (arg->isString()) { std::string required_namespace(arg->asString()->value()); + bool ret; NameSpaceMap::const_iterator nsiter = nsmap.find(required_namespace); if (nsiter != nsmap.end()) { - ret = YCPBoolean(true); + ret = true; } else { - bool retval = importNamespace(arg->asString()->value()); - - ret = YCPBoolean(retval); + ret = importNamespace(arg->asString()->value()); } + + y2milestone("Result: %s", ret ? "true" : "false"); + reply.addBoolean(ret); } else { @@ -609,14 +607,6 @@ } } - reply.createReply(request); - - if (!ret.isNull()) - { - y2milestone("Result: %s", ret->toString().c_str()); - reply.addValue(ret); - } - return reply; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/src/DBusModulesServer.h new/yast2-core-2.18.14/dbus/namespace_service/src/DBusModulesServer.h --- old/yast2-core-2.18.13/dbus/namespace_service/src/DBusModulesServer.h 2009-04-10 09:50:43.000000000 +0200 +++ new/yast2-core-2.18.14/dbus/namespace_service/src/DBusModulesServer.h 2009-06-18 16:44:22.000000000 +0200 @@ -1,4 +1,3 @@ - /* DBusModulesServer.h */ @@ -25,7 +24,7 @@ typedef std::list<std::string> NameSpaceList; - DBusModulesServer(const NameSpaceList &name_spaces); + DBusModulesServer(const NameSpaceList &name_spaces, bool test_mode); virtual ~DBusModulesServer(); virtual bool connect(); @@ -95,8 +94,9 @@ Y2Component *wfm; void init_wfm(); + + bool m_test_mode; }; #endif - diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/src/yast_modules_dbus_server.cc new/yast2-core-2.18.14/dbus/namespace_service/src/yast_modules_dbus_server.cc --- old/yast2-core-2.18.13/dbus/namespace_service/src/yast_modules_dbus_server.cc 2009-04-10 09:50:43.000000000 +0200 +++ new/yast2-core-2.18.14/dbus/namespace_service/src/yast_modules_dbus_server.cc 2009-06-18 16:44:22.000000000 +0200 @@ -1,4 +1,3 @@ - /* */ @@ -12,6 +11,7 @@ bool forever = false; bool badopts = false; + bool test_mode = false; DBusModulesServer::NameSpaceList modules; @@ -29,6 +29,10 @@ { forever = true; } + else if (!strcmp(argv[index], "--test")) + { + test_mode = true; + } else { modules.push_back(argv[index]); @@ -40,14 +44,16 @@ if (badopts) { - std::cerr << "Usage: " << argv[0] << " [--help] [--disable-timer] <namespace> <namespace>..." << std::endl; + std::cerr << "Usage: " << argv[0] << " [--help] [--disable-timer] [--session] <namespace> <namespace>..." << std::endl; std::cerr << " --help Print this text\n"; std::cerr << " --disable-timer Disable automatic shutdown of the service, useful for debugging\n"; + std::cerr << " --test Set the test mode - Connect to the session bus (system is the default),\n"; + std::cerr << " disable PolicyKit checks. Useful for testing or debugging.\n"; std::cerr << " <namespace> Preload an yast namespace and export it on DBus\n"; return 1; } - DBusModulesServer server(modules); + DBusModulesServer server(modules, test_mode); bool connected = server.connect(); if (connected) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/Makefile.am new/yast2-core-2.18.14/dbus/namespace_service/testsuite/Makefile.am --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/Makefile.am 2009-06-18 19:24:31.000000000 +0200 @@ -0,0 +1,8 @@ +# adhoc testing, TODO use a decent framework (dejagnu does not qualify) +TESTS = t1 + +SUBDIRS = modules + +EXTRA_DIST = $(wildcard *.test) t1 + +CLEANFILES = $(wildcard *.test.reply) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/modules/Makefile.am new/yast2-core-2.18.14/dbus/namespace_service/testsuite/modules/Makefile.am --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/modules/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/modules/Makefile.am 2009-06-18 19:24:31.000000000 +0200 @@ -0,0 +1,13 @@ + +yast_modules = TEST.ycp + +EXTRA_DIST = $(yast_modules) + +yast_modules_ybc = $(yast_modules:.ycp=.ybc) + +$(yast_modules_ybc): $(yast_modules) + ../../../../base/tools/ycpc/ycpc -c $< + +all: $(yast_modules_ybc) + +CLEANFILES = $(wildcard *.ybc) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/modules/TEST.ycp new/yast2-core-2.18.14/dbus/namespace_service/testsuite/modules/TEST.ycp --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/modules/TEST.ycp 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/modules/TEST.ycp 2009-06-18 16:44:22.000000000 +0200 @@ -0,0 +1,81 @@ + +// This is a testing module for the YaST DBuse service +// Some methods are not called during tests, but the correct signature is checked in the introspection test + +{ + +module "TEST"; + +global define list List() +{return [];} + +global define list<any> ListAny() +{return [];} + +global define list ListAny1() +{return [1, "string"];} + +global define list ListAny2() +{return [["dssd", 123], ["zxcxczzx", 456]];} + +global define list<string> ListString() +{return ["dssd", "sdfdfs"];} + +global define list<list<string> > ListListString() +{return [["dssd", "sdfdfs"], ["zxcxczzx"]];} + +global define list<map> ListMap() +{return [];} + +global define list<map<string, string> > ListMapStringString() +{return [];} + +global define list<map<string, any> > ListMapStringAny() +{return [ $["a" : "b"], $["c" : [10, 20, "haha", `Symbol]]];} + +global define map<string, any> MapStringAny() +{return $[];} + +global define map<string, string> MapStringString() +{return $[];} + +global define map<string, list<string> > MapStringListString() +{return $[];} + +global define string String() +{return "a";} + +global define any Any() +{return "a";} + +global define any Any2() +{return ["a"];} + +global define integer Integer() +{return 10;} + +global define symbol Symbol() +{return `s;} + +global define map MapAny() +{return $[ ];} + +global define map MapAny2() +{return $[ "3" : "l" ];} + +global define map MapAny3() +{return $[ "3" : ["l", "3"] ];} + +global define map MapAny4() +{return $[ "3" : $["l" : ["3", 10, $["a" : "b"]]]];} + +// Note: interger key is returned as string in map<any,X> type, +// map<interger,X> must be used to return int, +// Dbus requires a basic type as key, a variant cannot be sent +global define map MapAny5() +{return $[ 3 : 4, "4" : "5" ];} + +global define void Void() +{return;} + +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test 2009-06-18 15:25:17.000000000 +0200 @@ -0,0 +1,61 @@ + string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" +"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + +<node> + <interface name='org.freedesktop.DBus.Introspectable'> + <method name='Introspect'> + <arg name='xml_data' type='s' direction='out'/> + </method> + </interface> + <interface name='org.opensuse.YaST.Values'> + <method name='Any'><arg name='ret' type='v' direction='out'/></method> + <method name='Any2'><arg name='ret' type='v' direction='out'/></method> + <method name='Integer'><arg name='ret' type='x' direction='out'/></method> + <method name='List'><arg name='ret' type='av' direction='out'/></method> + <method name='ListAny'><arg name='ret' type='av' direction='out'/></method> + <method name='ListAny1'><arg name='ret' type='av' direction='out'/></method> + <method name='ListAny2'><arg name='ret' type='av' direction='out'/></method> + <method name='ListListString'><arg name='ret' type='aas' direction='out'/></method> + <method name='ListMap'><arg name='ret' type='aa{sv}' direction='out'/></method> + <method name='ListMapStringAny'><arg name='ret' type='aa{sv}' direction='out'/></method> + <method name='ListMapStringString'><arg name='ret' type='aa{ss}' direction='out'/></method> + <method name='ListString'><arg name='ret' type='as' direction='out'/></method> + <method name='MapAny'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapAny2'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapAny3'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapAny4'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapAny5'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapStringAny'><arg name='ret' type='a{sv}' direction='out'/></method> + <method name='MapStringListString'><arg name='ret' type='a{sas}' direction='out'/></method> + <method name='MapStringString'><arg name='ret' type='a{ss}' direction='out'/></method> + <method name='String'><arg name='ret' type='s' direction='out'/></method> + <method name='Symbol'><arg name='ret' type='s' direction='out'/></method> + <method name='Void'></method> + </interface> + <interface name='org.opensuse.YaST.YCPValues'> + <method name='Any'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='Any2'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='Integer'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='List'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListAny'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListAny1'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListAny2'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListListString'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListMap'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListMapStringAny'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListMapStringString'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='ListString'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapAny'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapAny2'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapAny3'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapAny4'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapAny5'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapStringAny'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapStringListString'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='MapStringString'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='String'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='Symbol'><arg name='ret' type='(bsv)' direction='out'/></method> + <method name='Void'></method> + </interface> +</node> +" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any2.test new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any2.test --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any2.test 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any2.test 2009-06-18 15:25:17.000000000 +0200 @@ -0,0 +1,3 @@ + variant array [ + variant string "a" + ] diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any.test new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any.test --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any.test 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.Any.test 2009-06-18 15:25:17.000000000 +0200 @@ -0,0 +1 @@ + variant string "a" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.ListMapStringAny.test new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.ListMapStringAny.test --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.ListMapStringAny.test 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.ListMapStringAny.test 2009-06-18 15:25:17.000000000 +0200 @@ -0,0 +1,19 @@ + array [ + array [ + dict entry( + string "a" + variant string "b" + ) + ] + array [ + dict entry( + string "c" + variant array [ + variant int64 10 + variant int64 20 + variant string "haha" + variant string "`Symbol" + ] + ) + ] + ] diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.List.test new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.List.test --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.List.test 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/org.opensuse.YaST.Values.List.test 2009-06-18 15:25:17.000000000 +0200 @@ -0,0 +1,2 @@ + array [ + ] diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/dbus/namespace_service/testsuite/t1 new/yast2-core-2.18.14/dbus/namespace_service/testsuite/t1 --- old/yast2-core-2.18.13/dbus/namespace_service/testsuite/t1 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-core-2.18.14/dbus/namespace_service/testsuite/t1 2009-06-18 16:44:22.000000000 +0200 @@ -0,0 +1,51 @@ +#! /bin/sh + +# A basic test: Does the server return the correct introspection data? +# Do the return values match the signature? + +# It reads *.test files, calls the DBus method with the name of the file, +# the result of the call must match the file content + +# Currently this test checks only return values of functions without parameters. + +# TODO: more tests, probably in python or whatever so that +# the responses can be inspected better + +# This launches the bus daemon, +# exports DBUS_SESSION_BUS_ADDRESS and sets DBUS_SESSION_BUS_PID +eval $(dbus-launch --sh-syntax) +# Clean up at exit. This will also kill the server. +trap "kill $DBUS_SESSION_BUS_PID" EXIT TERM INT + +echo -n "Hey, server, get on da bus... " + +# load the modules from the current directory +export Y2DIR=. + +# start the server, preload TEST.ycp module +PRG="../src/yast_modules_dbus_server --disable-timer --test TEST" +$PRG & sleep 3 +echo "off we go!" + +SEND0="dbus-send --session --dest=org.opensuse.YaST.modules" +CALL="$SEND0 --type=method_call" + +# read al *.test files in the current directory +find . -name '*.test' | while read TESTFILE; do + TESTCALL=`echo "$TESTFILE" | sed -e "s#./\(.*\).test#\1#"` + echo -n "Testing $TESTCALL ... " + # call the DBus method, ignore the first two lines (the header contains non-constant data) + REPLY=`$CALL --print-reply /org/opensuse/YaST/modules/TEST $TESTCALL | tail -n +2 > $TESTFILE.reply` + + # the result with the expected value + if diff -u $TESTFILE $TESTFILE.reply > /dev/null; then + echo "OK" + else + echo "FAILED!" + echo "Diff: " + diff -u $TESTFILE $TESTFILE.reply + exit 1 + fi +done + + diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusConn.cc new/yast2-core-2.18.14/liby2dbus/src/DBusConn.cc --- old/yast2-core-2.18.13/liby2dbus/src/DBusConn.cc 2009-04-10 09:49:56.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusConn.cc 2009-06-18 16:44:22.000000000 +0200 @@ -32,14 +32,14 @@ return true; } - y2milestone("Connecting to DBus..."); + y2milestone("Connecting to DBus (%s bus)...", type == DBUS_BUS_SYSTEM ? "system" : "session"); - // connect to the system bus + // connect to the bus connection = dbus_bus_get(type, &dbus_error); if (dbus_error_is_set(&dbus_error)) { - y2error("Cannot connect to the system bus: %s", dbus_error.message); + y2error("Cannot connect to the bus: %s", dbus_error.message); return false; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusConn.h new/yast2-core-2.18.14/liby2dbus/src/DBusConn.h --- old/yast2-core-2.18.13/liby2dbus/src/DBusConn.h 2009-04-10 09:49:56.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusConn.h 2009-06-17 13:53:46.000000000 +0200 @@ -32,6 +32,7 @@ bool send(const DBusMsg &msg); DBusMsg call(const DBusMsg &msg); void flush(); + // it the msg is empty, there was a timeout DBusMsg receive(); DBusConnection *getConnection() const; }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusMsg.cc new/yast2-core-2.18.14/liby2dbus/src/DBusMsg.cc --- old/yast2-core-2.18.13/liby2dbus/src/DBusMsg.cc 2009-06-15 17:14:47.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusMsg.cc 2009-06-18 15:25:17.000000000 +0200 @@ -224,30 +224,64 @@ return ret; } -bool DBusMsg::addValue(const YCPValue &val) +bool DBusMsg::addValueAs(const YCPValue &val, constTypePtr rettype) { if (val.isNull()) { - y2milestone("Ignoring YCPNull value"); + y2error("Ignoring YCPNull value"); return false; } y2debug("Adding YCP value: %s", val->toString().c_str()); + if (!rettype) + { + // return as the current type if not specified + rettype = Type::vt2type(val->valuetype()); + } + else + { + // the required type does not match the value + if (rettype->matchvalue(val) < 0) + { + y2error("Value %s does not match requested type %s", + val->toString().c_str(), rettype->toString().c_str()); + return false; + } + else + { + y2debug("Requested type matches the value"); + } + } + + // create insert iterator DBusMessageIter it; dbus_message_iter_init_append(msg, &it); // add the value - bool ret = addValueAt(val, &it, false); + bool ret = addValueAt(val, &it, rettype); return ret; } -bool DBusMsg::addValueAt(const YCPValue &val, DBusMessageIter *i, bool bsv_encoding) +bool DBusMsg::addValueAt(const YCPValue &val, DBusMessageIter *i, constTypePtr rtype) { + y2milestone("Returning YCP value as type: %s", rtype->toString().c_str()); + int type = typeInt(val); + DBusMessageIter variant_it; + DBusMessageIter *it_backup = i; + if (rtype && rtype->isAny()) + { + // open variant container for "any" type + y2debug("Opening VARIANT container with type %s", typeStr(val, false).c_str()); + dbus_message_iter_open_container(i, DBUS_TYPE_VARIANT, typeStr(val, false).c_str(), &variant_it); + + i = &variant_it; + } + if (val->isInteger()) { dbus_int64_t i64 = val->asInteger()->value(); @@ -279,11 +313,19 @@ else if (val->isList()) { YCPList lst = val->asList(); - int sz = lst->size(); - int index = 0; + std::string list_type("v"); + constTypePtr list_type_ptr = Type::Any; + + if (rtype->isList()) + { + list_type_ptr = ((constListTypePtr)rtype)->type(); + y2debug("Found type list<%s>", list_type_ptr->toString().c_str()); - // use string as fallback for empty list - std::string list_type(sz ? typeStr(lst->value(0), bsv_encoding) : DBUS_TYPE_STRING_AS_STRING); + if (!list_type_ptr->isAny()) + { + list_type = YCPTypeSignature(list_type_ptr); + } + } DBusMessageIter array_it; @@ -291,24 +333,15 @@ y2debug("Opening array container with type: %s", list_type.c_str()); dbus_message_iter_open_container(i, DBUS_TYPE_ARRAY, list_type.c_str(), &array_it); + + int sz = lst->size(); + int index = 0; while(index < sz) { y2debug("Adding YCP value at index %d", index); - YCPValue list_item = lst->value(index); - - if (typeStr(list_item, bsv_encoding) != list_type) - { - y2error("Found different type in list: %s (expected %s) - ignoring item %s", - typeStr(list_item, bsv_encoding).c_str(), list_type.c_str(), - list_item->toString().c_str()); - return false; - } - else - { - // add the raw YCP value - addValueAt(lst->value(index), &array_it, bsv_encoding); - } + // add the raw YCP value + addValueAt(lst->value(index), &array_it, list_type_ptr); index++; } @@ -321,24 +354,40 @@ { YCPMap map = val->asMap(); - DBusMessageIter array_it; + std::string map_key_type("s"); + std::string map_val_type("v"); - YCPMap::const_iterator mit = map.begin(); - // use string as fallback for empty map - std::string key_type(mit == map.end() ? DBUS_TYPE_STRING_AS_STRING : typeStr(mit->first, bsv_encoding)); - std::string val_type(mit == map.end() ? DBUS_TYPE_STRING_AS_STRING : typeStr(mit->second, bsv_encoding)); + // YCPMap can contain only YCPString, YCPInteger or YCPSymbol as the key + constTypePtr map_key_type_ptr = Type::String; + constTypePtr map_val_type_ptr = Type::Any; + + if (rtype->isMap()) + { + map_key_type_ptr = ((constMapTypePtr)rtype)->keytype(); - // dbus allows only basic types as key type in a map - const std::string valid_key_types(DBUS_TYPE_INT64_AS_STRING DBUS_TYPE_DOUBLE_AS_STRING - DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_BOOLEAN_AS_STRING); + if (map_key_type_ptr->isAny()) + { + map_key_type_ptr = Type::String; + } - if (valid_key_types.find(key_type) == std::string::npos) - { - y2error("Invalid type of key in map (non-basic type): %s, ignoring the map", key_type.c_str()); - return false; + map_val_type_ptr = ((constMapTypePtr)rtype)->valuetype(); + y2debug("Found type map<%s,%s>", map_key_type_ptr->toString().c_str(), map_val_type_ptr->toString().c_str()); + + if (!map_key_type_ptr->isAny()) + { + map_key_type = YCPTypeSignature(map_key_type_ptr); + } + if (!map_val_type_ptr->isAny()) + { + map_val_type = YCPTypeSignature(map_val_type_ptr); + } } - std::string map_signature("{" + key_type + (bsv_encoding ? "v" : val_type) + "}"); + DBusMessageIter array_it; + + YCPMap::const_iterator mit = map.begin(); + + std::string map_signature("{" + map_key_type + map_val_type + "}"); // open array container y2debug("Opening DICT container with signature: %s", map_signature.c_str()); @@ -349,41 +398,23 @@ YCPValue key = mit->first; YCPValue val = mit->second; - // error: this is a different key type than the announced type - if (key_type != typeStr(key, bsv_encoding)) - { - y2error("Found different key type %s (expected %s) - ignoring pair $[ %s : %s ]", - typeStr(key, bsv_encoding).c_str(), key_type.c_str(), - key->toString().c_str(), val->toString().c_str()); - - continue; - } - DBusMessageIter map_item_it; y2debug("Opening map item container"); dbus_message_iter_open_container(&array_it, DBUS_TYPE_DICT_ENTRY, 0, &map_item_it); - // add the key - addValueAt(key, &map_item_it, bsv_encoding); - - if (bsv_encoding) - { - DBusMessageIter var_it2; - // add VARIANT container - y2debug("Opening VARIANT container with type %s", typeStr(val, bsv_encoding).c_str()); - dbus_message_iter_open_container(&map_item_it, DBUS_TYPE_VARIANT, typeStr(val, bsv_encoding).c_str(), &var_it2); - // add the value - addValueAt(val, &var_it2, bsv_encoding); - - y2debug("Closing VARIANT container"); - dbus_message_iter_close_container(&map_item_it, &var_it2); - } - else + // convert YCPInteger key to string for "any" type + if (key->isInteger() && map_key_type_ptr == Type::String) { - addValueAt(val, &map_item_it, bsv_encoding); + key = YCPString(key->toString()); } + // add the key + addValueAt(key, &map_item_it, map_key_type_ptr); + + // add the value + addValueAt(val, &map_item_it, map_val_type_ptr); + // close map item dbus_message_iter_close_container(&array_it, &map_item_it); y2debug("Closing map item container"); @@ -401,6 +432,13 @@ // TODO add as string? } + if (rtype && rtype->isAny()) + { + // close variant container for "any" type + y2debug("Closing VARIANT container"); + dbus_message_iter_close_container(it_backup, &variant_it); + } + return true; } @@ -1103,9 +1141,7 @@ } else { - YCPList lst = val->asList(); - std::string val_type((lst->size() > 0) ? typeStr(lst->value(0)) : "s"); - return std::string("a") + val_type; + return "av"; } } else if (val->isCode()) @@ -1128,10 +1164,7 @@ } else { - std::string val_type((map.size() > 0) ? typeStr(map.begin()->second) : "s"); - - return std::string(DBUS_TYPE_ARRAY_AS_STRING) + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + - + key_type.c_str() + val_type + DBUS_DICT_ENTRY_END_CHAR_AS_STRING; + return "a{sv}"; } } @@ -1170,3 +1203,76 @@ { return "(bsv)"; } + +std::string DBusMsg::YCPTypeSignature(constTypePtr type) +{ + // handle any type specially + if (type->isAny()) + { + return "v"; + } + + if (type->isList()) + { + constTypePtr list_type = ((constListTypePtr)type)->type(); + y2debug("type list<%s>", list_type->toString().c_str()); + + std::string list_type_str(YCPTypeSignature(list_type)); + + if (list_type_str.empty()) + { + throw SignatureException(); + } + + return std::string("a") + list_type_str; + } + + if (type->isMap()) + { + constMapTypePtr mt = (constMapTypePtr)type; + constTypePtr key_type = mt->keytype(); + constTypePtr val_type = mt->valuetype(); + + if (key_type->isAny()) + { + key_type = Type::String; + } + + y2debug("type map<%s,%s>", key_type->toString().c_str(), val_type->toString().c_str()); + + std::string key_type_str(YCPTypeSignature(key_type)); + std::string val_type_str(YCPTypeSignature(val_type)); + + if (key_type_str.empty() || val_type_str.empty()) + { + throw SignatureException(); + } + + return std::string("a{") + key_type_str + val_type_str + "}"; + } + + YCPValueType vt = type->valueType(); + std::string ret; + + switch (vt) + { + case(YT_VOID) : ret = ""; break; + case(YT_BOOLEAN) : ret = DBUS_TYPE_BOOLEAN_AS_STRING; break; + case(YT_INTEGER) : ret = DBUS_TYPE_INT64_AS_STRING; break; + case(YT_FLOAT) : ret = DBUS_TYPE_DOUBLE_AS_STRING; break; + case(YT_STRING) : ret = DBUS_TYPE_STRING_AS_STRING; break; + case(YT_PATH) : ret = DBUS_TYPE_STRING_AS_STRING; break; + case(YT_SYMBOL) : ret = DBUS_TYPE_STRING_AS_STRING; break; + case(YT_TERM) : ret = DBUS_TYPE_STRING_AS_STRING; break; +// case(YT_CODE) : ret = DBUS_TYPE_STRING_AS_STRING; break; + + default : y2error("Type '%s' is not supported", type->toString().c_str()); throw SignatureException(); + } + + return ret; +} + +SignatureException::SignatureException() +{ + y2error("Signature exception"); +} diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusMsg.h new/yast2-core-2.18.14/liby2dbus/src/DBusMsg.h --- old/yast2-core-2.18.13/liby2dbus/src/DBusMsg.h 2009-06-15 15:53:06.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusMsg.h 2009-06-18 15:25:17.000000000 +0200 @@ -9,6 +9,8 @@ #include <string> #include <dbus/dbus.h> +#include <ycp/TypePtr.h> + class YCPValue; // DBusMessage wrapper @@ -43,7 +45,7 @@ bool addDouble(double val); bool addYCPValue(const YCPValue &val); - bool addValue(const YCPValue &val); + bool addValueAs(const YCPValue &val, constTypePtr rettype = NULL); YCPValue getYCPValue(int index) const; @@ -61,12 +63,13 @@ std::string sender() const; static const char *YCPValueSignature(); + static std::string YCPTypeSignature(constTypePtr type); private: bool addValue(int type, void* data); bool addValue(int type, void* data, DBusMessageIter *i); - bool addValueAt(const YCPValue &val, DBusMessageIter *i, bool bsv_encoding = true); + bool addValueAt(const YCPValue &val, DBusMessageIter *i, constTypePtr rtype = NULL); bool addYCPValue(const YCPValue &v, DBusMessageIter *i); bool addYCPValueRaw(const YCPValue &val, DBusMessageIter *i); void release(); @@ -79,5 +82,11 @@ YCPValue getYCPValueRaw(DBusMessageIter *it, const std::string &ycp_type = std::string()) const; }; +class SignatureException : std::exception +{ + public: + SignatureException(); +}; + #endif diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusServerBase.cc new/yast2-core-2.18.14/liby2dbus/src/DBusServerBase.cc --- old/yast2-core-2.18.13/liby2dbus/src/DBusServerBase.cc 2009-05-04 18:52:52.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusServerBase.cc 2009-06-18 16:44:22.000000000 +0200 @@ -21,8 +21,9 @@ int timeout_counter = YAST_DBUS_SHUTDOWN_TIMEOUT_COUNT; -DBusServerBase::DBusServerBase() +DBusServerBase::DBusServerBase(bool testmode) { + test_mode = testmode; dbus_threads_init_default(); } @@ -124,6 +125,13 @@ // mainloop while (true) { + if (!dbus_connection_get_is_connected(connection.getConnection())) + { + y2debug ("Got disconnected"); + // otherwise receiving would call exit (!) + break; + } + // try reading a message from DBus DBusMsg request(connection.receive()); @@ -254,8 +262,8 @@ policykit.checkPolkitChanges(); #endif - // check the policy using PolicyKit - if (isActionAllowed(request, &dbus_error)) + // check the policy using PolicyKit, the check is disabled in the test mode + if (test_mode || isActionAllowed(request, &dbus_error)) { // find the registered object std::string objname = request.path(); @@ -369,7 +377,7 @@ void DBusServerBase::register_method(const Object &obj, const Interface &intf, const Method &m, const DBusSignature &sig, methodHandler h) { - y2milestone("Registering DBus path: object %s interface %s method %s...", obj.c_str(), intf.c_str(), m.c_str()); + y2milestone("Registering DBus path: object %s interface %s method %s signature %s...", obj.c_str(), intf.c_str(), m.c_str(), sig.asXML().c_str()); Objects::iterator i = registered_objects.find(obj); // create a new data item @@ -482,7 +490,7 @@ #endif } -DBusServerBase::actionList DBusServerBase::createActionId(const DBusMsg &msg) +DBusServerBase::actionList DBusServerBase::createActionId(const DBusMsg &) { y2debug("Using default empty list of action IDs"); // default implementation is empty list diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/liby2dbus/src/DBusServerBase.h new/yast2-core-2.18.14/liby2dbus/src/DBusServerBase.h --- old/yast2-core-2.18.13/liby2dbus/src/DBusServerBase.h 2009-04-10 09:50:44.000000000 +0200 +++ new/yast2-core-2.18.14/liby2dbus/src/DBusServerBase.h 2009-06-18 16:44:22.000000000 +0200 @@ -23,7 +23,7 @@ { public: - DBusServerBase(); + DBusServerBase(bool testmode = false); virtual ~DBusServerBase(); virtual bool connect() = 0; @@ -60,6 +60,7 @@ std::string service_name; + bool test_mode; private: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/libycp/src/YCPBuiltinFloat.cc new/yast2-core-2.18.14/libycp/src/YCPBuiltinFloat.cc --- old/yast2-core-2.18.13/libycp/src/YCPBuiltinFloat.cc 2009-06-11 17:45:07.000000000 +0200 +++ new/yast2-core-2.18.14/libycp/src/YCPBuiltinFloat.cc 2009-06-19 14:15:30.000000000 +0200 @@ -288,7 +288,7 @@ std::ostringstream ss; ss.imbue (std::locale ("")); ss.precision (precision->value ()); - ss << f->value (); + ss << fixed<< f->value (); YCPString ret (ss.str ()); return ret; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.err new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.err --- old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.err 2009-06-11 17:45:07.000000000 +0200 +++ new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.err 2009-06-19 14:15:30.000000000 +0200 @@ -73,6 +73,38 @@ ---------------------------------------------------------------------- Parsed: ---------------------------------------------------------------------- +tostring (0., 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +float::tolstring (0., 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +tostring (1., 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +float::tolstring (1., 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +tostring ((1049. / /* const integer -> const float */1024), 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +float::tolstring ((1049. / /* const integer -> const float */1024), 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +tostring (((((1.126e+15 / /* const integer -> const float */1024) / /* const integer -> float */1024) / /* const integer -> float */1024) / /* const integer -> float */1024), 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- +float::tolstring (((((1.126e+15 / /* const integer -> const float */1024) / /* const integer -> float */1024) / /* const integer -> float */1024) / /* const integer -> float */1024), 2) +---------------------------------------------------------------------- +Parsed: +---------------------------------------------------------------------- (tohexstring (31) == "0x1f") ---------------------------------------------------------------------- Parsed: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.out new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.out --- old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.out 2009-06-11 17:45:07.000000000 +0200 +++ new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.out 2009-06-19 14:15:30.000000000 +0200 @@ -15,6 +15,14 @@ (true) (true) (true) +("0.00") +("0,00") +("1.00") +("1,00") +("1.02") +("1,02") +("1024.09") +("1�024,09") (true) (true) (true) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.ycp new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.ycp --- old/yast2-core-2.18.13/libycp/testsuite/tests/builtin/Builtin_VIII.ycp 2009-06-11 17:45:07.000000000 +0200 +++ new/yast2-core-2.18.14/libycp/testsuite/tests/builtin/Builtin_VIII.ycp 2009-06-19 14:15:30.000000000 +0200 @@ -84,6 +84,14 @@ // ( tostring(0.12345, 4) == "0.1235" ) ( float::tolstring(0.12345, 4) == "0,1235" ) +( tostring(0.0, 2) ) +( float::tolstring(0.0, 2) ) +( tostring(1.0, 2) ) +( float::tolstring(1.0, 2) ) +( tostring(1049.0/1024, 2) ) +( float::tolstring(1049.0/1024, 2) ) +( tostring(1126000000000000.0/1024/1024/1024/1024, 2) ) +( float::tolstring(1126000000000000.0/1024/1024/1024/1024, 2) ) // diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.18.13/VERSION new/yast2-core-2.18.14/VERSION --- old/yast2-core-2.18.13/VERSION 2009-06-15 17:25:14.000000000 +0200 +++ new/yast2-core-2.18.14/VERSION 2009-06-19 14:55:10.000000000 +0200 @@ -1 +1 @@ -2.18.13 +2.18.14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de