From fc0f53482ecd49e9e2855e6c71959cf669fd99c6 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 17:51:21 +0100 Subject: [PATCH 1/9] uninstall Gittyup versions before installing a new one --- src/update/Updater.cpp | 29 +++++++++++++++++++++++++++++ src/update/Updater.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/src/update/Updater.cpp b/src/update/Updater.cpp index ef454de5..bbe5d88a 100644 --- a/src/update/Updater.cpp +++ b/src/update/Updater.cpp @@ -271,9 +271,37 @@ Updater *Updater::instance() { } #if defined(FLATPAK) || defined(DEBUG_FLATPAK) +bool Updater::uninstallGittyup(bool system) { + QString bash = git::Command::bashPath(); + QString loc = system ? "--system" : "--user"; + + QStringList args; + args.append("-c"); + args.append( + QString( + "flatpak-spawn --host flatpak remove %1 com.github.Murmele.Gittyup") + .arg(loc)); + auto *p = new QProcess(this); + + p->start(bash, args); + if (!p->waitForFinished()) { + const QString es = p->errorString(); + qDebug() << "Uninstalling Gittyup failed: " + es; + return false; + } else { + qDebug() << "Uninstall: " + p->readAll(); + } + p->deleteLater(); + return true; +} + bool Updater::install(const DownloadRef &download, QString &error) { QString path = download->file()->fileName(); + // Ignore return value + uninstallGittyup(true); + uninstallGittyup(false); + QDir dir(QCoreApplication::applicationDirPath()); QStringList args; args.append("-c"); @@ -294,6 +322,7 @@ bool Updater::install(const DownloadRef &download, QString &error) { } else { qDebug() << "Successfully installed bundle: " + p->readAll(); } + p->deleteLater(); auto relauncher_cmd = dir.filePath("relauncher"); qDebug() << "Relauncher command: " << relauncher_cmd; diff --git a/src/update/Updater.h b/src/update/Updater.h index 29c33cb3..bd767c07 100644 --- a/src/update/Updater.h +++ b/src/update/Updater.h @@ -62,6 +62,10 @@ private: bool install(const DownloadRef &download, QString &error); +#if defined(FLATPAK) || defined(DEBUG_FLATPAK) + bool uninstallGittyup(bool system); +#endif + QNetworkAccessManager mMgr; }; From e1f8ec18dfdcd8b8e4032bd96d8cb171ad2a345b Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 17:52:51 +0100 Subject: [PATCH 2/9] increase version --- CMakeLists.txt | 2 +- docs/changelog.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1ca20d2..8f58abfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Gittyup) set(GITTYUP_NAME "Gittyup") set(GITTYUP_VERSION_MAJOR 1) set(GITTYUP_VERSION_MINOR 2) -set(GITTYUP_VERSION_PATCH 1) +set(GITTYUP_VERSION_PATCH 2) set(GITTYUP_VERSION "${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}" ) diff --git a/docs/changelog.md b/docs/changelog.md index aee7fd05..110b1d10 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,11 @@ +### v1.2.2 - 2023-01-22 + +Bug fix release + +#### Changed + +* Fix flatpak install process + ### v1.2.1 - 2023-01-22 Bug fix release From 3d0ede46d69f53432f8b88161fd6ecc7a0c275b2 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 17:54:25 +0100 Subject: [PATCH 3/9] decrease version for testing --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f58abfa..ba5f60d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Gittyup) set(GITTYUP_NAME "Gittyup") set(GITTYUP_VERSION_MAJOR 1) set(GITTYUP_VERSION_MINOR 2) -set(GITTYUP_VERSION_PATCH 2) +set(GITTYUP_VERSION_PATCH 0) set(GITTYUP_VERSION "${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}" ) From 4fc5eca08fb562d24b0107c54d0a55438dc08e23 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 18:10:40 +0100 Subject: [PATCH 4/9] missing version separator --- docs/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 110b1d10..5bace189 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,8 @@ Bug fix release * Fix flatpak install process +---- + ### v1.2.1 - 2023-01-22 Bug fix release From 1ffcdced3472988b0b1d883a3f6aaa83c8bd81b2 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 18:30:51 +0100 Subject: [PATCH 5/9] set correct version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5f60d6..8f58abfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Gittyup) set(GITTYUP_NAME "Gittyup") set(GITTYUP_VERSION_MAJOR 1) set(GITTYUP_VERSION_MINOR 2) -set(GITTYUP_VERSION_PATCH 0) +set(GITTYUP_VERSION_PATCH 2) set(GITTYUP_VERSION "${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}" ) From 25f40e4612d0eb7e5a757afdcf57ab6931cc161a Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 18:30:51 +0100 Subject: [PATCH 6/9] Revert "set correct version" This reverts commit 1ffcdced3472988b0b1d883a3f6aaa83c8bd81b2. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f58abfa..ba5f60d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Gittyup) set(GITTYUP_NAME "Gittyup") set(GITTYUP_VERSION_MAJOR 1) set(GITTYUP_VERSION_MINOR 2) -set(GITTYUP_VERSION_PATCH 2) +set(GITTYUP_VERSION_PATCH 0) set(GITTYUP_VERSION "${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}" ) From 8b66d81c04b247d08e8a41f5f2cf417289beed07 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 18:32:07 +0100 Subject: [PATCH 7/9] assume yes otherwise the application will not be deleted --- src/update/Updater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/update/Updater.cpp b/src/update/Updater.cpp index bbe5d88a..dc94e725 100644 --- a/src/update/Updater.cpp +++ b/src/update/Updater.cpp @@ -279,7 +279,7 @@ bool Updater::uninstallGittyup(bool system) { args.append("-c"); args.append( QString( - "flatpak-spawn --host flatpak remove %1 com.github.Murmele.Gittyup") + "flatpak-spawn --host flatpak remove -y %1 com.github.Murmele.Gittyup") .arg(loc)); auto *p = new QProcess(this); From a29ad94a7390b87ee2171d077e742f0a32317d67 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 18:42:56 +0100 Subject: [PATCH 8/9] format --- src/update/Updater.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/update/Updater.cpp b/src/update/Updater.cpp index dc94e725..d6d23a11 100644 --- a/src/update/Updater.cpp +++ b/src/update/Updater.cpp @@ -277,10 +277,9 @@ bool Updater::uninstallGittyup(bool system) { QStringList args; args.append("-c"); - args.append( - QString( - "flatpak-spawn --host flatpak remove -y %1 com.github.Murmele.Gittyup") - .arg(loc)); + args.append(QString("flatpak-spawn --host flatpak remove -y %1 " + "com.github.Murmele.Gittyup") + .arg(loc)); auto *p = new QProcess(this); p->start(bash, args); From 196b8c643de7eb101a9a8705817b04fa0e2dd646 Mon Sep 17 00:00:00 2001 From: Martin Marmsoler Date: Sun, 22 Jan 2023 19:02:10 +0100 Subject: [PATCH 9/9] increase version again --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5f60d6..8f58abfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(Gittyup) set(GITTYUP_NAME "Gittyup") set(GITTYUP_VERSION_MAJOR 1) set(GITTYUP_VERSION_MINOR 2) -set(GITTYUP_VERSION_PATCH 0) +set(GITTYUP_VERSION_PATCH 2) set(GITTYUP_VERSION "${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}" )