Mark forge lib downloads as failed when they fail

This commit is contained in:
Petr Mrázek 2013-11-16 20:36:01 +01:00
parent 9693a5e6e9
commit 2a45302dfc

View File

@ -91,6 +91,7 @@ void ForgeXzDownload::downloadFinished()
else else
{ {
// something bad happened // something bad happened
m_status = Job_Failed;
m_pack200_xz_file.remove(); m_pack200_xz_file.remove();
m_reply.reset(); m_reply.reset();
emit failed(index_within_job); emit failed(index_within_job);
@ -155,6 +156,7 @@ void ForgeXzDownload::decompressAndInstall()
if (s == nullptr) if (s == nullptr)
{ {
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
} }
@ -180,6 +182,7 @@ void ForgeXzDownload::decompressAndInstall()
{ {
// msg = "Write error\n"; // msg = "Write error\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
} }
@ -214,24 +217,28 @@ void ForgeXzDownload::decompressAndInstall()
case XZ_MEM_ERROR: case XZ_MEM_ERROR:
QLOG_ERROR() << "Memory allocation failed\n"; QLOG_ERROR() << "Memory allocation failed\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
case XZ_MEMLIMIT_ERROR: case XZ_MEMLIMIT_ERROR:
QLOG_ERROR() << "Memory usage limit reached\n"; QLOG_ERROR() << "Memory usage limit reached\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
case XZ_FORMAT_ERROR: case XZ_FORMAT_ERROR:
QLOG_ERROR() << "Not a .xz file\n"; QLOG_ERROR() << "Not a .xz file\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
case XZ_OPTIONS_ERROR: case XZ_OPTIONS_ERROR:
QLOG_ERROR() << "Unsupported options in the .xz headers\n"; QLOG_ERROR() << "Unsupported options in the .xz headers\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
@ -239,12 +246,14 @@ void ForgeXzDownload::decompressAndInstall()
case XZ_BUF_ERROR: case XZ_BUF_ERROR:
QLOG_ERROR() << "File is corrupt\n"; QLOG_ERROR() << "File is corrupt\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
default: default:
QLOG_ERROR() << "Bug!\n"; QLOG_ERROR() << "Bug!\n";
xz_dec_end(s); xz_dec_end(s);
m_status = Job_Failed;
emit failed(index_within_job); emit failed(index_within_job);
return; return;
} }
@ -260,6 +269,7 @@ void ForgeXzDownload::decompressAndInstall()
} }
catch (std::runtime_error &err) catch (std::runtime_error &err)
{ {
m_status = Job_Failed;
QLOG_ERROR() << "Error unpacking " << pack_name.toUtf8() << " : " << err.what(); QLOG_ERROR() << "Error unpacking " << pack_name.toUtf8() << " : " << err.what();
QFile f(m_target_path); QFile f(m_target_path);
if (f.exists()) if (f.exists())