From 166813cb918ebd029325e12377989bfdc2021074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 7 Jun 2015 23:42:22 +0200 Subject: GH-1060 remove some old updater bits and pieces --- logic/updater/DownloadTask.cpp | 7 +------ logic/updater/DownloadTask.h | 2 -- logic/updater/GoUpdate.cpp | 38 +++++++------------------------------- logic/updater/GoUpdate.h | 17 +++++++++-------- 4 files changed, 17 insertions(+), 47 deletions(-) (limited to 'logic') diff --git a/logic/updater/DownloadTask.cpp b/logic/updater/DownloadTask.cpp index f19607a5..352f1f0d 100644 --- a/logic/updater/DownloadTask.cpp +++ b/logic/updater/DownloadTask.cpp @@ -35,11 +35,6 @@ DownloadTask::DownloadTask(Status status, QObject *parent) m_updateFilesDir.setAutoRemove(false); } -void DownloadTask::setUseLocalUpdater(bool useLocal) -{ - m_keepLocalUpdater = useLocal; -} - void DownloadTask::executeTask() { loadVersionInfo(); @@ -130,7 +125,7 @@ void DownloadTask::processDownloadedVersionInfo() NetJobPtr netJob (new NetJob("Update Files")); // fill netJob and operationList - if (!processFileLists(m_currentVersionFileList, m_newVersionFileList, m_status.rootPath, m_updateFilesDir.path(), netJob, operationList, m_keepLocalUpdater)) + if (!processFileLists(m_currentVersionFileList, m_newVersionFileList, m_status.rootPath, m_updateFilesDir.path(), netJob, operationList)) { emitFailed(tr("Failed to process update lists...")); return; diff --git a/logic/updater/DownloadTask.h b/logic/updater/DownloadTask.h index 182e76d6..197aa3e6 100644 --- a/logic/updater/DownloadTask.h +++ b/logic/updater/DownloadTask.h @@ -61,8 +61,6 @@ protected: Status m_status; - bool m_keepLocalUpdater; - /*! * Temporary directory to store update files in. * This will be set to not auto delete. Task will fail if this fails to be created. diff --git a/logic/updater/GoUpdate.cpp b/logic/updater/GoUpdate.cpp index 974f5e2b..d85f00d6 100644 --- a/logic/updater/GoUpdate.cpp +++ b/logic/updater/GoUpdate.cpp @@ -73,8 +73,7 @@ bool processFileLists const QString &rootPath, const QString &tempPath, NetJobPtr job, - OperationList &ops, - bool useLocalUpdater + OperationList &ops ) { // First, if we've loaded the current version's file list, we need to iterate through it and @@ -175,9 +174,6 @@ bool processFileLists // yep. this file actually needs an upgrade. PROCEED. qDebug() << "Found file" << realEntryPath << " that needs updating."; - // if it's the updater we want to treat it separately - bool isUpdater = entry.path.endsWith("updater") || entry.path.endsWith("updater.exe"); - // Go through the sources list and find one to use. // TODO: Make a NetAction that takes a source list and tries each of them until one // works. For now, we'll just use the first http one. @@ -192,32 +188,12 @@ bool processFileLists // path with slashes replaced by underscores. QString dlPath = PathCombine(tempPath, QString(entry.path).replace("/", "_")); - if (isUpdater) - { - if(useLocalUpdater) - { - qDebug() << "Skipping updater download and using local version."; - } - else - { - auto cache_entry = ENV.metacache()->resolveEntry("root", entry.path); - qDebug() << "Updater will be in " << cache_entry->getFullPath(); - // force check. - cache_entry->stale = true; - - auto download = CacheDownload::make(QUrl(source.url), cache_entry); - job->addNetAction(download); - } - } - else - { - // We need to download the file to the updatefiles folder and add a task - // to copy it to its install path. - auto download = MD5EtagDownload::make(source.url, dlPath); - download->m_expected_md5 = entry.md5; - job->addNetAction(download); - ops.append(Operation::CopyOp(dlPath, entry.path, entry.mode)); - } + // We need to download the file to the updatefiles folder and add a task + // to copy it to its install path. + auto download = MD5EtagDownload::make(source.url, dlPath); + download->m_expected_md5 = entry.md5; + job->addNetAction(download); + ops.append(Operation::CopyOp(dlPath, entry.path, entry.mode)); } } return true; diff --git a/logic/updater/GoUpdate.h b/logic/updater/GoUpdate.h index c58fd1eb..941c4e3a 100644 --- a/logic/updater/GoUpdate.h +++ b/logic/updater/GoUpdate.h @@ -66,10 +66,14 @@ typedef QList VersionFileList; */ struct Operation { - static Operation CopyOp(QString fsource, QString fdest, int fmode=0644) { return Operation{OP_COPY, fsource, fdest, fmode}; } - static Operation MoveOp(QString fsource, QString fdest, int fmode=0644) { return Operation{OP_MOVE, fsource, fdest, fmode}; } - static Operation DeleteOp(QString file) { return Operation{OP_DELETE, file, "", 0644}; } - static Operation ChmodOp(QString file, int fmode) { return Operation{OP_CHMOD, file, "", fmode}; } + static Operation CopyOp(QString fsource, QString fdest, int fmode=0644) + { + return Operation{OP_COPY, fsource, fdest, fmode}; + } + static Operation DeleteOp(QString file) + { + return Operation{OP_DELETE, file, "", 0644}; + } // FIXME: for some types, some of the other fields are irrelevant! bool operator==(const Operation &u2) const @@ -82,8 +86,6 @@ struct Operation { OP_COPY, OP_DELETE, - OP_MOVE, - OP_CHMOD, } type; //! The file to operate on. If this is a DELETE or CHMOD operation, this is the file that will be modified. @@ -118,8 +120,7 @@ bool processFileLists const QString &rootPath, const QString &tempPath, NetJobPtr job, - OperationList &ops, - bool useLocalUpdater + OperationList &ops ); /*! -- cgit v1.2.3