rbutil: Rework server info data handling.

Allow constructing release candidate URL from configuration the same way
we construct the URL for releases.

Note that the server path used does not exist, taken from old release
candidate builds not available anymore.

Change-Id: I7332f08df05ed39724b4900556aaa1f5e0ba463b
This commit is contained in:
Dominik Riebeling 2020-11-15 21:23:02 +01:00
parent 9bb60b7d85
commit 6c2780e709
6 changed files with 14 additions and 9 deletions

View file

@ -85,22 +85,21 @@ QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
value = value.toStringList().at(0);
break;
case CurReleaseUrl:
case RelCandidateUrl:
{
QString version = value.toStringList().at(0);
if(value.toStringList().size() > 1)
value = value.toStringList().at(1);
else if(!version.isEmpty()) // if value is empty, return empty url.
else if(!version.isEmpty() && info == CurReleaseUrl)
value = SystemInfo::value(SystemInfo::ReleaseUrl).toString()
.replace("%MODEL%", platform)
.replace("%RELVERSION%", version);
else if(!version.isEmpty() && info == RelCandidateUrl)
value = SystemInfo::value(SystemInfo::CandidateUrl).toString()
.replace("%MODEL%", platform)
.replace("%RELVERSION%", version);
}
break;
case RelCandidateUrl:
if(value.toStringList().size() > 1)
value = value.toStringList().at(1);
else
value.clear();
break;
case CurDevelUrl:
value = SystemInfo::value(SystemInfo::BleedingUrl).toString()
.replace("%MODEL%", platform);

View file

@ -42,6 +42,7 @@ const static struct {
{ SystemInfo::Wolf3DUrl, "wolf3d_url" },
{ SystemInfo::XWorldUrl, "xworld_url" },
{ SystemInfo::ReleaseUrl, "release_url" },
{ SystemInfo::CandidateUrl, "rc_url" },
{ SystemInfo::DailyUrl, "daily_url" },
{ SystemInfo::BuildInfoUrl, "build_info_url" },
{ SystemInfo::GenlangUrl, "genlang_url" },

View file

@ -50,6 +50,7 @@ class SystemInfo : public QObject
Wolf3DUrl,
XWorldUrl,
ReleaseUrl,
CandidateUrl,
ReleaseVoiceUrl,
ReleaseFontUrl,
BuildInfoUrl,

View file

@ -2,6 +2,7 @@
; builds
release_url=http://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip
bleeding_url=http://build.rockbox.org/data/rockbox-%MODEL%.zip
rc_url=http://download.rockbox.org/release-candidate/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip
; voice files
release_voice_url=http://download.rockbox.org/release/%RELVERSION%/%MODEL%-%RELVERSION%-english.zip

View file

@ -53,6 +53,9 @@ QVariant SystemInfo::value(SystemInfo::SystemInfos info)
case SystemInfo::ReleaseUrl:
return QString("https://unittest/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
break;
case SystemInfo::CandidateUrl:
return QString("https://unittest/rc/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
break;
default:
return QString();
}

View file

@ -83,9 +83,9 @@ const struct testvector testdata[] =
{ "gigabeatfx", ServerInfo::RelCandidateVersion, "f9dce96" },
{ "gigabeatfx", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-gigabeatfx.zip" },
{ "archosfmrecorder", ServerInfo::RelCandidateVersion, "f9dce96" },
{ "archosfmrecorder", ServerInfo::RelCandidateUrl, "" },
{ "archosfmrecorder", ServerInfo::RelCandidateUrl, "https://unittest/rc/f9dce96/rockbox-archosfmrecorder-f9dce96.zip" },
{ "archosrecorder", ServerInfo::RelCandidateVersion, "f9dce96" },
{ "archosrecorder", ServerInfo::RelCandidateUrl, "" },
{ "archosrecorder", ServerInfo::RelCandidateUrl, "https://unittest/rc/f9dce96/rockbox-archosrecorder-f9dce96.zip" },
{ "iaudiox5", ServerInfo::RelCandidateVersion, "f9dce96" },
{ "iaudiox5", ServerInfo::RelCandidateUrl, "http://dl.rockbox.org/rc/f9dce96/rockbox-iaudiox5.zip" },
{ "iaudiox5.v", ServerInfo::RelCandidateVersion, "f9dce96" },