Commit 4b6cd0f2 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

Merge branch '2.2'

BUG: 316187
parents 2a2d8ca9 1dd424c1
......@@ -628,6 +628,14 @@ void AptWorker::downloadArchives()
void AptWorker::installFile()
{
m_trans->setStatus(QApt::RunningStatus);
// FIXME: bloody workaround.
// setTransaction contains logic WRT locale and debconf setup, which
// is also useful to dpkg. For now simply reuse WorkerInstallProgress
// as it has no adverse effects.
WorkerInstallProgress installProgress(50, 90);
installProgress.setTransaction(m_trans);
QApt::DebFile deb(m_trans->filePath());
QString debArch = deb.architecture();
......
......@@ -23,6 +23,7 @@
#include <QtCore/QStringBuilder>
#include <QtCore/QStringList>
#include <QtCore/QTextCodec>
#include <QDebug>
#include <apt-pkg/error.h>
......@@ -56,6 +57,22 @@ void WorkerInstallProgress::setTransaction(Transaction *trans)
m_trans = trans;
std::setlocale(LC_ALL, m_trans->locale().toAscii());
// FIXME: bloody workaround.
// Since QLocale::system and consequently QTextCodec::forLocale is
// set way before we get here there's a need to manually override
// the already set default codec with that is requested by the client.
// Since the client talks to us about posix locales however we cannot
// expect a reliable mapping from split(.).last() to a proper codec.
// Also there is no explicit Qt api to translate a given posix locale
// to QLocale & QTextCodec.
// Ultimately transactions should get new properties for QLocale::name
// and QTextCodec::name, assuming generally meaningful values we can
// through those properties accurately recreate the client locale env.
QTextCodec *codec = QTextCodec::codecForName(m_trans->locale().split('.').last().toUtf8());
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForTr(codec);
if ((trans->frontendCaps() & QApt::DebconfCap) && !trans->debconfPipe().isEmpty()) {
setenv("DEBIAN_FRONTEND", "passthrough", 1);
setenv("DEBCONF_PIPE", trans->debconfPipe().toAscii(), 1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment