Added patch that will better detect which Linux distribution is used when determining which plugins to URL to generate.

This commit is contained in:
Adam Potolsky 2015-02-14 19:25:22 -08:00
parent b9e178a9ee
commit bca57674d0
3 changed files with 79 additions and 21 deletions

View File

@ -30,8 +30,10 @@ static QString kPluginsBaseUrl = "http://synergy-project.org/files/plugins/";
static const char kWinProcessorArch32[] = "Windows-x86";
static const char kWinProcessorArch64[] = "Windows-x64";
static const char kMacProcessorArch[] = "MacOSX-i386";
static const char kLinuxProcessorArch32[] = "Linux-i686";
static const char kLinuxProcessorArch64[] = "Linux-x86_64";
static const char kLinuxProcessorArchDeb32[] = "Linux-i686-deb";
static const char kLinuxProcessorArchDeb64[] = "Linux-x86_64-deb";
static const char kLinuxProcessorArchRpm32[] = "Linux-i686-rpm";
static const char kLinuxProcessorArchRpm64[] = "Linux-x86_64-rpm";
static QString kOpenSSLBaseUrl = "http://synergy-foss.org/files/tools/";
static QString kCertificateLifetime = "365";
static QString kCertificateSubjectInfo = "/CN=Synergy";
@ -184,11 +186,17 @@ QString PluginManager::getPluginUrl(const QString& pluginName)
else if (arch == Mac_i386) {
result.append(kMacProcessorArch);
}
else if (arch == Linux_i686) {
result.append(kLinuxProcessorArch32);
else if (arch == Linux_rpm_i686) {
result.append(kLinuxProcessorArchRpm32);
}
else if (arch == Linux_x86_64) {
result.append(kLinuxProcessorArch64);
else if (arch == Linux_rpm_x86_64) {
result.append(kLinuxProcessorArchRpm64);
}
else if (arch == Linux_deb_i686) {
result.append(kLinuxProcessorArchDeb32);
}
else if (arch == Linux_deb_x86_64) {
result.append(kLinuxProcessorArchDeb64);
}
else {
emit error(

View File

@ -22,8 +22,10 @@ enum qProcessorArch {
Win_x86,
Win_x64,
Mac_i386,
Linux_i686,
Linux_x86_64,
Linux_rpm_i686,
Linux_rpm_x86_64,
Linux_deb_i686,
Linux_deb_x86_64,
unknown
};

View File

@ -32,6 +32,7 @@
#if defined(Q_OS_LINUX)
static const char kLinuxI686[] = "i686";
static const char kLinuxX8664[] = "x86_64";
static const char kUbuntu[] = "Ubuntu";
#endif
void setIndexFromItemData(QComboBox* comboBox, const QVariant& itemData)
@ -86,19 +87,22 @@ int checkProcessorArch()
#elif defined(Q_OS_MAC)
return Mac_i386;
#else
QString program("uname");
QStringList args("-m");
QProcess process;
process.setReadChannel(QProcess::StandardOutput);
process.start(program, args);
bool success = process.waitForStarted();
bool version32 = false;
bool debPackaging = false;
QString program1("uname");
QStringList args1("-m");
QProcess process1;
process1.setReadChannel(QProcess::StandardOutput);
process1.start(program1, args1);
bool success = process1.waitForStarted();
QString out, error;
if (success)
{
if (process.waitForFinished()) {
out = process.readAllStandardOutput();
error = process.readAllStandardError();
if (process1.waitForFinished()) {
out = process1.readAllStandardOutput();
error = process1.readAllStandardError();
}
}
@ -108,16 +112,60 @@ int checkProcessorArch()
if (out.isEmpty() ||
!error.isEmpty() ||
!success ||
process.exitCode() != 0)
process1.exitCode() != 0)
{
return unknown;
}
if (out == kLinuxI686) {
return Linux_i686;
version32 = true;
}
else if (out == kLinuxX8664) {
return Linux_x86_64;
QString program2("python");
QStringList args2("-mplatform");
QProcess process2;
process2.setReadChannel(QProcess::StandardOutput);
process2.start(program2, args2);
success = process2.waitForStarted();
if (success)
{
if (process2.waitForFinished()) {
out = process2.readAllStandardOutput();
error = process2.readAllStandardError();
}
}
out = out.trimmed();
error = error.trimmed();
if (out.isEmpty() ||
!error.isEmpty() ||
!success ||
process2.exitCode() != 0)
{
return unknown;
}
if (out.contains(kUbuntu)) {
debPackaging = true;
}
if (version32) {
if (debPackaging) {
return Linux_deb_i686;
}
else {
return Linux_rpm_i686;
}
}
else {
if (debPackaging) {
return Linux_deb_x86_64;
}
else {
return Linux_rpm_x86_64;
}
}
#endif
return unknown;