Commit Graph

6320 Commits

Author SHA1 Message Date
Patrick Ohly 90c3ca329d build: only link against libcppunit if needed
The --as-needed linker flag didn't work anymore on recent Linux
distros, with the result that libcppunit became a library dependency
of the syncevolution binaries although they didn't need it.

A better approach anyway is to only link the lib when it is expected
to be used (unit testing or in client-test).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:42 -08:00
Patrick Ohly 54d5f08d76 build: stop building useless KDE deb
The KDE backends is now typically disabled and thus a separate
KDE deb is not needed anymore.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:31 -08:00
Patrick Ohly 798c2f4d09 sys.supp: more general gnutls_x509_trust_list_add_trust_file
The soname is different on more recent Linux distros, so better
leave it out.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:22 -08:00
Patrick Ohly 7cf0dd5217 1.99.1 pre-release 2020-12-19 01:43:24 -08:00
Patrick Ohly 64c62b53b4 tde: fix "make dist" issue
"make dist" tries to include all source files in the archive, which
does not work for the generated files.
2020-12-18 08:14:41 -08:00
Patrick Ohly 516d8258ca sys.supp: add gnutls_x509_trust_list_add_trust_file 2020-12-17 03:21:37 -08:00
deloptes 57d357afee tdepim: various changes
Submitted by deloptes via private email.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-06 11:25:57 +01:00
Patrick Ohly a6b490ef83 OBEX: additional debug output
This shows more clearly when OBEX function calls are made, which is
relevant for libopenobex2 (OBEX_HandleInput must be called after
OBEX_Request).
2020-12-05 21:28:08 +01:00
Patrick Ohly 051b8ac8d2 EDS: avoid dead code warnings when disabled 2020-12-05 21:28:08 +01:00
Patrick Ohly 8f7fc79007 build: avoid deprecation warning
-Wno-deprecated-declarations is needed everywhere (i.e. not just in certain
modules, like SYNCEVO_WFLAGS_DEPRECATED) because EDS on Ubuntu Eon uses
the deprecated GDateTime in its header, which we included through our
EDS/libical wrapper even when not actually used.
2020-12-05 21:28:08 +01:00
Patrick Ohly f9ca9e34de test: fix compiler warning about return code of symlink 2020-12-05 21:28:08 +01:00
Milan Crha edb458dfcb EDS: EDS 3.33.2, libecal 2.0 support
Developed originally by Milan Crha for Fedora, copied and updated
by Patrick Ohly.

From Milan:

There are going to be made huge libecal API changes, as huge as it
deserved a version bump from 1.2 to 2.0, and together with it a small
libebook API changes, most likely being part of the evolution-data-
server 3.33.2 release, which is planned for May 20. More about this can
be found here:
https://mail.gnome.org/archives/desktop-devel-list/2019-April/msg00016.html

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly a3bb1fba4a SyncSource.h: fix compiler warning
Clang complained about "exec" being uninitialized.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly afd10b27e2 c++: add missing va_end
Found via cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly b2b1f2f161 c++: avoid slicing exception
Newer clang (or was it gcc?) warn about catching exceptions by value
which have virtual methods. This shouldn't have mattered here because
the exception values where not really used, but using a const
reference is better nonetheless.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 0e5ee4f41a gdbus: replace helper class with normal glib classes
The signond pipe helper class uses deprecated glib methods. Not sure
whether that wasn't an option at the time that it was written, but
nowadays glib has classes which can be used instead.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e88bfa6214 C++: automatically determine iterator types
Having to specify the type of an iterator is annoying and does not
really add clarity to the code. With C++11 we can use "auto"
instead and in some cases remove helper typedefs.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 7d527c6dd8 C++: instantiate some templates once in libsyncevolution
This saves some space (total number of blocks for SyncEvolution object
files when building statically down from 421588 to 413300) and
presumably also build times (not measured).

However, it did not work for all templates, leading to link errors
when trying to add std::map and std::pair of strings. It probably also
does not make sense for templates where only some functionality is
used.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 85edb458f4 util.h: remove unused ToString()
It pulled sstream into many compilation units.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly b8cbd5358f C++: avoid NULL
NULL is ambiguous (can be integer and pointer) and using it as
terminator for vararg list of pointers without explicit casting to a
pointer was downright incorrect. nullptr fixes that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 02a711f143 C++: replace BOOST_TYPEOF
decltype does the same thing.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 74f0d01f33 C++: remove more boost headers (tuple, assign, utility)
Several headers were no longer needed resp. could be replaced by more
specific ones like noncopyable.hpp.

boost::assign mostly can be replaced with initialization lists and
boost::tuple with std::tuple.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly ae4969cfa3 C++: replace pcrecpp with std::regex
This allows us to get rid of an external dependency. Mostly std::regex
works, but there are limitations that have to be worked around:
- no multiline support in C++11
- conversion of groups to non-string types has to be done manually

While at it, use raw strings to get rid of excessive backslash
escaping.

pcrecpp::StringPiece was used as a general-purpose utility class. Now
we have our own implementation.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 6217ba0bd1 C++: avoid boost::scope_ptr/array and plain pointers
std::unique_ptr usually can be used instead. std::vector also works
for arrays and even has a data() method as part of the official API in
C++11.

For historic reasons, the functions creating SyncSources returned
plain pointers. We are breaking the API now, so we might as well fix
that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 67147853f7 src/async.patch: remove obsolete patch
This was committed to SVN, probably because it might have become
relevant again. Now it is long obsolete.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 2fa3c3335a C++: replace boost::shared_ptr, boost::function, boost::bind
We can use std::shared_ptr and std::function instead now.

Lambdas are usually a better alternative to boost/std::bind. The
downside is the need to explicitly specify parameters completely. When
inlining callbacks entirely with lambdas, duplication of that
parameter list can be avoided.

Whenever possible, use std::make_shared to construct objects that are
tracked by std::shared_ptr.

Some objects need a std::weak_ptr during object destruction. For that
we have to use our own implementation of std::enable_shared_from_this,
with a matching creator function. The additional benefit is that we
can get rid of explicit static "create" methods by making that create
function a friend.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly d0c08bf0dd C++: avoid "using namespace std"
It saved some typing, but isn't good style.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly bce7526da1 C++: simpler for loops
boost/foreach.hpp is no longer needed, range-based loops work
the same. With some helpers, even reverse iteration and
boost::make_split_iterator() can be handled the same way.

"auto" makes it possible to avoid explicitly spelling out the
expected type.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 623397c674 C++: lambdas instead of static methods
Lambdas without variable capture are guaranteed to be compatible with
plain C functions, so we can use them as callbacks. That keeps the
code closer together and avoids having to declare helper methods as
part of the public class.

In some cases the static method is the actual code, in which case only
"nothrow()" gets replaced with "noexcept" because it's cleaner and to
mark that the code was looked at and intentionally left as-is.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e95ac67d4b C++: more modern timeout.h
Universal references and template methods make it possible to pass
through arbitrary callbacks right through to the point where we need
to create a std::function for a plain-C lambda.

Boost is not needed anymore.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 39bf3f1291 C++: variadic connectSignal()
By specifying the list of signal types as template parameters
it becomes possible to use a single implementation. Lambdas
can replace explicit callback methods.

The reimplementation is more flexible and does not enforce
the use of a boost::function. This matches how connectSignal()
was used in practice. Thanks to universal references, the boost::bind
instances get moved directly into the allocated instances that are
attached to the signal handler.

The downside is that the call syntax changes slightly, because
partially specifying template parameters does not work.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3729a239fc C++: variadic templates in D-Bus bindings
Using templates with a varying number of types allows removing
duplicated code for the different cases.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 618e8b9d71 SyncSource.h: variadic templates
The OperationWrapperSwitch class can be reduced to just two cases,
which reduces code duplication considerably. Conditional compilation
with "if constexpr" could be used to eliminate the helper class
entirely, but that's C++17.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 8713809b35 C++: use lambdas instead of boost::lambda, std::exception_ptr
The code becomes a lot more readable. One can also set breakpoints
inside the callbacks.

Exception handling in GRunInMain() is better now, with the ability to
rethrow arbitrary exceptions thanks to std::exception_ptr.

Only some usage of boost::lambda in the Akonadi backend remains.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3dc1514ab9 syncevo-dbus-server: remove virtual address book feature
This aspect of syncevo-dbus-server had been developed for use in an
IVI head unit. It's currently neither used nor tested and no longer
compiles (timeout.h moved, API changes in libfolks).

Instead of trying to keep it working while enhancing the usage of C++,
removing it entirely is easier.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 04f8ac0454 gdbus: remove old libdbus-based implementation
GIO D-Bus is a more modern and capable implementation. The older one
was only needed on certain old Linux distros (Maemo) which did not
have a recent enough glib.

The reason for removing the old one is that it allows making API
incompatible changes for the C++ D-Bus binding without having to do
that in two places.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 2705d06fa6 connection.cpp: better check for obex-bt:// URLs
cppcheck started complaining about std::string::find() being
inefficient. boost::starts_with() would indeed be better, but even simpler
and more readable is a whole-string comparison.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e3783d3039 installcheck-local.sh: test with C++14
Some header files use C++14 features.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 068e8d0ae3 SuspendFlags: restore printing of messages
Commit 5bafef3957 (included in v1.4)
broke the printing of the messages about Ctrl-C handling, in
particular the hint that using it quickly will switch from suspending
to aborting.

The message code was getting overwritten by a new default case due to
a missing break.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e773bc9a69 installcheck-local.sh: test with C++11
Some header files use C++11 features.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 25442ad2e6 timeout.h: include glib.h
The header file is not usable without glib. Users of it need to be aware of
that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 7014e5bb67 installcheck-local.sh: test with glib enabled
At least timeout.h only works with glib, and that's okay.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 9c00b725f9 SoupTransportAgent: fix disabled SSL checking
The SoupTransportAgent modernization in 1.5.3 led to SSL checking
always being enabled because the default changed from disabled to
enabled and SyncEvolution did not set it.

Worse, in older versions it probably (untested) was always disabled
because it was not enabled either.

Now the checking of SSL is always set explicitly and thus always
mirrors the SyncEvolution configuration.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 55cb5ad46f sync: avoid setenv()
set/getenv() are not thread-safe, and a recent bug report via private
email shows that this does cause segfaults:

Thread 4 (Thread 19251):
....

Thread 1 (Thread 19311):
...

In this case, DLT was used and the setenv call was setting the
LIBSYNTHESIS_<context> variables.

The solution is to avoid setenv() in code which might run in parallel
to other threads:
- DLT-related variables are set at the beginning of
  syncevo-dbus-server startup which then gets inherited
  by syncevo-dbus-helper and in the environment prepared
  for syncevo-local-sync (because the latter might run with
  a different log level)
- the default for SYNCEVOLUTION_PBAP_SYNC is now "incremental"
  everywhere and SyncContext is told about the special
  mode where it needs to keep photo data differently, i.e. setting
  SYNCEVOLUTION_PBAP_SYNC in dbus-sync.cpp for PBAP syncing is
  no longer necessary

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly d5a7d38029 docs: replace meego.org references (FDO #104936)
meego.org is long gone, replace it where possible. Some of the old bug
references might have a corresponding bug in bugs.freedesktop.org but
trying to update them probably isn't worth it.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3cd62b3e41 signon: fix pcrecpp build flags
Dropping the pcrecpp build hacks in the nightly testing showed that
the flags for normal linking and compilation were missing.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly edf1314def test: convert scripts to Python3
This is the result of 2to3, with the interpreter path updated manually,
tabs replaced by spaces and some obsolete packages removed.

Required because the current nightly build host no longer has Python2 installed.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Milan Crha 75dff12823 Python2 -> Python3
Originally developed by Milan Crha for Fedora, copied from there
by Patrick Ohly.
2020-08-09 16:31:32 +02:00
Patrick Ohly 3bd97cc795 runtests.py: remove lpia hack
With support for 32 bit binaries removed, we also no longer need
to build the special lpia packages.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly fb8e527afc runtests.py: do not use resources.py during Git checkout
The script comes from SyncEvolution and might not be ready yet
when checking out other repos.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00