mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
rbutil: Use pattern replacement for SystemInfo build type.
Use pattern replacement for lookup instead of expanded values. Will allow simplifying things later for better handling of different build types. Change-Id: Iaad67a6c8654d27c3206cf95a379acab169565bc
This commit is contained in:
parent
6b3b4df6f6
commit
ad37655687
8 changed files with 94 additions and 75 deletions
|
|
@ -95,17 +95,20 @@ QVariant ServerInfo::platformValue(enum ServerInfos info, QString platform)
|
||||||
if(value.toStringList().size() > 1)
|
if(value.toStringList().size() > 1)
|
||||||
value = value.toStringList().at(1);
|
value = value.toStringList().at(1);
|
||||||
else if(!version.isEmpty() && info == CurReleaseUrl)
|
else if(!version.isEmpty() && info == CurReleaseUrl)
|
||||||
value = SystemInfo::value(SystemInfo::ReleaseUrl).toString()
|
value = SystemInfo::value(SystemInfo::BuildUrl,
|
||||||
|
SystemInfo::BuildRelease).toString()
|
||||||
.replace("%MODEL%", platform)
|
.replace("%MODEL%", platform)
|
||||||
.replace("%RELVERSION%", version);
|
.replace("%RELVERSION%", version);
|
||||||
else if(!version.isEmpty() && info == RelCandidateUrl)
|
else if(!version.isEmpty() && info == RelCandidateUrl)
|
||||||
value = SystemInfo::value(SystemInfo::CandidateUrl).toString()
|
value = SystemInfo::value(SystemInfo::BuildUrl,
|
||||||
|
SystemInfo::BuildCandidate).toString()
|
||||||
.replace("%MODEL%", platform)
|
.replace("%MODEL%", platform)
|
||||||
.replace("%RELVERSION%", version);
|
.replace("%RELVERSION%", version);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CurDevelUrl:
|
case CurDevelUrl:
|
||||||
value = SystemInfo::value(SystemInfo::BleedingUrl).toString()
|
value = SystemInfo::value(SystemInfo::BuildUrl,
|
||||||
|
SystemInfo::BuildCurrent).toString()
|
||||||
.replace("%MODEL%", platform);
|
.replace("%MODEL%", platform);
|
||||||
break;
|
break;
|
||||||
case ManualPdfUrl:
|
case ManualPdfUrl:
|
||||||
|
|
|
||||||
|
|
@ -27,28 +27,23 @@ const static struct {
|
||||||
SystemInfo::SystemInfos info;
|
SystemInfo::SystemInfos info;
|
||||||
const char* name;
|
const char* name;
|
||||||
} SystemInfosList[] = {
|
} SystemInfosList[] = {
|
||||||
{ SystemInfo::ManualUrl, "manual_url" },
|
{ SystemInfo::ManualUrl, ":build:/manual_url" },
|
||||||
{ SystemInfo::BleedingUrl, "bleeding_url" },
|
{ SystemInfo::BuildUrl, ":build:/build_url" },
|
||||||
{ SystemInfo::BootloaderUrl, "bootloader_url" },
|
{ SystemInfo::FontUrl, ":build:/font_url" },
|
||||||
{ SystemInfo::BootloaderInfoUrl, "bootloader_info_url" },
|
{ SystemInfo::VoiceUrl, ":build:/voice_url" },
|
||||||
{ SystemInfo::ReleaseFontUrl, "release_font_url" },
|
{ SystemInfo::BootloaderUrl, "bootloader/download_url" },
|
||||||
{ SystemInfo::DailyFontUrl, "daily_font_url" },
|
{ SystemInfo::BootloaderInfoUrl, "bootloader/info_url" },
|
||||||
{ SystemInfo::DailyVoiceUrl, "daily_voice_url" },
|
{ SystemInfo::DoomUrl, "doom_url" },
|
||||||
{ SystemInfo::ReleaseVoiceUrl, "release_voice_url" },
|
{ SystemInfo::Duke3DUrl, "duke3d_url" },
|
||||||
{ SystemInfo::DoomUrl, "doom_url" },
|
{ SystemInfo::PuzzFontsUrl, "puzzfonts_url" },
|
||||||
{ SystemInfo::Duke3DUrl, "duke3d_url" },
|
{ SystemInfo::QuakeUrl, "quake_url" },
|
||||||
{ SystemInfo::PuzzFontsUrl, "puzzfonts_url" },
|
{ SystemInfo::Wolf3DUrl, "wolf3d_url" },
|
||||||
{ SystemInfo::QuakeUrl, "quake_url" },
|
{ SystemInfo::XWorldUrl, "xworld_url" },
|
||||||
{ SystemInfo::Wolf3DUrl, "wolf3d_url" },
|
{ SystemInfo::BuildInfoUrl, "build_info_url" },
|
||||||
{ SystemInfo::XWorldUrl, "xworld_url" },
|
{ SystemInfo::GenlangUrl, "genlang_url" },
|
||||||
{ SystemInfo::ReleaseUrl, "release_url" },
|
{ SystemInfo::ThemesUrl, "themes_url" },
|
||||||
{ SystemInfo::CandidateUrl, "rc_url" },
|
{ SystemInfo::ThemesInfoUrl, "themes_info_url" },
|
||||||
{ SystemInfo::DailyUrl, "daily_url" },
|
{ SystemInfo::RbutilUrl, "rbutil_url" },
|
||||||
{ SystemInfo::BuildInfoUrl, "build_info_url" },
|
|
||||||
{ SystemInfo::GenlangUrl, "genlang_url" },
|
|
||||||
{ SystemInfo::ThemesUrl, "themes_url" },
|
|
||||||
{ SystemInfo::ThemesInfoUrl, "themes_info_url" },
|
|
||||||
{ SystemInfo::RbutilUrl, "rbutil_url" },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const static struct {
|
const static struct {
|
||||||
|
|
@ -84,7 +79,7 @@ void SystemInfo::ensureSystemInfoExists()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVariant SystemInfo::value(enum SystemInfos info)
|
QVariant SystemInfo::value(enum SystemInfos info, BuildType type)
|
||||||
{
|
{
|
||||||
ensureSystemInfoExists();
|
ensureSystemInfoExists();
|
||||||
|
|
||||||
|
|
@ -93,6 +88,20 @@ QVariant SystemInfo::value(enum SystemInfos info)
|
||||||
while(SystemInfosList[i].info != info)
|
while(SystemInfosList[i].info != info)
|
||||||
i++;
|
i++;
|
||||||
QString s = SystemInfosList[i].name;
|
QString s = SystemInfosList[i].name;
|
||||||
|
switch(type) {
|
||||||
|
case BuildDaily:
|
||||||
|
s.replace(":build:", "daily");
|
||||||
|
break;
|
||||||
|
case BuildCurrent:
|
||||||
|
s.replace(":build:", "development");
|
||||||
|
break;
|
||||||
|
case BuildCandidate:
|
||||||
|
s.replace(":build:", "release-candidate");
|
||||||
|
break;
|
||||||
|
case BuildRelease:
|
||||||
|
s.replace(":build:", "release");
|
||||||
|
break;
|
||||||
|
}
|
||||||
LOG_INFO() << "GET:" << s << systemInfos->value(s).toString();
|
LOG_INFO() << "GET:" << s << systemInfos->value(s).toString();
|
||||||
return systemInfos->value(s);
|
return systemInfos->value(s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,21 @@ class SystemInfo : public QObject
|
||||||
MapIncompatible,
|
MapIncompatible,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BuildType {
|
||||||
|
BuildCurrent,
|
||||||
|
BuildDaily,
|
||||||
|
BuildRelease,
|
||||||
|
BuildCandidate
|
||||||
|
};
|
||||||
|
|
||||||
//! All system settings
|
//! All system settings
|
||||||
enum SystemInfos {
|
enum SystemInfos {
|
||||||
|
BuildUrl,
|
||||||
|
FontUrl,
|
||||||
|
VoiceUrl,
|
||||||
ManualUrl,
|
ManualUrl,
|
||||||
BleedingUrl,
|
|
||||||
BootloaderUrl,
|
BootloaderUrl,
|
||||||
BootloaderInfoUrl,
|
BootloaderInfoUrl,
|
||||||
DailyUrl,
|
|
||||||
DailyFontUrl,
|
|
||||||
DailyVoiceUrl,
|
|
||||||
DoomUrl,
|
DoomUrl,
|
||||||
Duke3DUrl,
|
Duke3DUrl,
|
||||||
QuakeUrl,
|
QuakeUrl,
|
||||||
|
|
@ -50,9 +56,6 @@ class SystemInfo : public QObject
|
||||||
Wolf3DUrl,
|
Wolf3DUrl,
|
||||||
XWorldUrl,
|
XWorldUrl,
|
||||||
ReleaseUrl,
|
ReleaseUrl,
|
||||||
CandidateUrl,
|
|
||||||
ReleaseVoiceUrl,
|
|
||||||
ReleaseFontUrl,
|
|
||||||
BuildInfoUrl,
|
BuildInfoUrl,
|
||||||
GenlangUrl,
|
GenlangUrl,
|
||||||
ThemesUrl,
|
ThemesUrl,
|
||||||
|
|
@ -92,7 +95,7 @@ class SystemInfo : public QObject
|
||||||
//! returns a map of usb-ids and their targets
|
//! returns a map of usb-ids and their targets
|
||||||
static QMap<int, QStringList> usbIdMap(enum MapType type);
|
static QMap<int, QStringList> usbIdMap(enum MapType type);
|
||||||
//! get a value from system settings
|
//! get a value from system settings
|
||||||
static QVariant value(enum SystemInfos info);
|
static QVariant value(enum SystemInfos info, BuildType type = BuildCurrent);
|
||||||
//! get a value from system settings for a named platform.
|
//! get a value from system settings for a named platform.
|
||||||
static QVariant platformValue(enum PlatformInfo info, QString platform = "");
|
static QVariant platformValue(enum PlatformInfo info, QString platform = "");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -428,10 +428,10 @@ void SelectiveInstallWidget::installFonts(void)
|
||||||
QString relversion = installInfo.release();
|
QString relversion = installInfo.release();
|
||||||
if(relversion.isEmpty()) {
|
if(relversion.isEmpty()) {
|
||||||
// release is empty for non-release versions (i.e. daily / current)
|
// release is empty for non-release versions (i.e. daily / current)
|
||||||
fontsurl = SystemInfo::value(SystemInfo::DailyFontUrl).toString();
|
fontsurl = SystemInfo::value(SystemInfo::FontUrl, SystemInfo::BuildDaily).toString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fontsurl = SystemInfo::value(SystemInfo::ReleaseFontUrl).toString();
|
fontsurl = SystemInfo::value(SystemInfo::FontUrl, SystemInfo::BuildRelease).toString();
|
||||||
logversion = installInfo.release();
|
logversion = installInfo.release();
|
||||||
}
|
}
|
||||||
fontsurl.replace("%RELEASEVER%", relversion);
|
fontsurl.replace("%RELEASEVER%", relversion);
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,13 @@
|
||||||
[general]
|
[general]
|
||||||
; builds
|
; server information
|
||||||
release_url=http://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip
|
build_info_url=http://download.rockbox.org/build-info
|
||||||
bleeding_url=http://build.rockbox.org/data/rockbox-%MODEL%.zip
|
; genlang -- used to get list of strings (only really old builds)
|
||||||
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
|
|
||||||
genlang_url=http://www.rockbox.org/genlang/?lang=%LANG%&t=%TARGET%&rev=%REVISION%&f=%FEATURES%
|
genlang_url=http://www.rockbox.org/genlang/?lang=%LANG%&t=%TARGET%&rev=%REVISION%&f=%FEATURES%
|
||||||
|
|
||||||
; bootloader
|
|
||||||
bootloader_info_url=http://download.rockbox.org/bootloader/bootloaders-info
|
|
||||||
bootloader_url=http://download.rockbox.org/bootloader
|
|
||||||
|
|
||||||
; themes
|
; themes
|
||||||
themes_url=http://themes.rockbox.org/
|
themes_url=http://themes.rockbox.org/
|
||||||
themes_info_url=http://themes.rockbox.org/rbutilqt.php?target=%TARGET%&release=%RELEASE%&revision=%REVISION%&rbutilver=%RBUTILVER%
|
themes_info_url=http://themes.rockbox.org/rbutilqt.php?target=%TARGET%&release=%RELEASE%&revision=%REVISION%&rbutilver=%RBUTILVER%
|
||||||
|
|
||||||
; server information
|
|
||||||
build_info_url=http://download.rockbox.org/build-info
|
|
||||||
|
|
||||||
; fonts
|
|
||||||
release_font_url=http://download.rockbox.org/release/%RELEASEVER%/rockbox-fonts-%RELEASEVER%.zip
|
|
||||||
daily_font_url=http://download.rockbox.org/daily/fonts/rockbox-fonts.zip
|
|
||||||
|
|
||||||
; other
|
; other
|
||||||
manual_url=http://download.rockbox.org/manual/rockbox-%MODEL%%FORMAT%
|
|
||||||
doom_url=http://download.rockbox.org/useful/rockdoom.zip
|
doom_url=http://download.rockbox.org/useful/rockdoom.zip
|
||||||
duke3d_url=http://download.rockbox.org/useful/duke3d.zip
|
duke3d_url=http://download.rockbox.org/useful/duke3d.zip
|
||||||
quake_url=http://download.rockbox.org/useful/quake.zip
|
quake_url=http://download.rockbox.org/useful/quake.zip
|
||||||
|
|
@ -33,6 +16,35 @@ wolf3d_url=http://download.rockbox.org/useful/wolf3d.zip
|
||||||
xworld_url=http://download.rockbox.org/useful/xworld.zip
|
xworld_url=http://download.rockbox.org/useful/xworld.zip
|
||||||
rbutil_url=http://download.rockbox.org/rbutil/
|
rbutil_url=http://download.rockbox.org/rbutil/
|
||||||
|
|
||||||
|
[bootloader]
|
||||||
|
info_url=http://download.rockbox.org/bootloader/bootloaders-info
|
||||||
|
download_url=http://download.rockbox.org/bootloader
|
||||||
|
|
||||||
|
[release]
|
||||||
|
build_url=https://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip
|
||||||
|
voice_url=https://download.rockbox.org/release/%RELVERSION%/%MODEL%-%RELVERSION%-english.zip
|
||||||
|
font_url=https://download.rockbox.org/release/%RELEASEVER%/rockbox-fonts-%RELEASEVER%.zip
|
||||||
|
manual_url=https://download.rockbox.org/release/%RELEASEVER%/rockbox-%MODEL%%FORMAT%
|
||||||
|
|
||||||
|
[release-candidate]
|
||||||
|
build_url=https://download.rockbox.org/release-candidate/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip
|
||||||
|
voice_url=https://download.rockbox.org/release-candidate/%RELVERSION%/%MODEL%-%RELVERSION%-english.zip
|
||||||
|
font_url=https://download.rockbox.org/release-candidate/%RELEASEVER%/rockbox-fonts-%RELEASEVER%.zip
|
||||||
|
manual_url=https://download.rockbox.org/release-candidate/%RELEASEVER%/rockbox-%MODEL%%FORMAT%
|
||||||
|
|
||||||
|
[development]
|
||||||
|
build_url=http://build.rockbox.org/data/rockbox-%MODEL%.zip
|
||||||
|
voice_url=https://download.rockbox.org/release/%RELVERSION%/%MODEL%-%RELVERSION%-english.zip
|
||||||
|
font_url=https://download.rockbox.org/daily/fonts/rockbox-fonts.zip
|
||||||
|
; manual is only built daily, use that one instead.
|
||||||
|
manual_url=https://download.rockbox.org/daily/manual/rockbox-%MODEL%%FORMAT%
|
||||||
|
|
||||||
|
[daily]
|
||||||
|
build_url=https://download.rockbox.org/daily/%MODEL%/rockbox-%MODEL%.zip
|
||||||
|
voice_url=https://download.rockbox.org/daily/voices/%MODEL%-%VERSION%-%LANGUAGE%.zip
|
||||||
|
font_url=https://download.rockbox.org/daily/fonts/rockbox-fonts.zip
|
||||||
|
manual_url=https://download.rockbox.org/daily/manual/rockbox-%MODEL%%FORMAT%
|
||||||
|
|
||||||
; [platforms] is used to determine the order in the device tree.
|
; [platforms] is used to determine the order in the device tree.
|
||||||
; Only devices present in this section will get displayed!
|
; Only devices present in this section will get displayed!
|
||||||
[platforms]
|
[platforms]
|
||||||
|
|
|
||||||
|
|
@ -483,7 +483,8 @@ void RbUtilQt::installVoice()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
voiceurl = SystemInfo::value(SystemInfo::ReleaseVoiceUrl).toString();
|
voiceurl = SystemInfo::value(SystemInfo::VoiceUrl,
|
||||||
|
SystemInfo::BuildRelease).toString();
|
||||||
logversion = installInfo.release();
|
logversion = installInfo.release();
|
||||||
}
|
}
|
||||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||||
|
|
|
||||||
|
|
@ -38,27 +38,22 @@ QVariant SystemInfo::platformValue(SystemInfo::PlatformInfo info, QString platfo
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SystemInfo::value(SystemInfo::SystemInfos info)
|
QVariant SystemInfo::value(SystemInfo::SystemInfos info, SystemInfo::BuildType type)
|
||||||
{
|
{
|
||||||
switch(info) {
|
(void)info; // test is currently only using BuildUrl.
|
||||||
case SystemInfo::ManualUrl:
|
switch(type) {
|
||||||
return QString("https://unittest/manual/rockbox-%MODEL%%FORMAT%");
|
case SystemInfo::BuildCurrent:
|
||||||
break;
|
|
||||||
case SystemInfo::BleedingUrl:
|
|
||||||
return QString("https://unittest/dev/rockbox-%MODEL%.zip");
|
return QString("https://unittest/dev/rockbox-%MODEL%.zip");
|
||||||
break;
|
case SystemInfo::BuildDaily:
|
||||||
case SystemInfo::DailyUrl:
|
|
||||||
return QString("https://unittest/daily/rockbox-%MODEL%-%RELVERSION%.zip");
|
return QString("https://unittest/daily/rockbox-%MODEL%-%RELVERSION%.zip");
|
||||||
break;
|
case SystemInfo::BuildRelease:
|
||||||
case SystemInfo::ReleaseUrl:
|
|
||||||
return QString("https://unittest/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
|
return QString("https://unittest/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
|
||||||
break;
|
case SystemInfo::BuildCandidate:
|
||||||
case SystemInfo::CandidateUrl:
|
|
||||||
return QString("https://unittest/rc/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
|
return QString("https://unittest/rc/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip");
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return QString();
|
break;
|
||||||
}
|
}
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SystemInfo::platforms(SystemInfo::PlatformType type, QString variant)
|
QStringList SystemInfo::platforms(SystemInfo::PlatformType type, QString variant)
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,6 @@ const struct testvector testdata[] =
|
||||||
{ "iaudiox5.v", ServerInfo::BleedingRevision, "be1be79" },
|
{ "iaudiox5.v", ServerInfo::BleedingRevision, "be1be79" },
|
||||||
{ "iaudiox5.v", ServerInfo::BleedingDate, "2020-11-14T10:57:23" },
|
{ "iaudiox5.v", ServerInfo::BleedingDate, "2020-11-14T10:57:23" },
|
||||||
{ "iaudiox5.v", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iaudiox5.zip" },
|
{ "iaudiox5.v", ServerInfo::CurDevelUrl, "https://unittest/dev/rockbox-iaudiox5.zip" },
|
||||||
{ "iaudiox5.v", ServerInfo::ManualPdfUrl, "https://unittest/manual/rockbox-iaudiox5.pdf" },
|
|
||||||
{ "ipodmini2g", ServerInfo::ManualPdfUrl, "https://unittest/manual/rockbox-ipodmini1g.pdf" },
|
|
||||||
{ "iriverh100", ServerInfo::ManualHtmlUrl, "https://unittest/manual/rockbox-iriverh100/rockbox-build.html" },
|
|
||||||
{ "iriverh120", ServerInfo::ManualZipUrl, "https://unittest/manual/rockbox-iriverh100-html.zip" },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue