diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp index b60245c3d5..4abaeb2aa7 100644 --- a/rbutil/rbutilqt/base/serverinfo.cpp +++ b/rbutil/rbutilqt/base/serverinfo.cpp @@ -31,20 +31,27 @@ const static struct { const char* def; } ServerInfoList[] = { { ServerInfo::CurReleaseVersion, ":platform:/releaseversion", "" }, + { ServerInfo::CurReleaseUrl, ":platform:/releaseurl", "" }, { ServerInfo::CurStatus, ":platform:/status", "Unknown" }, { ServerInfo::BleedingRevision, "bleedingrev", "" }, { ServerInfo::BleedingDate, "bleedingdate", "" }, + { ServerInfo::CurDevelUrl, ":platform:/develurl", "" }, }; QMap ServerInfo::serverInfos; void ServerInfo::readBuildInfo(QString file) { + QString releaseBaseUrl = SystemInfo::value(SystemInfo::ReleaseUrl).toString(); + QString develBaseUrl = SystemInfo::value(SystemInfo::BleedingUrl).toString(); + QString manualBaseUrl = SystemInfo::value(SystemInfo::ManualUrl).toString(); + QSettings info(file, QSettings::IniFormat); - setValue(ServerInfo::BleedingRevision,info.value("bleeding/rev")); + QString developmentRevision = info.value("bleeding/rev").toString(); + setValue(ServerInfo::BleedingRevision, developmentRevision); QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ"); - setValue(ServerInfo::BleedingDate,date.toString(Qt::ISODate)); + setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate)); info.beginGroup("release"); QStringList keys = info.allKeys(); @@ -58,13 +65,18 @@ void ServerInfo::readBuildInfo(QString file) // them the same time. QStringList variants; variants = SystemInfo::platforms(SystemInfo::PlatformVariantDisabled, platforms.at(i)); - QVariant release; + QString releaseVersion; + QString releaseUrl; info.beginGroup("release"); if(keys.contains(platforms.at(i))) { - release = info.value(platforms.at(i)); + releaseVersion = info.value(platforms.at(i)).toString(); + // construct release download URL + releaseUrl = releaseBaseUrl; + releaseUrl.replace("%MODEL%", platforms.at(i)); + releaseUrl.replace("%RELVERSION%", releaseVersion); } - info.endGroup(); + info.beginGroup("status"); QString status = tr("Unknown"); switch(info.value(platforms.at(i)).toInt()) @@ -82,10 +94,19 @@ void ServerInfo::readBuildInfo(QString file) break; } info.endGroup(); + // release and development URLs are not provided by the server but + // constructed. + QString develUrl = develBaseUrl; + develUrl.replace("%MODEL%", platforms.at(i)); + develUrl.replace("%RELVERSION%", developmentRevision); // set variants (if any) for(int j = 0; j < variants.size(); ++j) { setPlatformValue(variants.at(j), ServerInfo::CurStatus, status); - setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, release); + if(!releaseUrl.isEmpty()) { + setPlatformValue(variants.at(j), ServerInfo::CurReleaseVersion, releaseVersion); + setPlatformValue(variants.at(j), ServerInfo::CurReleaseUrl, releaseUrl); + } + setPlatformValue(variants.at(j), ServerInfo::CurDevelUrl, develUrl); } } } diff --git a/rbutil/rbutilqt/base/serverinfo.h b/rbutil/rbutilqt/base/serverinfo.h index 69aa26f3e6..f541c86540 100644 --- a/rbutil/rbutilqt/base/serverinfo.h +++ b/rbutil/rbutilqt/base/serverinfo.h @@ -32,6 +32,8 @@ class ServerInfo : public QObject enum ServerInfos { CurReleaseVersion, CurStatus, + CurReleaseUrl, + CurDevelUrl, BleedingRevision, BleedingDate, }; diff --git a/rbutil/rbutilqt/installwindow.cpp b/rbutil/rbutilqt/installwindow.cpp index 7a78154561..1306043027 100644 --- a/rbutil/rbutilqt/installwindow.cpp +++ b/rbutil/rbutilqt/installwindow.cpp @@ -118,7 +118,7 @@ void InstallWindow::accept() logger = new ProgressLoggerGui(this); logger->show(); QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString(); - qDebug() << "[Install] mountpoint:" << RbSettings::value(RbSettings::Mountpoint).toString(); + qDebug() << "[Install] mountpoint:" << mountPoint; // show dialog with error if mount point is wrong if(!QFileInfo(mountPoint).isDir()) { logger->addItem(tr("Mount point is wrong!"),LOGERROR); @@ -127,14 +127,13 @@ void InstallWindow::accept() } QString myversion; - QString buildname = SystemInfo::value(SystemInfo::CurBuildserverModel).toString(); if(ui.radioStable->isChecked()) { - file = SystemInfo::value(SystemInfo::ReleaseUrl).toString(); + file = ServerInfo::value(ServerInfo::CurReleaseUrl).toString(); RbSettings::setValue(RbSettings::Build, "stable"); myversion = ServerInfo::value(ServerInfo::CurReleaseVersion).toString(); } else if(ui.radioCurrent->isChecked()) { - file = SystemInfo::value(SystemInfo::BleedingUrl).toString(); + file = ServerInfo::value(ServerInfo::CurDevelUrl).toString(); RbSettings::setValue(RbSettings::Build, "current"); myversion = "r" + ServerInfo::value(ServerInfo::BleedingRevision).toString(); } @@ -142,9 +141,6 @@ void InstallWindow::accept() qDebug() << "[Install] no build selected -- this shouldn't happen"; return; } - file.replace("%MODEL%", buildname); - file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString()); - RbSettings::sync(); QString warning = Utils::checkEnvironment(false); diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 279b73b5be..726c4f4d36 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -529,9 +529,7 @@ void RbUtilQt::installBtn() bool RbUtilQt::installAuto() { - QString file = SystemInfo::value(SystemInfo::ReleaseUrl).toString(); - file.replace("%MODEL%", SystemInfo::value(SystemInfo::CurBuildserverModel).toString()); - file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString()); + QString file = ServerInfo::value(ServerInfo::CurReleaseUrl).toString(); // check installed Version and Target QString warning = Utils::checkEnvironment(false);