commit:     d03e9c5d4c856533146450a842e0afb1150b8089
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 14:37:09 2017 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat May 27 14:54:14 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d03e9c5d

kde-frameworks/kwallet: Service both org.kde.kwalletd5 and ...kwalletd

Gentoo-bug: 597610

Package-Manager: Portage-2.3.5, Repoman-2.3.1

 .../kwallet/files/kwallet-5.34.0-kwalletd4-1.patch | 36 ++++++++++++
 .../kwallet/files/kwallet-5.34.0-kwalletd4-2.patch | 51 ++++++++++++++++
 .../kwallet/files/kwallet-5.34.0-kwalletd4-3.patch | 51 ++++++++++++++++
 .../kwallet/files/kwallet-5.34.0-kwalletd4-4.patch | 60 +++++++++++++++++++
 .../kwallet/files/kwallet-5.34.0-kwalletd4-5.patch | 68 ++++++++++++++++++++++
 kde-frameworks/kwallet/kwallet-5.34.0-r1.ebuild    | 57 ++++++++++++++++++
 6 files changed, 323 insertions(+)

diff --git a/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-1.patch 
b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-1.patch
new file mode 100644
index 00000000000..e231369e780
--- /dev/null
+++ b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-1.patch
@@ -0,0 +1,36 @@
+From bf775a9a9fa2c8ba66bf5106969b076c68ecedca Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]>
+Date: Sun, 31 May 2015 06:40:38 +0200
+Subject: [PATCH 1/5] Check for unique applicaton instance as early as possible
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Exit before KWalletD and the MigrationAgent has been initialized.
+The return value is changed, but concurrent instatiation of kwalletd is
+not a fault.
+
+Signed-off-by: Stefan Brüns <[email protected]>
+---
+ src/runtime/kwalletd/main.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/runtime/kwalletd/main.cpp b/src/runtime/kwalletd/main.cpp
+index ff96208..c98c1b3 100644
+--- a/src/runtime/kwalletd/main.cpp
++++ b/src/runtime/kwalletd/main.cpp
+@@ -189,9 +189,10 @@ int main(int argc, char **argv)
+     aboutdata.addAuthor(i18n("George Staikos"), i18n("Former maintainer"), 
QStringLiteral("[email protected]"));
+     aboutdata.addAuthor(i18n("Thiago Maceira"), i18n("D-Bus Interface"), 
QStringLiteral("[email protected]"));
+ 
++    KDBusService dbusUniqueInstance(KDBusService::Unique);
++
+     KWalletD walletd;
+     MigrationAgent migrationAgent(&walletd, hash);
+-    KDBusService dbusUniqueInstance(KDBusService::Unique);
+ 
+     // NOTE: the command should be parsed only after KDBusService 
instantiation
+     QCommandLineParser cmdParser;
+-- 
+2.12.0
+

diff --git a/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-2.patch 
b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-2.patch
new file mode 100644
index 00000000000..dd6a7833335
--- /dev/null
+++ b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-2.patch
@@ -0,0 +1,51 @@
+From f63407a129910cac5b2f7bbf56a348932fdeb05a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]>
+Date: Sun, 31 May 2015 06:56:44 +0200
+Subject: [PATCH 2/5] Only start timer for migration agent if necessary
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Stefan Brüns <[email protected]>
+---
+ src/runtime/kwalletd/migrationagent.cpp | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/runtime/kwalletd/migrationagent.cpp 
b/src/runtime/kwalletd/migrationagent.cpp
+index f3da947..110a5e0 100644
+--- a/src/runtime/kwalletd/migrationagent.cpp
++++ b/src/runtime/kwalletd/migrationagent.cpp
+@@ -41,7 +41,11 @@ MigrationAgent::MigrationAgent(KWalletD* kd, const char 
*hash) :
+   , _kde4_daemon(nullptr)
+   , _pam_hash(hash)
+ {
+-  QTimer::singleShot(100, this, SLOT(migrateWallets()));
++  if (isAlreadyMigrated()) {
++    qDebug() << "old wallets were already migrated";
++  } else {
++    QTimer::singleShot(100, this, SLOT(migrateWallets()));
++  }
+ }
+ 
+ void MigrationAgent::migrateWallets()
+@@ -55,7 +59,7 @@ void MigrationAgent::migrateWallets()
+   // if the migration wizard returns without error
+   // create "alreadyMigrated=true" setting
+   qDebug() << "Migration agent starting...";
+-  if (!isAlreadyMigrated()) {
++  {
+     if (connectOldDaemon()) {
+       if (!isEmptyOldWallet()) {
+         if (isMigrationWizardOk()) {
+@@ -70,8 +74,6 @@ void MigrationAgent::migrateWallets()
+     } else {
+       qDebug() << "KDE4 kwalletd not present, stopping migration agent";
+     }
+-  } else {
+-    qDebug() << "old wallets were already migrated";
+   }
+   qDebug() << "Migration agent stop.";
+ }
+-- 
+2.12.0
+

diff --git a/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-3.patch 
b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-3.patch
new file mode 100644
index 00000000000..f993faf95cf
--- /dev/null
+++ b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-3.patch
@@ -0,0 +1,51 @@
+From 574fdd416b5f6b0907826034916c03dddb08341a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]>
+Date: Sun, 31 May 2015 06:47:55 +0200
+Subject: [PATCH 3/5] Whitespace fixup
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Stefan Brüns <[email protected]>
+---
+ src/runtime/kwalletd/migrationagent.cpp | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/src/runtime/kwalletd/migrationagent.cpp 
b/src/runtime/kwalletd/migrationagent.cpp
+index 110a5e0..ec60812 100644
+--- a/src/runtime/kwalletd/migrationagent.cpp
++++ b/src/runtime/kwalletd/migrationagent.cpp
+@@ -59,21 +59,19 @@ void MigrationAgent::migrateWallets()
+   // if the migration wizard returns without error
+   // create "alreadyMigrated=true" setting
+   qDebug() << "Migration agent starting...";
+-  {
+-    if (connectOldDaemon()) {
+-      if (!isEmptyOldWallet()) {
+-        if (isMigrationWizardOk()) {
+-          setAlreadyMigrated();
+-        } else {
+-          qDebug() << "Migration wizard returned an error or has been 
canceled. The migration agent will resume upon next daemon start";
+-        }
+-      } else {
+-        qDebug() << "Old wallet is empty. No need to migrate.";
++  if (connectOldDaemon()) {
++    if (!isEmptyOldWallet()) {
++      if (isMigrationWizardOk()) {
+         setAlreadyMigrated();
++      } else {
++        qDebug() << "Migration wizard returned an error or has been canceled. 
The migration agent will resume upon next daemon start";
+       }
+     } else {
+-      qDebug() << "KDE4 kwalletd not present, stopping migration agent";
++      qDebug() << "Old wallet is empty. No need to migrate.";
++      setAlreadyMigrated();
+     }
++  } else {
++    qDebug() << "KDE4 kwalletd not present, stopping migration agent";
+   }
+   qDebug() << "Migration agent stop.";
+ }
+-- 
+2.12.0
+

diff --git a/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-4.patch 
b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-4.patch
new file mode 100644
index 00000000000..a0cc6d73f51
--- /dev/null
+++ b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-4.patch
@@ -0,0 +1,60 @@
+From 8d5636d8185cf3a572a9b81a9b9246eb6371685b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]>
+Date: Sun, 31 May 2015 06:49:46 +0200
+Subject: [PATCH 4/5] Signal completion of migration agent
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Stefan Brüns <[email protected]>
+---
+ src/runtime/kwalletd/migrationagent.cpp | 4 ++++
+ src/runtime/kwalletd/migrationagent.h   | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git a/src/runtime/kwalletd/migrationagent.cpp 
b/src/runtime/kwalletd/migrationagent.cpp
+index ec60812..6eb6013 100644
+--- a/src/runtime/kwalletd/migrationagent.cpp
++++ b/src/runtime/kwalletd/migrationagent.cpp
+@@ -43,6 +43,7 @@ MigrationAgent::MigrationAgent(KWalletD* kd, const char 
*hash) :
+ {
+   if (isAlreadyMigrated()) {
+     qDebug() << "old wallets were already migrated";
++    emit migrationFinished();
+   } else {
+     QTimer::singleShot(100, this, SLOT(migrateWallets()));
+   }
+@@ -63,15 +64,18 @@ void MigrationAgent::migrateWallets()
+     if (!isEmptyOldWallet()) {
+       if (isMigrationWizardOk()) {
+         setAlreadyMigrated();
++        emit migrationFinished();
+       } else {
+         qDebug() << "Migration wizard returned an error or has been canceled. 
The migration agent will resume upon next daemon start";
+       }
+     } else {
+       qDebug() << "Old wallet is empty. No need to migrate.";
+       setAlreadyMigrated();
++      emit migrationFinished();
+     }
+   } else {
+     qDebug() << "KDE4 kwalletd not present, stopping migration agent";
++    emit migrationFinished();
+   }
+   qDebug() << "Migration agent stop.";
+ }
+diff --git a/src/runtime/kwalletd/migrationagent.h 
b/src/runtime/kwalletd/migrationagent.h
+index 0f6467c..9c974a0 100644
+--- a/src/runtime/kwalletd/migrationagent.h
++++ b/src/runtime/kwalletd/migrationagent.h
+@@ -48,6 +48,7 @@ public Q_SLOTS:
+ 
+ Q_SIGNALS:
+     void progressMessage(const QString &);
++    void migrationFinished();
+ 
+ private:
+     KWalletD          *_kf5_daemon;
+-- 
+2.12.0
+

diff --git a/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-5.patch 
b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-5.patch
new file mode 100644
index 00000000000..21f4a3509a9
--- /dev/null
+++ b/kde-frameworks/kwallet/files/kwallet-5.34.0-kwalletd4-5.patch
@@ -0,0 +1,68 @@
+From e9d8932d04a7882471f722800b7b4603074d560d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <[email protected]>
+Date: Sun, 31 May 2015 07:03:31 +0200
+Subject: [PATCH 5/5] Replace kwalletd4 after migration has finished
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+kwalletd5 can service both org.kde.kwalletd5 and org.kde.kwalletd
+
+Signed-off-by: Stefan Brüns <[email protected]>
+---
+ src/runtime/kwalletd/kwalletd.cpp       | 13 +++++++++++++
+ src/runtime/kwalletd/kwalletd.h         |  1 +
+ src/runtime/kwalletd/migrationagent.cpp |  1 +
+ 3 files changed, 15 insertions(+)
+
+diff --git a/src/runtime/kwalletd/kwalletd.cpp 
b/src/runtime/kwalletd/kwalletd.cpp
+index 18ef9fa..da851da 100644
+--- a/src/runtime/kwalletd/kwalletd.cpp
++++ b/src/runtime/kwalletd/kwalletd.cpp
+@@ -151,6 +151,19 @@ KWalletD::KWalletD()
+         SLOT(slotServiceOwnerChanged(QString, QString, QString)));
+ }
+ 
++void KWalletD::registerKWalletd4Service()
++{
++    auto bus = QDBusConnection::sessionBus().interface();
++    auto reply = bus->registerService(QLatin1String("org.kde.kwalletd"), 
QDBusConnectionInterface::QueueService);
++    if (reply.isValid() && (reply.value() == 
QDBusConnectionInterface::ServiceQueued)) {
++      QDBusInterface _kde_kwalletd4("org.kde.kwalletd", "/MainApplication", 
"org.kde.KApplication");
++      if (_kde_kwalletd4.isValid()) {
++      auto qreply = _kde_kwalletd4.call("quit");
++      }
++    }
++    
QDBusConnection::sessionBus().registerObject(QLatin1String("/modules/kwalletd"),
 this);
++}
++
+ KWalletD::~KWalletD()
+ {
+ #ifdef Q_WS_X11
+diff --git a/src/runtime/kwalletd/kwalletd.h b/src/runtime/kwalletd/kwalletd.h
+index 3571535..a862faf 100644
+--- a/src/runtime/kwalletd/kwalletd.h
++++ b/src/runtime/kwalletd/kwalletd.h
+@@ -182,6 +182,7 @@ private Q_SLOTS:
+     void notifyFailures();
+     void processTransactions();
+     void activatePasswordDialog();
++    void registerKWalletd4Service();
+ #ifdef Q_WS_X11
+     void connectToScreenSaver();
+ #endif
+diff --git a/src/runtime/kwalletd/migrationagent.cpp 
b/src/runtime/kwalletd/migrationagent.cpp
+index 6eb6013..639ee8d 100644
+--- a/src/runtime/kwalletd/migrationagent.cpp
++++ b/src/runtime/kwalletd/migrationagent.cpp
+@@ -41,6 +41,7 @@ MigrationAgent::MigrationAgent(KWalletD* kd, const char 
*hash) :
+   , _kde4_daemon(nullptr)
+   , _pam_hash(hash)
+ {
++  connect(this, &MigrationAgent::migrationFinished, _kf5_daemon, 
&KWalletD::registerKWalletd4Service);
+   if (isAlreadyMigrated()) {
+     qDebug() << "old wallets were already migrated";
+     emit migrationFinished();
+-- 
+2.12.0
+

diff --git a/kde-frameworks/kwallet/kwallet-5.34.0-r1.ebuild 
b/kde-frameworks/kwallet/kwallet-5.34.0-r1.ebuild
new file mode 100644
index 00000000000..e3a6046953b
--- /dev/null
+++ b/kde-frameworks/kwallet/kwallet-5.34.0-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit kde5
+
+DESCRIPTION="Framework providing desktop-wide storage for passwords"
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="gpg +man"
+
+RDEPEND="
+       $(add_frameworks_dep kconfig)
+       $(add_frameworks_dep kconfigwidgets)
+       $(add_frameworks_dep kcoreaddons)
+       $(add_frameworks_dep kdbusaddons)
+       $(add_frameworks_dep ki18n)
+       $(add_frameworks_dep kiconthemes)
+       $(add_frameworks_dep knotifications)
+       $(add_frameworks_dep kservice)
+       $(add_frameworks_dep kwidgetsaddons)
+       $(add_frameworks_dep kwindowsystem)
+       $(add_qt_dep qtdbus)
+       $(add_qt_dep qtgui)
+       $(add_qt_dep qtwidgets)
+       dev-libs/libgcrypt:0=
+       gpg? ( >=app-crypt/gpgme-1.7.1[cxx,qt5] )
+"
+DEPEND="${RDEPEND}
+       man? ( $(add_frameworks_dep kdoctools) )
+"
+
+PATCHES=( "${FILESDIR}"/${PN}-5.34.0-kwalletd4-{1,2,3,4,5}.patch )
+
+src_configure() {
+       local mycmakeargs=(
+               $(cmake-utils_use_find_package gpg Gpgmepp)
+               $(cmake-utils_use_find_package man KF5DocTools)
+       )
+
+       kde5_src_configure
+}
+
+pkg_postinst() {
+       if ! has_version "kde-plasma/kwallet-pam" || ! has_version 
"kde-apps/kwalletmanager:5" ; then
+               elog
+               elog "Install kde-plasma/kwallet-pam for auto-unlocking after 
account login."
+               elog "Install kde-apps/kwalletmanager:5 to manage your kwallet."
+               elog
+       fi
+       if has_version "kde-apps/kwalletd"; then
+               elog "Starting with 5.34.0-r1, ${PN} is able to serve 
applications"
+               elog "that still require old kwalletd4. After migration has 
finished,"
+               elog "kde-apps/kwalletd can be removed."
+       fi
+}

Reply via email to