Merge lp:~marcustomlinson/keeper/client-lib into lp:keeper

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Charles Kerr
Approved revision: 84
Merged at revision: 73
Proposed branch: lp:~marcustomlinson/keeper/client-lib
Merge into: lp:keeper
Diff against target: 735 lines (+263/-49)
23 files modified
CMakeLists.txt (+5/-1)
debian/control (+20/-0)
debian/keeper-client-dev.install (+2/-0)
debian/libkeeper-client.install (+1/-0)
include/client/client.h (+48/-0)
src/CMakeLists.txt (+1/-0)
src/cli/main.cpp (+4/-4)
src/client/CMakeLists.txt (+54/-0)
src/client/client.cpp (+78/-0)
src/client/keeper-client.pc.in (+6/-0)
src/helper/backup-helper.cpp (+6/-6)
src/helper/data-dir-registry.cpp (+2/-2)
src/service/backup-choices.cpp (+1/-1)
src/service/keeper-helper.cpp (+1/-1)
src/service/keeper.cpp (+2/-2)
src/storage-framework/storage_framework_client.cpp (+8/-8)
src/tar/main.cpp (+2/-2)
tests/fakes/fake-backup-helper.cpp (+1/-1)
tests/integration/helpers/helpers-test-failure.cpp (+2/-2)
tests/integration/helpers/helpers-test.cc (+4/-4)
tests/integration/helpers/test-helpers-base.cpp (+7/-7)
tests/unit/tar/tar-creator-libarchive-failure-test.cpp (+1/-1)
tests/utils/file-utils.cpp (+7/-7)
To merge this branch: bzr merge lp:~marcustomlinson/keeper/client-lib
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+302386@code.launchpad.net

Commit message

Add keeper-client lib

To post a comment you must log in.
85. By Marcus Tomlinson

Missing QVariant include

Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-08-09 04:39:25 +0000
+++ CMakeLists.txt 2016-08-11 00:26:19 +0000
@@ -1,3 +1,7 @@
1# Version
2set(KEEPER_MAJOR "0")
3set(KEEPER_MINOR "0")
4set(KEEPER_MICRO "1")
15
2# Default install location. Must be set here, before setting the project.6# Default install location. Must be set here, before setting the project.
3if(NOT DEFINED CMAKE_INSTALL_PREFIX)7if(NOT DEFINED CMAKE_INSTALL_PREFIX)
@@ -5,8 +9,8 @@
5 set(LOCAL_INSTALL "ON")9 set(LOCAL_INSTALL "ON")
6endif()10endif()
711
8project(keeper C CXX)
9cmake_minimum_required(VERSION 3.0.2)12cmake_minimum_required(VERSION 3.0.2)
13project(keeper VERSION ${KEEPER_MAJOR}.${KEEPER_MINOR}.${KEEPER_MICRO} LANGUAGES C CXX)
1014
11##15##
12## Build Type16## Build Type
1317
=== modified file 'debian/control'
--- debian/control 2016-07-28 13:52:30 +0000
+++ debian/control 2016-08-11 00:26:19 +0000
@@ -55,3 +55,23 @@
55 systemd | systemd-shim,55 systemd | systemd-shim,
56Description: Backup Tool56Description: Backup Tool
57 A backup/restore utility for Ubuntu (client application)57 A backup/restore utility for Ubuntu (client application)
58
59Package: libkeeper-client
60Architecture: any
61Multi-Arch: same
62Pre-Depends: ${misc:Pre-Depends},
63Depends: ${misc:Depends},
64 ${shlibs:Depends},
65Description: Client library for Keeper
66 Runtime support for Keeper clients.
67
68Package: keeper-client-dev
69Section: libdevel
70Architecture: any
71Multi-Arch: same
72Pre-Depends: ${misc:Pre-Depends},
73Depends: libkeeper-client (= ${binary:Version}),
74 ${misc:Depends},
75Description: Header files for the Keeper client libraries
76 Development headers for Keeper clients.
77
5878
=== added file 'debian/keeper-client-dev.install'
--- debian/keeper-client-dev.install 1970-01-01 00:00:00 +0000
+++ debian/keeper-client-dev.install 2016-08-11 00:26:19 +0000
@@ -0,0 +1,2 @@
1usr/include/keeper
2usr/lib/*/pkgconfig/keeper-client.pc
03
=== added file 'debian/libkeeper-client.install'
--- debian/libkeeper-client.install 1970-01-01 00:00:00 +0000
+++ debian/libkeeper-client.install 2016-08-11 00:26:19 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/libkeeper-client-*.so
02
=== added directory 'include/client'
=== added file 'include/client/client.h'
--- include/client/client.h 1970-01-01 00:00:00 +0000
+++ include/client/client.h 2016-08-11 00:26:19 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Marcus Tomlinson <marcus.tomlinson@canonical.com>
18 */
19
20#pragma once
21
22#define KEEPER_EXPORT __attribute__((visibility("default")))
23
24#include <QObject>
25#include <QScopedPointer>
26#include <QVariant>
27
28class KeeperClientPrivate;
29
30class KEEPER_EXPORT KeeperClient final : public QObject
31{
32 Q_OBJECT
33 Q_DISABLE_COPY(KeeperClient)
34
35public:
36 explicit KeeperClient(QObject* parent = nullptr);
37 ~KeeperClient();
38
39 QMap<QString, QVariantMap> GetBackupChoices() const;
40 void StartBackup(QStringList const& uuids) const;
41
42 QMap<QString, QVariantMap> GetState() const;
43
44Q_SIGNALS:
45
46private:
47 QScopedPointer<KeeperClientPrivate> const d_ptr;
48};
049
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2016-07-28 13:52:30 +0000
+++ src/CMakeLists.txt 2016-08-11 00:26:19 +0000
@@ -4,6 +4,7 @@
4)4)
55
6add_subdirectory(cli)6add_subdirectory(cli)
7add_subdirectory(client)
7add_subdirectory(helper)8add_subdirectory(helper)
8add_subdirectory(qdbus-stubs)9add_subdirectory(qdbus-stubs)
9add_subdirectory(service)10add_subdirectory(service)
1011
=== modified file 'src/cli/main.cpp'
--- src/cli/main.cpp 2016-08-10 05:41:26 +0000
+++ src/cli/main.cpp 2016-08-11 00:26:19 +0000
@@ -51,7 +51,7 @@
51 qDebug() << QDBusConnection::sessionBus().baseService();51 qDebug() << QDBusConnection::sessionBus().baseService();
52 }52 }
5353
54 qDebug() << "Argc = " << argc;54 qDebug() << "Argc =" << argc;
55 if (argc == 2 && QString("--use-uuids") == argv[1])55 if (argc == 2 && QString("--use-uuids") == argv[1])
56 {56 {
57 QScopedPointer<DBusInterfaceKeeperUser> user_iface(new DBusInterfaceKeeperUser(57 QScopedPointer<DBusInterfaceKeeperUser> user_iface(new DBusInterfaceKeeperUser(
@@ -62,7 +62,7 @@
62 QDBusReply<QVariantDictMap> choices = user_iface->call("GetBackupChoices");62 QDBusReply<QVariantDictMap> choices = user_iface->call("GetBackupChoices");
63 if (!choices.isValid())63 if (!choices.isValid())
64 {64 {
65 qWarning() << "Error getting backup choices: " << choices.error().message();65 qWarning() << "Error getting backup choices:" << choices.error().message();
66 }66 }
6767
68 QStringList uuids;68 QStringList uuids;
@@ -76,7 +76,7 @@
76 if (iter_values.value().toString() == "folder")76 if (iter_values.value().toString() == "folder")
77 {77 {
78 // got it78 // got it
79 qDebug() << "Adding uuid " << iter.key() << " with type: " << "folder";79 qDebug() << "Adding uuid" << iter.key() << "with type:" << "folder";
80 uuids << iter.key();80 uuids << iter.key();
81 }81 }
82 }82 }
@@ -86,7 +86,7 @@
8686
87 if (!backup_reply.isValid())87 if (!backup_reply.isValid())
88 {88 {
89 qWarning() << "Error starting backup: " << backup_reply.error().message();89 qWarning() << "Error starting backup:" << backup_reply.error().message();
90 }90 }
91 }91 }
92 else92 else
9393
=== added directory 'src/client'
=== added file 'src/client/CMakeLists.txt'
--- src/client/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/client/CMakeLists.txt 2016-08-11 00:26:19 +0000
@@ -0,0 +1,54 @@
1set(
2 CLIENT_LIB
3 keeper-client-${KEEPER_MAJOR}.${KEEPER_MINOR}
4)
5
6set(
7 CLIENT_HEADERS
8 ${CMAKE_SOURCE_DIR}/include/client/client.h
9)
10
11add_library(
12 ${CLIENT_LIB} SHARED
13 client.cpp
14 ${CLIENT_HEADERS}
15)
16
17set_target_properties(
18 ${CLIENT_LIB}
19 PROPERTIES
20 AUTOMOC TRUE
21)
22
23target_link_libraries(
24 ${CLIENT_LIB}
25 qdbus-stubs
26 Qt5::Core
27 Qt5::DBus
28)
29
30set(
31 COVERAGE_REPORT_TARGETS
32 ${COVERAGE_REPORT_TARGETS}
33 ${CLIENT_LIB}
34 PARENT_SCOPE
35)
36
37install(
38 FILES ${CLIENT_HEADERS}
39 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/keeper
40)
41
42install(
43 TARGETS ${CLIENT_LIB}
44 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
45)
46
47configure_file(
48 keeper-client.pc.in
49 keeper-client.pc
50)
51install(
52 FILES ${CMAKE_CURRENT_BINARY_DIR}/keeper-client.pc
53 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
54)
055
=== added file 'src/client/client.cpp'
--- src/client/client.cpp 1970-01-01 00:00:00 +0000
+++ src/client/client.cpp 2016-08-11 00:26:19 +0000
@@ -0,0 +1,78 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Marcus Tomlinson <marcus.tomlinson@canonical.com>
18 */
19
20#include <client/client.h>
21
22#include <qdbus-stubs/keeper_user_interface.h>
23
24class KeeperClientPrivate final
25{
26 Q_DISABLE_COPY(KeeperClientPrivate)
27
28public:
29 KeeperClientPrivate()
30 : user_iface(new DBusInterfaceKeeperUser(
31 DBusTypes::KEEPER_SERVICE,
32 DBusTypes::KEEPER_USER_PATH,
33 QDBusConnection::sessionBus()
34 ))
35 {
36 }
37
38 ~KeeperClientPrivate() = default;
39
40 QScopedPointer<DBusInterfaceKeeperUser> user_iface;
41};
42
43KeeperClient::KeeperClient(QObject* parent)
44 : QObject{parent}
45 , d_ptr(new KeeperClientPrivate())
46{
47 DBusTypes::registerMetaTypes();
48}
49
50KeeperClient::~KeeperClient() = default;
51
52QMap<QString, QVariantMap> KeeperClient::GetBackupChoices() const
53{
54 QDBusReply<QMap<QString, QVariantMap>> choices = d_ptr->user_iface->call("GetBackupChoices");
55
56 if (!choices.isValid())
57 {
58 qWarning() << "Error getting backup choices:" << choices.error().message();
59 return QMap<QString, QVariantMap>();
60 }
61
62 return choices.value();
63}
64
65void KeeperClient::StartBackup(const QStringList& uuids) const
66{
67 QDBusReply<void> backup_reply = d_ptr->user_iface->call("StartBackup", uuids);
68
69 if (!backup_reply.isValid())
70 {
71 qWarning() << "Error starting backup:" << backup_reply.error().message();
72 }
73}
74
75QMap<QString, QVariantMap> KeeperClient::GetState() const
76{
77 return d_ptr->user_iface->state();
78}
079
=== added file 'src/client/keeper-client.pc.in'
--- src/client/keeper-client.pc.in 1970-01-01 00:00:00 +0000
+++ src/client/keeper-client.pc.in 2016-08-11 00:26:19 +0000
@@ -0,0 +1,6 @@
1Name: keeper-client
2Description: A Qt client library for Keeper
3Version: @PROJECT_VERSION@
4Requires.private: Qt5Core Qt5DBus
5Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/keeper
6Libs: @CMAKE_INSTALL_FULL_LIBDIR@/libkeeper-client-@KEEPER_MAJOR@.@KEEPER_MINOR@.so
07
=== modified file 'src/helper/backup-helper.cpp'
--- src/helper/backup-helper.cpp 2016-08-09 03:58:59 +0000
+++ src/helper/backup-helper.cpp 2016-08-11 00:26:19 +0000
@@ -195,7 +195,7 @@
195 else {195 else {
196 if (n < 0) {196 if (n < 0) {
197 write_error_ = true;197 write_error_ = true;
198 qWarning() << "Write error: " << storage_framework_socket_->errorString();198 qWarning() << "Write error:" << storage_framework_socket_->errorString();
199 stop();199 stop();
200 }200 }
201 break;201 break;
@@ -263,11 +263,11 @@
263263
264 void ual_start(QStringList const& url_strings)264 void ual_start(QStringList const& url_strings)
265 {265 {
266 qDebug() << "Starting helper for app: " << appid_;266 qDebug() << "Starting helper for app:" << appid_;
267267
268 std::vector<ubuntu::app_launch::Helper::URL> urls;268 std::vector<ubuntu::app_launch::Helper::URL> urls;
269 for(const auto& url_string : url_strings) {269 for(const auto& url_string : url_strings) {
270 qDebug() << "url " << url_string;270 qDebug() << "url" << url_string;
271 urls.push_back(ubuntu::app_launch::Helper::URL::from_raw(url_string.toStdString()));271 urls.push_back(ubuntu::app_launch::Helper::URL::from_raw(url_string.toStdString()));
272 }272 }
273273
@@ -281,7 +281,7 @@
281281
282 void ual_stop()282 void ual_stop()
283 {283 {
284 qDebug() << "Stopping helper for app: " << appid_;284 qDebug() << "Stopping helper for app:" << appid_;
285 auto backupType = ubuntu::app_launch::Helper::Type::from_raw(HELPER_TYPE);285 auto backupType = ubuntu::app_launch::Helper::Type::from_raw(HELPER_TYPE);
286286
287 auto appid = ubuntu::app_launch::AppID::parse(appid_.toStdString());287 auto appid = ubuntu::app_launch::AppID::parse(appid_.toStdString());
@@ -298,14 +298,14 @@
298298
299 static void on_helper_started(const char* appid, const char* /*instance*/, const char* /*type*/, void* vself)299 static void on_helper_started(const char* appid, const char* /*instance*/, const char* /*type*/, void* vself)
300 {300 {
301 qDebug() << "HELPER STARTED +++++++++++++++++++++++++++++++++++++ " << appid;301 qDebug() << "HELPER STARTED +++++++++++++++++++++++++++++++++++++" << appid;
302 auto self = static_cast<BackupHelperPrivate*>(vself);302 auto self = static_cast<BackupHelperPrivate*>(vself);
303 self->q_ptr->set_state(Helper::State::STARTED);303 self->q_ptr->set_state(Helper::State::STARTED);
304 }304 }
305305
306 static void on_helper_stopped(const char* appid, const char* /*instance*/, const char* /*type*/, void* vself)306 static void on_helper_stopped(const char* appid, const char* /*instance*/, const char* /*type*/, void* vself)
307 {307 {
308 qDebug() << "HELPER STOPPED +++++++++++++++++++++++++++++++++++++ " << appid;308 qDebug() << "HELPER STOPPED +++++++++++++++++++++++++++++++++++++" << appid;
309 auto self = static_cast<BackupHelperPrivate*>(vself);309 auto self = static_cast<BackupHelperPrivate*>(vself);
310 self->check_for_done();310 self->check_for_done();
311 self->stop_inactivity_timer();311 self->stop_inactivity_timer();
312312
=== modified file 'src/helper/data-dir-registry.cpp'
--- src/helper/data-dir-registry.cpp 2016-08-09 04:39:25 +0000
+++ src/helper/data-dir-registry.cpp 2016-08-11 00:26:19 +0000
@@ -101,9 +101,9 @@
101 }101 }
102102
103 for (auto const& url : urls_in)103 for (auto const& url : urls_in)
104 qDebug() << "in: " << url;104 qDebug() << "in:" << url;
105 for (auto const& url : urls)105 for (auto const& url : urls)
106 qDebug() << "out: " << url;106 qDebug() << "out:" << url;
107107
108 return urls;108 return urls;
109 }109 }
110110
=== modified file 'src/service/backup-choices.cpp'
--- src/service/backup-choices.cpp 2016-08-09 01:07:04 +0000
+++ src/service/backup-choices.cpp 2016-08-11 00:26:19 +0000
@@ -79,7 +79,7 @@
79 }79 }
80 if (error != nullptr)80 if (error != nullptr)
81 {81 {
82 qCritical() << "Error getting click manifests: " << error->message;82 qCritical() << "Error getting click manifests:" << error->message;
83 g_clear_error(&error);83 g_clear_error(&error);
84 }84 }
8585
8686
=== modified file 'src/service/keeper-helper.cpp'
--- src/service/keeper-helper.cpp 2016-07-12 21:18:30 +0000
+++ src/service/keeper-helper.cpp 2016-08-11 00:26:19 +0000
@@ -50,5 +50,5 @@
5050
51void KeeperHelper::UpdateStatus(const QString &app_id, const QString &status, double percentage)51void KeeperHelper::UpdateStatus(const QString &app_id, const QString &status, double percentage)
52{52{
53 qDebug() << "KeeperHelper::UpdateStatus( " << app_id << ", " << status << ", " << percentage << ")";53 qDebug() << "KeeperHelper::UpdateStatus(" << app_id << "," << status << "," << percentage << ")";
54}54}
5555
=== modified file 'src/service/keeper.cpp'
--- src/service/keeper.cpp 2016-08-10 07:34:02 +0000
+++ src/service/keeper.cpp 2016-08-11 00:26:19 +0000
@@ -81,7 +81,7 @@
8181
82 void start_task(QString const &uuid)82 void start_task(QString const &uuid)
83 {83 {
84 qDebug() << "Starting task: " << uuid;84 qDebug() << "Starting task:" << uuid;
85 auto metadata = get_uuid_metadata(cached_backup_choices_, uuid);85 auto metadata = get_uuid_metadata(cached_backup_choices_, uuid);
86 if (metadata.uuid() == uuid)86 if (metadata.uuid() == uuid)
87 {87 {
@@ -91,7 +91,7 @@
91 if (urls.isEmpty())91 if (urls.isEmpty())
92 {92 {
93 // TODO Report error to user93 // TODO Report error to user
94 qWarning() << "ERROR: uuid: " << uuid << " has no url";94 qWarning() << "ERROR: uuid:" << uuid << "has no url";
95 return;95 return;
96 }96 }
9797
9898
=== modified file 'src/storage-framework/storage_framework_client.cpp'
--- src/storage-framework/storage_framework_client.cpp 2016-08-10 06:44:47 +0000
+++ src/storage-framework/storage_framework_client.cpp 2016-08-11 00:26:19 +0000
@@ -73,7 +73,7 @@
73 }73 }
74 catch (std::exception & e)74 catch (std::exception & e)
75 {75 {
76 qDebug() << "ERROR: StorageFrameworkClient::getNewFileForBackup(): " << e.what();76 qDebug() << "ERROR: StorageFrameworkClient::getNewFileForBackup():" << e.what();
77 }77 }
78}78}
7979
@@ -103,14 +103,14 @@
103 }103 }
104 catch (std::exception & e)104 catch (std::exception & e)
105 {105 {
106 qDebug() << "ERROR: StorageFrameworkClient::closeUploader(): " << e.what();106 qDebug() << "ERROR: StorageFrameworkClient::closeUploader():" << e.what();
107 }107 }
108}108}
109109
110void StorageFrameworkClient::onUploaderClosed()110void StorageFrameworkClient::onUploaderClosed()
111{111{
112 auto file = uploader_closed_watcher_.result();112 auto file = uploader_closed_watcher_.result();
113 qDebug() << "Uploader for file " << file->name() << " was closed";113 qDebug() << "Uploader for file" << file->name() << "was closed";
114 qDebug() << "Uploader was closed";114 qDebug() << "Uploader was closed";
115 uploader_->socket()->disconnectFromServer();115 uploader_->socket()->disconnectFromServer();
116 uploader_.reset();116 uploader_.reset();
@@ -133,7 +133,7 @@
133 }133 }
134 try134 try
135 {135 {
136 qDebug() << "Retrieving parents of file " << file->name();136 qDebug() << "Retrieving parents of file" << file->name();
137137
138 // block here until we get a response138 // block here until we get a response
139 QVector<std::shared_ptr<Folder>> parents = file->parents().result();139 QVector<std::shared_ptr<Folder>> parents = file->parents().result();
@@ -143,7 +143,7 @@
143143
144 if (file->name().length() < suffix.length() + 1)144 if (file->name().length() < suffix.length() + 1)
145 {145 {
146 qWarning() << "The file " << file->name() << " has an invalid name, and could not remove the suffix " << TMP_SUFFIX << " from it";146 qWarning() << "The file" << file->name() << "has an invalid name, and could not remove the suffix" << TMP_SUFFIX << "from it";
147 return false;147 return false;
148 }148 }
149 newName.remove((file->name().length() - suffix.length()), suffix.length());149 newName.remove((file->name().length() - suffix.length()), suffix.length());
@@ -152,12 +152,12 @@
152 for (const auto& parent : parents)152 for (const auto& parent : parents)
153 {153 {
154 auto item = file->move(parent, newName).result();154 auto item = file->move(parent, newName).result();
155 qDebug() << "File name changed to " << item->name();155 qDebug() << "File name changed to" << item->name();
156 }156 }
157 }157 }
158 catch (std::exception & e)158 catch (std::exception & e)
159 {159 {
160 qDebug() << "ERROR: StorageFrameworkClient::removeTmpSuffix(): " << e.what();160 qDebug() << "ERROR: StorageFrameworkClient::removeTmpSuffix():" << e.what();
161 return false;161 return false;
162 }162 }
163 return true;163 return true;
@@ -172,7 +172,7 @@
172 }172 }
173 catch (std::exception & e)173 catch (std::exception & e)
174 {174 {
175 qDebug() << "ERROR: StorageFrameworkClient::deleteFile(): " << e.what();175 qDebug() << "ERROR: StorageFrameworkClient::deleteFile():" << e.what();
176 return false;176 return false;
177 }177 }
178 return true;178 return true;
179179
=== modified file 'src/tar/main.cpp'
--- src/tar/main.cpp 2016-08-03 18:58:01 +0000
+++ src/tar/main.cpp 2016-08-11 00:26:19 +0000
@@ -107,14 +107,14 @@
107107
108 // gotta have the bus path108 // gotta have the bus path
109 if (bus_path.isEmpty()) {109 if (bus_path.isEmpty()) {
110 std::cerr << "Missing required argument: --bus-path " << std::endl;110 std::cerr << "Missing required argument: --bus-path" << std::endl;
111 parser.showHelp(EXIT_FAILURE);111 parser.showHelp(EXIT_FAILURE);
112 }112 }
113113
114 // gotta have files114 // gotta have files
115 const auto filenames = get_filenames_from_file(stdin);115 const auto filenames = get_filenames_from_file(stdin);
116 for (const auto& filename : filenames)116 for (const auto& filename : filenames)
117 qDebug() << "filename: " << filename;117 qDebug() << "filename:" << filename;
118 if (filenames.empty()) {118 if (filenames.empty()) {
119 std::cerr << "no files listed" << std::endl;119 std::cerr << "no files listed" << std::endl;
120 parser.showHelp(EXIT_FAILURE);120 parser.showHelp(EXIT_FAILURE);
121121
=== modified file 'tests/fakes/fake-backup-helper.cpp'
--- tests/fakes/fake-backup-helper.cpp 2016-08-05 14:10:32 +0000
+++ tests/fakes/fake-backup-helper.cpp 2016-08-11 00:26:19 +0000
@@ -51,7 +51,7 @@
51 const auto object_path = QString::fromUtf8(DBusTypes::KEEPER_HELPER_PATH);51 const auto object_path = QString::fromUtf8(DBusTypes::KEEPER_HELPER_PATH);
52 DBusInterfaceKeeperHelper helper_iface (DBusTypes::KEEPER_SERVICE, object_path, conn);52 DBusInterfaceKeeperHelper helper_iface (DBusTypes::KEEPER_SERVICE, object_path, conn);
5353
54 qDebug() << "Is valid: " << helper_iface.isValid();54 qDebug() << "Is valid:" << helper_iface.isValid();
5555
56 auto blob_size = blob.size();56 auto blob_size = blob.size();
57#ifdef COMPILE_WITH_FAILURE57#ifdef COMPILE_WITH_FAILURE
5858
=== modified file 'tests/integration/helpers/helpers-test-failure.cpp'
--- tests/integration/helpers/helpers-test-failure.cpp 2016-08-09 03:58:59 +0000
+++ tests/integration/helpers/helpers-test-failure.cpp 2016-08-11 00:26:19 +0000
@@ -55,7 +55,7 @@
5555
56 auto user_dir = qgetenv(user_option.toLatin1().data());56 auto user_dir = qgetenv(user_option.toLatin1().data());
57 ASSERT_FALSE(user_dir.isEmpty());57 ASSERT_FALSE(user_dir.isEmpty());
58 qDebug() << "USER DIR: " << user_dir;58 qDebug() << "USER DIR:" << user_dir;
5959
60 // fill something in the music dir60 // fill something in the music dir
61 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir, qrand() % 1000));61 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir, qrand() % 1000));
@@ -63,7 +63,7 @@
63 // search for the user folder uuid63 // search for the user folder uuid
64 auto user_folder_uuid = getUUIDforXdgFolderPath(user_dir, choices.value());64 auto user_folder_uuid = getUUIDforXdgFolderPath(user_dir, choices.value());
65 ASSERT_FALSE(user_folder_uuid.isEmpty());65 ASSERT_FALSE(user_folder_uuid.isEmpty());
66 qDebug() << "User folder UUID is: " << user_folder_uuid;66 qDebug() << "User folder UUID is:" << user_folder_uuid;
6767
68 // Now we know the music folder uuid, let's start the backup for it.68 // Now we know the music folder uuid, let's start the backup for it.
69 QDBusReply<void> backup_reply = user_iface->call("StartBackup", QStringList{user_folder_uuid});69 QDBusReply<void> backup_reply = user_iface->call("StartBackup", QStringList{user_folder_uuid});
7070
=== modified file 'tests/integration/helpers/helpers-test.cc'
--- tests/integration/helpers/helpers-test.cc 2016-08-09 03:58:59 +0000
+++ tests/integration/helpers/helpers-test.cc 2016-08-11 00:26:19 +0000
@@ -240,7 +240,7 @@
240240
241 auto user_dir = qgetenv(user_option.toLatin1().data());241 auto user_dir = qgetenv(user_option.toLatin1().data());
242 ASSERT_FALSE(user_dir.isEmpty());242 ASSERT_FALSE(user_dir.isEmpty());
243 qDebug() << "USER DIR: " << user_dir;243 qDebug() << "USER DIR:" << user_dir;
244244
245 // fill something in the music dir245 // fill something in the music dir
246 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir, qrand() % 1000));246 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir, qrand() % 1000));
@@ -248,13 +248,13 @@
248 // search for the user folder uuid248 // search for the user folder uuid
249 auto user_folder_uuid = getUUIDforXdgFolderPath(user_dir, choices.value());249 auto user_folder_uuid = getUUIDforXdgFolderPath(user_dir, choices.value());
250 ASSERT_FALSE(user_folder_uuid.isEmpty());250 ASSERT_FALSE(user_folder_uuid.isEmpty());
251 qDebug() << "User folder UUID is: " << user_folder_uuid;251 qDebug() << "User folder UUID is:" << user_folder_uuid;
252252
253 QString user_option_2 = "XDG_VIDEOS_DIR";253 QString user_option_2 = "XDG_VIDEOS_DIR";
254254
255 auto user_dir_2 = qgetenv(user_option_2.toLatin1().data());255 auto user_dir_2 = qgetenv(user_option_2.toLatin1().data());
256 ASSERT_FALSE(user_dir_2.isEmpty());256 ASSERT_FALSE(user_dir_2.isEmpty());
257 qDebug() << "USER DIR 2: " << user_dir_2;257 qDebug() << "USER DIR 2:" << user_dir_2;
258258
259 // fill something in the music dir259 // fill something in the music dir
260 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir_2, qrand() % 1000));260 ASSERT_TRUE(FileUtils::fillTemporaryDirectory(user_dir_2, qrand() % 1000));
@@ -262,7 +262,7 @@
262 // search for the user folder uuid262 // search for the user folder uuid
263 auto user_folder_uuid_2 = getUUIDforXdgFolderPath(user_dir_2, choices.value());263 auto user_folder_uuid_2 = getUUIDforXdgFolderPath(user_dir_2, choices.value());
264 ASSERT_FALSE(user_folder_uuid_2.isEmpty());264 ASSERT_FALSE(user_folder_uuid_2.isEmpty());
265 qDebug() << "User folder 2 UUID is: " << user_folder_uuid_2;265 qDebug() << "User folder 2 UUID is:" << user_folder_uuid_2;
266266
267 // Now we know the music folder uuid, let's start the backup for it.267 // Now we know the music folder uuid, let's start the backup for it.
268 QDBusReply<void> backup_reply = user_iface->call("StartBackup", QStringList{user_folder_uuid, user_folder_uuid_2});268 QDBusReply<void> backup_reply = user_iface->call("StartBackup", QStringList{user_folder_uuid, user_folder_uuid_2});
269269
=== modified file 'tests/integration/helpers/test-helpers-base.cpp'
--- tests/integration/helpers/test-helpers-base.cpp 2016-08-10 07:44:55 +0000
+++ tests/integration/helpers/test-helpers-base.cpp 2016-08-11 00:26:19 +0000
@@ -88,7 +88,7 @@
88 g_setenv("XDG_CACHE_HOME", CMAKE_SOURCE_DIR "/libertine-data", TRUE);88 g_setenv("XDG_CACHE_HOME", CMAKE_SOURCE_DIR "/libertine-data", TRUE);
89 g_setenv("XDG_DATA_HOME", xdg_data_home_dir.path().toLatin1().data(), TRUE);89 g_setenv("XDG_DATA_HOME", xdg_data_home_dir.path().toLatin1().data(), TRUE);
9090
91 qDebug() << "XDG_DATA_HOME ON SETUP is: " << xdg_data_home_dir.path();91 qDebug() << "XDG_DATA_HOME ON SETUP is:" << xdg_data_home_dir.path();
9292
93 service = dbus_test_service_new(NULL);93 service = dbus_test_service_new(NULL);
9494
@@ -308,22 +308,22 @@
308{308{
309 QTemporaryDir tempDir;309 QTemporaryDir tempDir;
310310
311 qDebug() << "Comparing tar content for dir: " << sourceDir << " with tar: " << tarPath;311 qDebug() << "Comparing tar content for dir:" << sourceDir << "with tar:" << tarPath;
312312
313 QFileInfo checkFile(tarPath);313 QFileInfo checkFile(tarPath);
314 if (!checkFile.exists())314 if (!checkFile.exists())
315 {315 {
316 qWarning() << "File: " << tarPath << " does not exist";316 qWarning() << "File:" << tarPath << "does not exist";
317 return false;317 return false;
318 }318 }
319 if (!checkFile.isFile())319 if (!checkFile.isFile())
320 {320 {
321 qWarning() << "Item: " << tarPath << " is not a file";321 qWarning() << "Item:" << tarPath << "is not a file";
322 return false;322 return false;
323 }323 }
324 if (!tempDir.isValid())324 if (!tempDir.isValid())
325 {325 {
326 qWarning() << "Temporary directory: " << tempDir.path() << " is not valid";326 qWarning() << "Temporary directory:" << tempDir.path() << "is not valid";
327 return false;327 return false;
328 }328 }
329329
@@ -413,7 +413,7 @@
413 QFile storage_framework_file(lastFile);413 QFile storage_framework_file(lastFile);
414 if(!storage_framework_file.open(QFile::ReadOnly))414 if(!storage_framework_file.open(QFile::ReadOnly))
415 {415 {
416 qWarning() << "ERROR: opening file: " << lastFile;416 qWarning() << "ERROR: opening file:" << lastFile;
417 return false;417 return false;
418 }418 }
419419
@@ -451,7 +451,7 @@
451 {451 {
452 helper_mark.remove();452 helper_mark.remove();
453 timer.restart();453 timer.restart();
454 qDebug() << "HELPER FINISHED, WAITING FOR " << times_to_wait << " MORE";454 qDebug() << "HELPER FINISHED, WAITING FOR" << times_to_wait << "MORE";
455 }455 }
456 else456 else
457 {457 {
458458
=== modified file 'tests/unit/tar/tar-creator-libarchive-failure-test.cpp'
--- tests/unit/tar/tar-creator-libarchive-failure-test.cpp 2016-08-04 18:28:25 +0000
+++ tests/unit/tar/tar-creator-libarchive-failure-test.cpp 2016-08-11 00:26:19 +0000
@@ -179,5 +179,5 @@
179179
180 EXPECT_TRUE(error_string.contains(QString::fromUtf8(FATAL_ERROR_MESSAGE)))180 EXPECT_TRUE(error_string.contains(QString::fromUtf8(FATAL_ERROR_MESSAGE)))
181 << "expected: '" << FATAL_ERROR_MESSAGE << "'" << std::endl181 << "expected: '" << FATAL_ERROR_MESSAGE << "'" << std::endl
182 << " got: '" << qPrintable(error_string) << "'" << std::endl;182 << "got: '" << qPrintable(error_string) << "'" << std::endl;
183}183}
184184
=== modified file 'tests/utils/file-utils.cpp'
--- tests/utils/file-utils.cpp 2016-07-29 14:20:23 +0000
+++ tests/utils/file-utils.cpp 2016-08-11 00:26:19 +0000
@@ -49,7 +49,7 @@
49 f.setAutoRemove(false);49 f.setAutoRemove(false);
50 if(!f.open())50 if(!f.open())
51 {51 {
52 qWarning() << "Error opening temporary file: " << f.errorString();52 qWarning() << "Error opening temporary file:" << f.errorString();
53 return info;53 return info;
54 }54 }
55 static constexpr qint64 max_step = 1024;55 static constexpr qint64 max_step = 1024;
@@ -62,7 +62,7 @@
62 buf[i] = 'a' + char(qrand() % ('z'-'a'));62 buf[i] = 'a' + char(qrand() % ('z'-'a'));
63 if (f.write(buf, this_step) < this_step)63 if (f.write(buf, this_step) < this_step)
64 {64 {
65 qWarning() << "Error writing to temporary file: " << f.errorString();65 qWarning() << "Error writing to temporary file:" << f.errorString();
66 }66 }
67 left -= this_step;67 left -= this_step;
68 }68 }
@@ -71,7 +71,7 @@
71 // get a checksum71 // get a checksum
72 if(!f.open())72 if(!f.open())
73 {73 {
74 qWarning() << "Error opening temporary file: " << f.errorString();74 qWarning() << "Error opening temporary file:" << f.errorString();
75 return info;75 return info;
76 }76 }
77 QCryptographicHash hash(QCryptographicHash::Sha1);77 QCryptographicHash hash(QCryptographicHash::Sha1);
@@ -104,7 +104,7 @@
104 auto newDirName = QString("Directory_%1").arg(j);104 auto newDirName = QString("Directory_%1").arg(j);
105 if (!dir.mkdir(newDirName))105 if (!dir.mkdir(newDirName))
106 {106 {
107 qWarning() << "Error creating temporary directory " << newDirName << " under " << dirPath;107 qWarning() << "Error creating temporary directory" << newDirName << "under" << dirPath;
108 return false;108 return false;
109 }109 }
110110
@@ -191,19 +191,19 @@
191 QFileInfo info2(filePath2);191 QFileInfo info2(filePath2);
192 if (!info1.isFile())192 if (!info1.isFile())
193 {193 {
194 qWarning() << "Origin file: " << info1.absoluteFilePath() << " does not exist";194 qWarning() << "Origin file:" << info1.absoluteFilePath() << "does not exist";
195 return false;195 return false;
196 }196 }
197 if (!info2.isFile())197 if (!info2.isFile())
198 {198 {
199 qWarning() << "File to compare: " << info2.absoluteFilePath() << " does not exist";199 qWarning() << "File to compare:" << info2.absoluteFilePath() << "does not exist";
200 return false;200 return false;
201 }201 }
202 auto checksum1 = fileChecksum(filePath1, QCryptographicHash::Md5);202 auto checksum1 = fileChecksum(filePath1, QCryptographicHash::Md5);
203 auto checksum2 = fileChecksum(filePath1, QCryptographicHash::Md5);203 auto checksum2 = fileChecksum(filePath1, QCryptographicHash::Md5);
204 if (checksum1 != checksum2)204 if (checksum1 != checksum2)
205 {205 {
206 qWarning() << "Checksum for file: " << filePath1 << " differ";206 qWarning() << "Checksum for file:" << filePath1 << "differ";
207 }207 }
208 return checksum1 == checksum2;208 return checksum1 == checksum2;
209}209}

Subscribers

People subscribed via source and target branches

to all changes: