Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/keepassxc/, app-admin/keepassxc/files/
Date: Thu, 11 Apr 2019 16:55:54
Message-Id: 1555001746.3d143186fdafa5a2041c6172845b486a55607be8.polynomial-c@gentoo
1 commit: 3d143186fdafa5a2041c6172845b486a55607be8
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 11 16:52:09 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 11 16:55:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d143186
7
8 app-admin/keepassxc: Revbump to disable update checker
9
10 Package-Manager: Portage-2.3.62, Repoman-2.3.12
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 .../keepassxc-2.4.0-update_checker_toggle.patch | 444 +++++++++++++++++++++
14 app-admin/keepassxc/keepassxc-2.4.0-r1.ebuild | 102 +++++
15 2 files changed, 546 insertions(+)
16
17 diff --git a/app-admin/keepassxc/files/keepassxc-2.4.0-update_checker_toggle.patch b/app-admin/keepassxc/files/keepassxc-2.4.0-update_checker_toggle.patch
18 new file mode 100644
19 index 00000000000..bca65f3b4ae
20 --- /dev/null
21 +++ b/app-admin/keepassxc/files/keepassxc-2.4.0-update_checker_toggle.patch
22 @@ -0,0 +1,444 @@
23 +From 64fe9de385be43212a83c0c89791a95af203eef9 Mon Sep 17 00:00:00 2001
24 +From: Jonathan White <support@××××××.us>
25 +Date: Tue, 9 Apr 2019 21:06:13 -0400
26 +Subject: [PATCH] Enhance update checker
27 +
28 +* Reduce initial update check notification to 500 ms to prevent inappropriately stealing focus from user
29 +* Add build flag WITH_XC_UPDATECHECK which defaults to ON
30 +* Update checks are resolved every 7 days instead of every time the application is started
31 +* Better checks for beta builds; ignore snapshots
32 +* Increase test cases
33 +---
34 + CMakeLists.txt | 5 ++
35 + src/CMakeLists.txt | 1 +
36 + src/config-keepassx.h.cmake | 1 +
37 + src/core/Clock.cpp | 1 +
38 + src/gui/ApplicationSettingsWidget.cpp | 25 ++++++-
39 + src/gui/ApplicationSettingsWidget.h | 1 +
40 + src/gui/ApplicationSettingsWidgetGeneral.ui | 39 +++++++---
41 + src/gui/MainWindow.cpp | 12 ++--
42 + src/updatecheck/UpdateChecker.cpp | 79 +++++++++++++--------
43 + src/updatecheck/UpdateChecker.h | 2 +-
44 + tests/TestUpdateCheck.cpp | 35 ++++++---
45 + 11 files changed, 146 insertions(+), 55 deletions(-)
46 +
47 +diff --git a/CMakeLists.txt b/CMakeLists.txt
48 +index 658548f7..4f8a419c 100644
49 +--- a/CMakeLists.txt
50 ++++ b/CMakeLists.txt
51 +@@ -49,6 +49,7 @@ option(WITH_XC_YUBIKEY "Include YubiKey support." OFF)
52 + option(WITH_XC_SSHAGENT "Include SSH agent support." OFF)
53 + option(WITH_XC_KEESHARE "Sharing integration with KeeShare" OFF)
54 + option(WITH_XC_KEESHARE_SECURE "Sharing integration with secured KeeShare containers" OFF)
55 ++option(WITH_XC_UPDATECHECK "Include automatic update checks; disable for controlled distributions" ON)
56 + if(APPLE)
57 + option(WITH_XC_TOUCHID "Include TouchID support for macOS." OFF)
58 + endif()
59 +@@ -76,6 +77,10 @@ else()
60 + set(WITH_XC_CRYPTO_SSH OFF)
61 + endif()
62 +
63 ++if(WITH_XC_UPDATECHECK)
64 ++ set(WITH_XC_NETWORKING ON)
65 ++endif()
66 ++
67 + set(KEEPASSXC_VERSION_MAJOR "2")
68 + set(KEEPASSXC_VERSION_MINOR "4")
69 + set(KEEPASSXC_VERSION_PATCH "0")
70 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
71 +index 110dc606..31f29033 100644
72 +--- a/src/CMakeLists.txt
73 ++++ b/src/CMakeLists.txt
74 +@@ -195,6 +195,7 @@ add_feature_info(SSHAgent WITH_XC_SSHAGENT "SSH agent integration compatible wit
75 + add_feature_info(KeeShare WITH_XC_KEESHARE "Sharing integration with KeeShare")
76 + add_feature_info(KeeShare-Secure WITH_XC_KEESHARE_SECURE "Sharing integration with KeeShare with secure sources")
77 + add_feature_info(YubiKey WITH_XC_YUBIKEY "YubiKey HMAC-SHA1 challenge-response")
78 ++add_feature_info(UpdateCheck WITH_XC_UPDATECHECK "Automatic update checking")
79 + if(APPLE)
80 + add_feature_info(TouchID WITH_XC_TOUCHID "TouchID integration")
81 + endif()
82 +diff --git a/src/config-keepassx.h.cmake b/src/config-keepassx.h.cmake
83 +index 7d701886..2acff446 100644
84 +--- a/src/config-keepassx.h.cmake
85 ++++ b/src/config-keepassx.h.cmake
86 +@@ -20,6 +20,7 @@
87 + #cmakedefine WITH_XC_KEESHARE
88 + #cmakedefine WITH_XC_KEESHARE_INSECURE
89 + #cmakedefine WITH_XC_KEESHARE_SECURE
90 ++#cmakedefine WITH_XC_UPDATECHECK
91 + #cmakedefine WITH_XC_TOUCHID
92 +
93 + #cmakedefine KEEPASSXC_BUILD_TYPE "@KEEPASSXC_BUILD_TYPE@"
94 +diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
95 +index 88ac4fb7..be9e91dc 100644
96 +--- a/src/core/Clock.cpp
97 ++++ b/src/core/Clock.cpp
98 +@@ -30,6 +30,7 @@ QDateTime Clock::currentDateTime()
99 +
100 + uint Clock::currentSecondsSinceEpoch()
101 + {
102 ++ // TODO: change to toSecsSinceEpoch() when min Qt >= 5.8
103 + return instance().currentDateTimeImpl().toTime_t();
104 + }
105 +
106 +diff --git a/src/gui/ApplicationSettingsWidget.cpp b/src/gui/ApplicationSettingsWidget.cpp
107 +index 90b851bd..e6a7068d 100644
108 +--- a/src/gui/ApplicationSettingsWidget.cpp
109 ++++ b/src/gui/ApplicationSettingsWidget.cpp
110 +@@ -91,8 +91,15 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
111 + m_secUi->touchIDResetSpinBox, SLOT(setEnabled(bool)));
112 + // clang-format on
113 +
114 +-#ifndef WITH_XC_NETWORKING
115 ++#ifdef WITH_XC_UPDATECHECK
116 ++ connect(m_generalUi->checkForUpdatesOnStartupCheckBox, SIGNAL(toggled(bool)), SLOT(checkUpdatesToggled(bool)));
117 ++#else
118 + m_generalUi->checkForUpdatesOnStartupCheckBox->setVisible(false);
119 ++ m_generalUi->checkForUpdatesIncludeBetasCheckBox->setVisible(false);
120 ++ m_generalUi->checkUpdatesSpacer->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed);
121 ++#endif
122 ++
123 ++#ifndef WITH_XC_NETWORKING
124 + m_secUi->privacy->setVisible(false);
125 + #endif
126 +
127 +@@ -336,3 +343,19 @@ void ApplicationSettingsWidget::enableToolbarSettings(bool checked)
128 + m_generalUi->toolButtonStyleComboBox->setEnabled(!checked);
129 + m_generalUi->toolButtonStyleLabel->setEnabled(!checked);
130 + }
131 ++
132 ++void ApplicationSettingsWidget::rememberDatabasesToggled(bool checked)
133 ++{
134 ++ if (!checked) {
135 ++ m_generalUi->rememberLastKeyFilesCheckBox->setChecked(false);
136 ++ m_generalUi->openPreviousDatabasesOnStartupCheckBox->setChecked(false);
137 ++ }
138 ++
139 ++ m_generalUi->rememberLastKeyFilesCheckBox->setEnabled(checked);
140 ++ m_generalUi->openPreviousDatabasesOnStartupCheckBox->setEnabled(checked);
141 ++}
142 ++
143 ++void ApplicationSettingsWidget::checkUpdatesToggled(bool checked)
144 ++{
145 ++ m_generalUi->checkForUpdatesIncludeBetasCheckBox->setEnabled(checked);
146 ++}
147 +diff --git a/src/gui/ApplicationSettingsWidget.h b/src/gui/ApplicationSettingsWidget.h
148 +index ffcfea2b..8cdc7ed7 100644
149 +--- a/src/gui/ApplicationSettingsWidget.h
150 ++++ b/src/gui/ApplicationSettingsWidget.h
151 +@@ -56,6 +56,7 @@ private slots:
152 + void autoSaveToggled(bool checked);
153 + void systrayToggled(bool checked);
154 + void enableToolbarSettings(bool checked);
155 ++ void checkUpdatesToggled(bool checked);
156 +
157 + private:
158 + QWidget* const m_secWidget;
159 +diff --git a/src/gui/ApplicationSettingsWidgetGeneral.ui b/src/gui/ApplicationSettingsWidgetGeneral.ui
160 +index 798971bf..678b55fa 100644
161 +--- a/src/gui/ApplicationSettingsWidgetGeneral.ui
162 ++++ b/src/gui/ApplicationSettingsWidgetGeneral.ui
163 +@@ -86,10 +86,40 @@
164 + <item>
165 + <widget class="QCheckBox" name="checkForUpdatesOnStartupCheckBox">
166 + <property name="text">
167 +- <string>Check for updates at application startup</string>
168 ++ <string>Check for updates at application startup once per week</string>
169 + </property>
170 + </widget>
171 + </item>
172 ++ <item>
173 ++ <layout class="QHBoxLayout" name="checkUpdatesSubLayout">
174 ++ <property name="spacing">
175 ++ <number>0</number>
176 ++ </property>
177 ++ <item>
178 ++ <spacer name="checkUpdatesSpacer">
179 ++ <property name="orientation">
180 ++ <enum>Qt::Horizontal</enum>
181 ++ </property>
182 ++ <property name="sizeType">
183 ++ <enum>QSizePolicy::Fixed</enum>
184 ++ </property>
185 ++ <property name="sizeHint" stdset="0">
186 ++ <size>
187 ++ <width>20</width>
188 ++ <height>20</height>
189 ++ </size>
190 ++ </property>
191 ++ </spacer>
192 ++ </item>
193 ++ <item>
194 ++ <widget class="QCheckBox" name="checkForUpdatesIncludeBetasCheckBox">
195 ++ <property name="text">
196 ++ <string>Include beta releases when checking for updates</string>
197 ++ </property>
198 ++ </widget>
199 ++ </item>
200 ++ </layout>
201 ++ </item>
202 + </layout>
203 + </widget>
204 + </item>
205 +@@ -186,13 +216,6 @@
206 + <string>General</string>
207 + </property>
208 + <layout class="QVBoxLayout" name="verticalLayout_7">
209 +- <item>
210 +- <widget class="QCheckBox" name="checkForUpdatesIncludeBetasCheckBox">
211 +- <property name="text">
212 +- <string>Include pre-releases when checking for updates</string>
213 +- </property>
214 +- </widget>
215 +- </item>
216 + <item>
217 + <widget class="QCheckBox" name="toolbarHideCheckBox">
218 + <property name="text">
219 +diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
220 +index 6e3c96af..6776a59d 100644
221 +--- a/src/gui/MainWindow.cpp
222 ++++ b/src/gui/MainWindow.cpp
223 +@@ -41,7 +41,7 @@
224 + #include "keys/FileKey.h"
225 + #include "keys/PasswordKey.h"
226 +
227 +-#ifdef WITH_XC_NETWORKING
228 ++#ifdef WITH_XC_UPDATECHECK
229 + #include "gui/MessageBox.h"
230 + #include "gui/UpdateCheckDialog.h"
231 + #include "updatecheck/UpdateChecker.h"
232 +@@ -372,12 +372,12 @@ MainWindow::MainWindow()
233 + setUnifiedTitleAndToolBarOnMac(true);
234 + #endif
235 +
236 +-#ifdef WITH_XC_NETWORKING
237 ++#ifdef WITH_XC_UPDATECHECK
238 + connect(m_ui->actionCheckForUpdates, SIGNAL(triggered()), SLOT(showUpdateCheckDialog()));
239 + connect(UpdateChecker::instance(),
240 + SIGNAL(updateCheckFinished(bool, QString, bool)),
241 + SLOT(hasUpdateAvailable(bool, QString, bool)));
242 +- QTimer::singleShot(3000, this, SLOT(showUpdateCheckStartup()));
243 ++ QTimer::singleShot(500, this, SLOT(showUpdateCheckStartup()));
244 + #else
245 + m_ui->actionCheckForUpdates->setVisible(false);
246 + #endif
247 +@@ -687,7 +687,7 @@ void MainWindow::showAboutDialog()
248 +
249 + void MainWindow::showUpdateCheckStartup()
250 + {
251 +-#ifdef WITH_XC_NETWORKING
252 ++#ifdef WITH_XC_UPDATECHECK
253 + if (!config()->get("UpdateCheckMessageShown", false).toBool()) {
254 + auto result =
255 + MessageBox::question(this,
256 +@@ -710,7 +710,7 @@ void MainWindow::showUpdateCheckStartup()
257 +
258 + void MainWindow::hasUpdateAvailable(bool hasUpdate, const QString& version, bool isManuallyRequested)
259 + {
260 +-#ifdef WITH_XC_NETWORKING
261 ++#ifdef WITH_XC_UPDATECHECK
262 + if (hasUpdate && !isManuallyRequested) {
263 + auto* updateCheckDialog = new UpdateCheckDialog(this);
264 + updateCheckDialog->showUpdateCheckResponse(hasUpdate, version);
265 +@@ -725,7 +725,7 @@ void MainWindow::hasUpdateAvailable(bool hasUpdate, const QString& version, bool
266 +
267 + void MainWindow::showUpdateCheckDialog()
268 + {
269 +-#ifdef WITH_XC_NETWORKING
270 ++#ifdef WITH_XC_UPDATECHECK
271 + updateCheck()->checkForUpdates(true);
272 + auto* updateCheckDialog = new UpdateCheckDialog(this);
273 + updateCheckDialog->show();
274 +diff --git a/src/updatecheck/UpdateChecker.cpp b/src/updatecheck/UpdateChecker.cpp
275 +index 4272410b..14531290 100644
276 +--- a/src/updatecheck/UpdateChecker.cpp
277 ++++ b/src/updatecheck/UpdateChecker.cpp
278 +@@ -17,6 +17,7 @@
279 +
280 + #include "UpdateChecker.h"
281 + #include "config-keepassx.h"
282 ++#include "core/Clock.h"
283 + #include "core/Config.h"
284 + #include <QJsonObject>
285 + #include <QNetworkAccessManager>
286 +@@ -38,24 +39,28 @@ UpdateChecker::~UpdateChecker()
287 +
288 + void UpdateChecker::checkForUpdates(bool manuallyRequested)
289 + {
290 ++ auto nextCheck = config()->get("GUI/CheckForUpdatesNextCheck", 0).toULongLong();
291 + m_isManuallyRequested = manuallyRequested;
292 +- m_bytesReceived.clear();
293 +
294 +- QString apiUrlStr = QString("https://api.github.com/repos/keepassxreboot/keepassxc/releases");
295 ++ if (m_isManuallyRequested || Clock::currentSecondsSinceEpoch() >= nextCheck) {
296 ++ m_bytesReceived.clear();
297 +
298 +- if (!config()->get("GUI/CheckForUpdatesIncludeBetas", false).toBool()) {
299 +- apiUrlStr += "/latest";
300 +- }
301 ++ QString apiUrlStr = QString("https://api.github.com/repos/keepassxreboot/keepassxc/releases");
302 ++
303 ++ if (!config()->get("GUI/CheckForUpdatesIncludeBetas", false).toBool()) {
304 ++ apiUrlStr += "/latest";
305 ++ }
306 +
307 +- QUrl apiUrl = QUrl(apiUrlStr);
308 ++ QUrl apiUrl = QUrl(apiUrlStr);
309 +
310 +- QNetworkRequest request(apiUrl);
311 +- request.setRawHeader("Accept", "application/json");
312 ++ QNetworkRequest request(apiUrl);
313 ++ request.setRawHeader("Accept", "application/json");
314 +
315 +- m_reply = m_netMgr->get(request);
316 ++ m_reply = m_netMgr->get(request);
317 +
318 +- connect(m_reply, &QNetworkReply::finished, this, &UpdateChecker::fetchFinished);
319 +- connect(m_reply, &QIODevice::readyRead, this, &UpdateChecker::fetchReadyRead);
320 ++ connect(m_reply, &QNetworkReply::finished, this, &UpdateChecker::fetchFinished);
321 ++ connect(m_reply, &QIODevice::readyRead, this, &UpdateChecker::fetchReadyRead);
322 ++ }
323 + }
324 +
325 + void UpdateChecker::fetchReadyRead()
326 +@@ -84,8 +89,12 @@ void UpdateChecker::fetchFinished()
327 +
328 + if (!jsonObject.value("tag_name").isUndefined()) {
329 + version = jsonObject.value("tag_name").toString();
330 +- hasNewVersion = compareVersions(version, QString(KEEPASSXC_VERSION));
331 ++ hasNewVersion = compareVersions(QString(KEEPASSXC_VERSION), version);
332 + }
333 ++
334 ++ // Check again in 7 days
335 ++ // TODO: change to toSecsSinceEpoch() when min Qt >= 5.8
336 ++ config()->set("GUI/CheckForUpdatesNextCheck", Clock::currentDateTime().addDays(7).toTime_t());
337 + } else {
338 + version = "error";
339 + }
340 +@@ -93,38 +102,46 @@ void UpdateChecker::fetchFinished()
341 + emit updateCheckFinished(hasNewVersion, version, m_isManuallyRequested);
342 + }
343 +
344 +-bool UpdateChecker::compareVersions(const QString& remoteVersion, const QString& localVersion)
345 ++bool UpdateChecker::compareVersions(const QString& localVersion, const QString& remoteVersion)
346 + {
347 ++ // Quick full-string equivalence check
348 + if (localVersion == remoteVersion) {
349 +- return false; // Currently using updated version
350 ++ return false;
351 + }
352 +
353 +- QRegularExpression verRegex("^(\\d+(\\.\\d+){0,2})(-\\w+)?$", QRegularExpression::CaseInsensitiveOption);
354 ++ QRegularExpression verRegex(R"(^((?:\d+\.){2}\d+)(?:-(\w+?)(\d+)?)?$)");
355 +
356 +- QRegularExpressionMatch lmatch = verRegex.match(localVersion);
357 +- QRegularExpressionMatch rmatch = verRegex.match(remoteVersion);
358 ++ auto lmatch = verRegex.match(localVersion);
359 ++ auto rmatch = verRegex.match(remoteVersion);
360 +
361 +- if (!lmatch.captured(1).isNull() && !rmatch.captured(1).isNull()) {
362 +- if (lmatch.captured(1) == rmatch.captured(1) && !lmatch.captured(3).isNull()) {
363 +- // Same version, but installed version has snapshot/beta suffix and should be updated to stable
364 +- return true;
365 +- }
366 ++ auto lVersion = lmatch.captured(1).split(".");
367 ++ auto lSuffix = lmatch.captured(2);
368 ++ auto lBetaNum = lmatch.captured(3);
369 +
370 +- QStringList lparts = lmatch.captured(1).split(".");
371 +- QStringList rparts = rmatch.captured(1).split(".");
372 ++ auto rVersion = rmatch.captured(1).split(".");
373 ++ auto rSuffix = rmatch.captured(2);
374 ++ auto rBetaNum = rmatch.captured(3);
375 +
376 +- if (lparts.length() < 3)
377 +- lparts << "0";
378 ++ if (!lVersion.isEmpty() && !rVersion.isEmpty()) {
379 ++ if (lSuffix.compare("snapshot", Qt::CaseInsensitive) == 0) {
380 ++ // Snapshots are not checked for version updates
381 ++ return false;
382 ++ }
383 +
384 +- if (rparts.length() < 3)
385 +- rparts << "0";
386 ++ // Check "-beta[X]" versions
387 ++ if (lVersion == rVersion && !lSuffix.isEmpty()) {
388 ++ // Check if stable version has been released or new beta is available
389 ++ // otherwise the version numbers are equal
390 ++ return rSuffix.isEmpty() || lBetaNum.toInt() < rBetaNum.toInt();
391 ++ }
392 +
393 + for (int i = 0; i < 3; i++) {
394 +- int l = lparts[i].toInt();
395 +- int r = rparts[i].toInt();
396 ++ int l = lVersion[i].toInt();
397 ++ int r = rVersion[i].toInt();
398 +
399 +- if (l == r)
400 ++ if (l == r) {
401 + continue;
402 ++ }
403 +
404 + if (l > r) {
405 + return false; // Installed version is newer than release
406 +diff --git a/src/updatecheck/UpdateChecker.h b/src/updatecheck/UpdateChecker.h
407 +index ac6471d6..64430bda 100644
408 +--- a/src/updatecheck/UpdateChecker.h
409 ++++ b/src/updatecheck/UpdateChecker.h
410 +@@ -31,7 +31,7 @@ public:
411 + ~UpdateChecker() override;
412 +
413 + void checkForUpdates(bool manuallyRequested);
414 +- static bool compareVersions(const QString& remoteVersion, const QString& localVersion);
415 ++ static bool compareVersions(const QString& localVersion, const QString& remoteVersion);
416 + static UpdateChecker* instance();
417 +
418 + signals:
419 +diff --git a/tests/TestUpdateCheck.cpp b/tests/TestUpdateCheck.cpp
420 +index 8cba43b1..ff709cd5 100644
421 +--- a/tests/TestUpdateCheck.cpp
422 ++++ b/tests/TestUpdateCheck.cpp
423 +@@ -29,13 +29,32 @@ void TestUpdateCheck::initTestCase()
424 +
425 + void TestUpdateCheck::testCompareVersion()
426 + {
427 +- // Remote Version , Installed Version
428 +- QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("2.3.4")), true);
429 +- QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.4.0")), false);
430 ++ // No upgrade
431 + QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.0")), false);
432 +- QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.0-beta1")), true);
433 +- QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta2"), QString("2.3.0-beta1")), true);
434 +- QCOMPARE(UpdateChecker::compareVersions(QString("2.3.4"), QString("2.4.0-snapshot")), false);
435 +- QCOMPARE(UpdateChecker::compareVersions(QString("invalid"), QString("2.4.0")), false);
436 +- QCOMPARE(UpdateChecker::compareVersions(QString(""), QString("2.4.0")), false);
437 ++
438 ++ // First digit upgrade
439 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("3.0.0")), true);
440 ++ QCOMPARE(UpdateChecker::compareVersions(QString("3.0.0"), QString("2.4.0")), false);
441 ++
442 ++ // Second digit upgrade
443 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.4"), QString("2.4.0")), true);
444 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("2.3.4")), false);
445 ++
446 ++ // Third digit upgrade
447 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.1")), true);
448 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.1"), QString("2.3.0")), false);
449 ++
450 ++ // Beta builds
451 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.0-beta1")), false);
452 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.1-beta1")), true);
453 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta1"), QString("2.3.0")), true);
454 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta"), QString("2.3.0-beta1")), true);
455 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta1"), QString("2.3.0-beta")), false);
456 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta1"), QString("2.3.0-beta2")), true);
457 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0-beta2"), QString("2.3.0-beta1")), false);
458 ++
459 ++ // Snapshot and invalid data
460 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.3.4-snapshot"), QString("2.4.0")), false);
461 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("invalid")), false);
462 ++ QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("")), false);
463 + }
464 +--
465 +2.21.0
466 +
467
468 diff --git a/app-admin/keepassxc/keepassxc-2.4.0-r1.ebuild b/app-admin/keepassxc/keepassxc-2.4.0-r1.ebuild
469 new file mode 100644
470 index 00000000000..1b2e8923803
471 --- /dev/null
472 +++ b/app-admin/keepassxc/keepassxc-2.4.0-r1.ebuild
473 @@ -0,0 +1,102 @@
474 +# Copyright 1999-2019 Gentoo Authors
475 +# Distributed under the terms of the GNU General Public License v2
476 +
477 +EAPI=7
478 +
479 +inherit cmake-utils xdg
480 +
481 +DESCRIPTION="KeePassXC - KeePass Cross-platform Community Edition"
482 +HOMEPAGE="https://keepassxc.org"
483 +
484 +if [[ "${PV}" != 9999 ]] ; then
485 + if [[ "${PV}" == *_beta* ]] ; then
486 + SRC_URI="https://github.com/keepassxreboot/keepassxc/archive/${PV/_/-}.tar.gz -> ${P}.tar.gz"
487 + S="${WORKDIR}/${P/_/-}"
488 + else
489 + #SRC_URI="https://github.com/keepassxreboot/keepassxc/archive/${PV}.tar.gz -> ${P}.tar.gz"
490 + SRC_URI="https://github.com/keepassxreboot/keepassxc/releases/download/${PV}/${P}-src.tar.xz"
491 + KEYWORDS="~amd64 ~x86"
492 + fi
493 +else
494 + inherit git-r3
495 + EGIT_REPO_URI="https://github.com/keepassxreboot/${PN}"
496 +fi
497 +
498 +LICENSE="LGPL-2.1 GPL-2 GPL-3"
499 +SLOT="0"
500 +IUSE="autotype browser debug network test yubikey"
501 +
502 +RDEPEND="
503 + app-crypt/argon2:=
504 + dev-libs/libgcrypt:=
505 + dev-qt/qtcore:5
506 + dev-qt/qtdbus:5
507 + dev-qt/qtgui:5
508 + dev-qt/qtnetwork:5
509 + dev-qt/qtsvg:5
510 + dev-qt/qtwidgets:5
511 + media-gfx/qrencode:=
512 + sys-libs/zlib
513 + autotype? (
514 + dev-qt/qtx11extras:5
515 + x11-libs/libX11
516 + x11-libs/libXi
517 + x11-libs/libXtst
518 + )
519 + browser? ( >=dev-libs/libsodium-1.0.12 )
520 + yubikey? ( sys-auth/ykpers )
521 +"
522 +
523 +DEPEND="
524 + ${RDEPEND}
525 + dev-qt/linguist-tools:5
526 + dev-qt/qttest:5
527 + dev-qt/qtconcurrent:5
528 +"
529 +
530 +# Not a runtime dependency but still needed (see bug #667092)
531 +PDEPEND="
532 + x11-misc/xsel
533 +"
534 +
535 +PATCHES=(
536 + "${FILESDIR}/${PN}-dont_call_mandb.patch"
537 + "${FILESDIR}/${P}-build_fix.patch"
538 + "${FILESDIR}/${P}-update_checker_toggle.patch"
539 +)
540 +
541 +src_prepare() {
542 + use test || \
543 + sed -e "/^find_package(Qt5Test/d" -i CMakeLists.txt || die
544 +
545 + cmake-utils_src_prepare
546 +}
547 +
548 +src_configure() {
549 + local mycmakeargs=(
550 + -DWITH_GUI_TESTS=OFF
551 + -DWITH_TESTS="$(usex test)"
552 + -DWITH_XC_AUTOTYPE="$(usex autotype)"
553 + -DWITH_XC_BROWSER="$(usex browser)"
554 + -DWITH_XC_NETWORKING="$(usex network)"
555 + -DWITH_XC_SSHAGENT=ON
556 + -DWITH_XC_UPDATECHECK=OFF
557 + -DWITH_XC_YUBIKEY="$(usex yubikey)"
558 + )
559 + if [[ "${PV}" == *_beta* ]] ; then
560 + mycmakeargs+=( -DOVERRIDE_VERSION="${PV/_/-}" )
561 + fi
562 + cmake-utils_src_configure
563 +}
564 +
565 +pkg_preinst() {
566 + xdg_pkg_preinst
567 +}
568 +
569 +pkg_postinst() {
570 + xdg_pkg_postinst
571 +}
572 +
573 +pkg_postrm() {
574 + xdg_pkg_postrm
575 +}