GH-1060 remove some old updater bits and pieces

This commit is contained in:
Petr Mrázek
2015-06-07 23:42:22 +02:00
parent 38e42ad794
commit 166813cb91
15 changed files with 28 additions and 169 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -66,10 +66,14 @@ typedef QList<VersionFileEntry> 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
);
/*!