diff --git a/akonadi-16.12.0.tar.xz b/akonadi-16.12.0.tar.xz deleted file mode 100644 index 58f48f6..0000000 --- a/akonadi-16.12.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:281c8c0adfff16f4f43e428a22d483865ca2f54c0c2b24aae4ac8e85705712bf -size 1036192 diff --git a/akonadi-16.12.1.tar.xz b/akonadi-16.12.1.tar.xz new file mode 100644 index 0000000..08d4455 --- /dev/null +++ b/akonadi-16.12.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3361759d0ca631cb98c886f23ff494a209810d37262c8cbb3e1fb939b34ceea +size 1036504 diff --git a/akonadi-server.changes b/akonadi-server.changes index 09a67e1..fcd3cb2 100644 --- a/akonadi-server.changes +++ b/akonadi-server.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Sun Jan 22 17:10:01 UTC 2017 - hrvoje.senjan@gmail.com + +- Add handle-mysql-process-crashes-gracefully.patch from upstream + +------------------------------------------------------------------- +Sat Jan 14 08:48:19 UTC 2017 - lbeltrame@kde.org + +- - Update to KDE Applications 16.12.1 + * KDE Applications 16.12.1 + * https://www.kde.org/announcements/announce-applications-16.12.1.php + +- Drop upstream patch fix-connect-api.patch + ------------------------------------------------------------------- Tue Dec 27 19:44:22 UTC 2016 - tittiatcoke@gmail.com diff --git a/akonadi-server.spec b/akonadi-server.spec index be90910..8829644 100644 --- a/akonadi-server.spec +++ b/akonadi-server.spec @@ -1,7 +1,7 @@ # # spec file for package akonadi-server # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,10 +18,10 @@ %define rname akonadi %define kf5_version 5.26.0 -# Latest stable Applications (e.g. 16.08 in KA, but 16.12.0 in KUA) +# Latest stable Applications (e.g. 16.08 in KA, but 16.12.1 in KUA) %{!?_kapp_version: %global _kapp_version %(echo %{version}| awk -F. '{print $1"."$2}')} Name: akonadi-server -Version: 16.12.0 +Version: 16.12.1 Release: 0 Summary: PIM Storage Service License: LGPL-2.1+ @@ -29,8 +29,8 @@ Group: System/GUI/KDE Url: http://akonadi-project.org Source: %{rname}-%{version}.tar.xz Source99: akonadi-server-rpmlintrc -#PATCH-FIX-UPSTREAM fix-connect-api.patch montel@kde.org -Patch1: fix-connect-api.patch +# PATCH-FIX-UPSTREAM handle-mysql-process-crashes-gracefully.patch +Patch0: handle-mysql-process-crashes-gracefully.patch BuildRequires: boost-devel BuildRequires: cmake >= 2.8.12 BuildRequires: extra-cmake-modules >= %{kf5_version} @@ -161,7 +161,7 @@ service. %prep %setup -q -n %{rname}-%{version} -%patch1 -p1 +%patch0 -p1 %build %cmake_kf5 -d build -- -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE -DQT_PLUGINS_DIR=%{_kf5_plugindir} diff --git a/fix-connect-api.patch b/fix-connect-api.patch deleted file mode 100644 index 8921b6e..0000000 --- a/fix-connect-api.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4f01df4db16331c8b0efd021135548507db3da0a Mon Sep 17 00:00:00 2001 -From: Montel Laurent -Date: Tue, 27 Dec 2016 13:33:15 +0100 -Subject: Fix subscript/unsubscript folder. We need to connect to private slot. - -it was a bug during porting to new connect api. -Bug reported by Kevin - -CCMAIL: ---- - src/widgets/subscriptiondialog.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/widgets/subscriptiondialog.cpp b/src/widgets/subscriptiondialog.cpp -index c922dc4..8ce06b9 100644 ---- a/src/widgets/subscriptiondialog.cpp -+++ b/src/widgets/subscriptiondialog.cpp -@@ -223,7 +223,7 @@ void SubscriptionDialog::init(const QStringList &mimetypes) - mainLayout->addWidget(buttonBox); - - connect(d->model, SIGNAL(loaded()), SLOT(modelLoaded())); -- connect(d->mOkButton, &QAbstractButton::clicked, this, &QDialog::done); -+ connect(d->mOkButton, SIGNAL(clicked(bool)), this, SLOT(done())); - connect(buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &SubscriptionDialog::deleteLater); - ControlGui::widgetNeedsAkonadi(mainWidget); - d->readConfig(); --- -cgit v0.11.2 - diff --git a/handle-mysql-process-crashes-gracefully.patch b/handle-mysql-process-crashes-gracefully.patch new file mode 100644 index 0000000..b36ae3d --- /dev/null +++ b/handle-mysql-process-crashes-gracefully.patch @@ -0,0 +1,196 @@ +From 4c5ca9bf32e5a9d569e83f66a439c65d8939a540 Mon Sep 17 00:00:00 2001 +From: Martin Koller +Date: Sat, 21 Jan 2017 12:11:14 +0100 +Subject: handle mysql process crashes gracefully + +This patch checks if the mysqld stops unexpectedly when it was started +from akonadiserver and tells the latter to quit when a +stopped mysqld was discovered. +Also in this case the local socket file is removed so that +a restart can work without problem. +REVIEW: 129264 +--- + src/server/storage/dbconfigmysql.cpp | 69 +++++++++++++++++++++++++++++++++--- + src/server/storage/dbconfigmysql.h | 11 ++++-- + 2 files changed, 72 insertions(+), 8 deletions(-) + +diff --git a/src/server/storage/dbconfigmysql.cpp b/src/server/storage/dbconfigmysql.cpp +index 0962ccb..7631890 100644 +--- a/src/server/storage/dbconfigmysql.cpp ++++ b/src/server/storage/dbconfigmysql.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + using namespace Akonadi; + using namespace Akonadi::Server; +@@ -190,6 +191,8 @@ bool DbConfigMysql::startInternalServer() + const QString dataDir = StandardDirs::saveDir("data", QStringLiteral("db_data")); + #ifndef Q_OS_WIN + const QString socketDirectory = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc"))); ++ const QString socketFile = QStringLiteral("%1/mysql.socket").arg(socketDirectory); ++ const QString pidFileName = QStringLiteral("%1/mysql.pid").arg(socketDirectory); + #endif + + // generate config file +@@ -289,6 +292,39 @@ bool DbConfigMysql::startInternalServer() + qCCritical(AKONADISERVER_LOG) << "MySQL cannot deal with a socket path this long. Path was: " << socketDirectory; + return false; + } ++ ++ // If mysql.socket file exists, check if also the server process is still running, ++ // else we can safely remove the socket file (cleanup after a system crash, etc.) ++ QFile pidFile(pidFileName); ++ if (QFile::exists(socketFile) && pidFile.open(QIODevice::ReadOnly)) { ++ qCDebug(AKONADISERVER_LOG) << "Found a mysqld pid file, checking whether the server is still running..."; ++ QByteArray pid = pidFile.readLine().trimmed(); ++ QFile proc(QString::fromLatin1("/proc/" + pid + "/stat")); ++ // Check whether the process with the PID from pidfile still exists and whether ++ // it's actually still mysqld or, whether the PID has been recycled in the meanwhile. ++ bool serverIsRunning = false; ++ if (proc.open(QIODevice::ReadOnly)) { ++ const QByteArray stat = proc.readAll(); ++ const QList stats = stat.split(' '); ++ if (stats.count() > 1) { ++ // Make sure the PID actually belongs to mysql process ++ if (stats[1] == "(mysqld)") { ++ // Yup, our mysqld is actually running, so pretend we started the server ++ // and try to connect to it ++ qCWarning(AKONADISERVER_LOG) << "mysqld for Akonadi is already running, trying to connect to it."; ++ serverIsRunning = true; ++ } ++ } ++ proc.close(); ++ } ++ ++ if (!serverIsRunning) { ++ qCDebug(AKONADISERVER_LOG) << "No mysqld process with specified PID is running. Removing the pidfile and starting a new instance..."; ++ pidFile.close(); ++ pidFile.remove(); ++ QFile::remove(socketFile); ++ } ++ } + #endif + + // synthesize the mysqld command +@@ -296,14 +332,15 @@ bool DbConfigMysql::startInternalServer() + arguments << QStringLiteral("--defaults-file=%1/mysql.conf").arg(akDir); + arguments << QStringLiteral("--datadir=%1/").arg(dataDir); + #ifndef Q_OS_WIN +- arguments << QStringLiteral("--socket=%1/mysql.socket").arg(socketDirectory); ++ arguments << QStringLiteral("--socket=%1").arg(socketFile); ++ arguments << QStringLiteral("--pid-file=%1").arg(pidFileName); + #else + arguments << QString::fromLatin1("--shared-memory"); + #endif + + // If mysql.socket file does not exists, then we must start the server, + // otherwise we reconnect to it +- if (!QFile::exists(QStringLiteral("%1/mysql.socket").arg(socketDirectory))) { ++ if (!QFile::exists(socketFile)) { + // move mysql error log file out of the way + const QFileInfo errorLog(dataDir + QDir::separator() + QLatin1String("mysql.err")); + if (errorLog.exists()) { +@@ -348,9 +385,11 @@ bool DbConfigMysql::startInternalServer() + return false; + } + +- #ifndef Q_OS_WIN ++ connect(mDatabaseProcess, static_cast(&QProcess::finished), ++ this, &DbConfigMysql::processFinished); ++ ++#ifndef Q_OS_WIN + // wait until mysqld has created the socket file (workaround for QTBUG-47475 in Qt5.5.0) +- QString socketFile = QStringLiteral("%1/mysql.socket").arg(socketDirectory); + int counter = 50; // avoid an endless loop in case mysqld terminated + while ((counter-- > 0) && !QFileInfo::exists(socketFile)) { + QThread::msleep(100); +@@ -358,7 +397,6 @@ bool DbConfigMysql::startInternalServer() + #endif + } else { + qCDebug(AKONADISERVER_LOG) << "Found mysql.socket file, reconnecting to the database"; +- mDatabaseProcess = new QProcess(); + } + + const QLatin1String initCon("initConnection"); +@@ -378,7 +416,7 @@ bool DbConfigMysql::startInternalServer() + if (opened) { + break; + } +- if (mDatabaseProcess->waitForFinished(500)) { ++ if (mDatabaseProcess && mDatabaseProcess->waitForFinished(500)) { + qCCritical(AKONADISERVER_LOG) << "Database process exited unexpectedly during initial connection!"; + qCCritical(AKONADISERVER_LOG) << "executable:" << mMysqldPath; + qCCritical(AKONADISERVER_LOG) << "arguments:" << arguments; +@@ -459,12 +497,33 @@ bool DbConfigMysql::startInternalServer() + return success; + } + ++void DbConfigMysql::processFinished(int exitCode, QProcess::ExitStatus exitStatus) ++{ ++ Q_UNUSED(exitCode); ++ Q_UNUSED(exitStatus); ++ ++ qCCritical(AKONADISERVER_LOG) << "database server stopped unexpectedly"; ++ ++#ifndef Q_OS_WIN ++ // when the server stopped unexpectedly, make sure to remove the stale socket file since otherwise ++ // it can not be started again ++ const QString socketDirectory = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc"))); ++ const QString socketFile = QStringLiteral("%1/mysql.socket").arg(socketDirectory); ++ QFile::remove(socketFile); ++#endif ++ ++ QCoreApplication::quit(); ++} ++ + void DbConfigMysql::stopInternalServer() + { + if (!mDatabaseProcess) { + return; + } + ++ disconnect(mDatabaseProcess, static_cast(&QProcess::finished), ++ this, &DbConfigMysql::processFinished); ++ + // first, try the nicest approach + if (!mCleanServerShutdownCommand.isEmpty()) { + QProcess::execute(mCleanServerShutdownCommand); +diff --git a/src/server/storage/dbconfigmysql.h b/src/server/storage/dbconfigmysql.h +index 27841e8..a25f28b 100644 +--- a/src/server/storage/dbconfigmysql.h ++++ b/src/server/storage/dbconfigmysql.h +@@ -21,14 +21,16 @@ + #define DBCONFIGMYSQL_H + + #include "dbconfig.h" +- +-class QProcess; ++#include ++#include + + namespace Akonadi { + namespace Server { + +-class DbConfigMysql : public DbConfig ++class DbConfigMysql : public QObject, public DbConfig + { ++ Q_OBJECT ++ + public: + DbConfigMysql(); + +@@ -75,6 +77,9 @@ public: + /// reimpl + void initSession(const QSqlDatabase &database) Q_DECL_OVERRIDE; + ++private Q_SLOTS: ++ void processFinished(int exitCode, QProcess::ExitStatus exitStatus); ++ + private: + int parseCommandLineToolsVersion() const; + +-- +cgit v0.11.2