diff --git a/chrome/updater/configurator.cc b/chrome/updater/configurator.cc index 4027fa4ae04..98c6b2eefd5 100644 --- a/chrome/updater/configurator.cc +++ b/chrome/updater/configurator.cc @@ -13,6 +13,7 @@ #include "chrome/updater/patcher.h" #include "chrome/updater/prefs.h" #include "chrome/updater/unzipper.h" +#include "chrome/updater/util.h" #include "chrome/updater/updater_constants.h" #include "cobalt/browser/switches.h" #include "cobalt/script/javascript_engine.h" @@ -30,62 +31,16 @@ using starboard::kSystemPropertyMaxLength; namespace { -// Map of Omaha config IDs with channel and starboard version as indices. -static const std::unordered_map kChannelAndSbVersionToOmahaIdMap = { - {"control14", "{5F96FC23-F232-40B6-B283-FAD8DB21E1A7}"}, - {"control15", "{409F15C9-4E10-4224-9DD1-BEE7E5A2A55B}"}, - {"control16", "{30061C09-D926-4B82-8D42-600C06B6134C}"}, - {"experiment14", "{9BCC272B-3F78-43FD-9B34-A3810AE1B85D}"}, - {"experiment15", "{C412A665-9BAD-4981-93C0-264233720222}"}, - {"experiment16", "{32B5CF5A-96A4-4F64-AD0E-7C62705222FF}"}, - {"prod14", "{B3F9BCA2-8AD1-448F-9829-BB9F432815DE}"}, - {"prod15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, - {"prod16", "{10F11416-0D9C-4CB1-A82A-0168594E8256}"}, - {"qa14","{94C5D27F-5981-46E8-BD4F-4645DBB5AFD3}"}, - {"qa15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, - {"qa16", "{B725A22D-553A-49DC-BD61-F042B07C6B22}"}, - {"rollback14", "{A83768A9-9556-48C2-8D5E-D7C845C16C19}"}, - {"rollback15", "{1526831E-B130-43C1-B31A-AEE6E90063ED}"}, - {"rollback16", "{2A1FCBE4-E4F9-4DC3-9E1A-700FBC1D551B}"}, - {"static14", "{8001FE2C-F523-4AEC-A753-887B5CC35EBB}"}, - {"static15", "{F58B7C5F-8DC5-4E32-8CF1-455F1302D609}"}, - {"static16", "{A68BE0E4-7EE3-451A-9395-A789518FF7C5}"}, - {"t1app14", "{7C8BCB72-705D-41A6-8189-D8312E795302}"}, - {"t1app15", "{12A94004-F661-42A7-9DFC-325A4DA72D29}"}, - {"t1app16", "{B677F645-A8DB-4014-BD95-C6C06715C7CE}"}, - {"tcrash14", "{328C380E-75B4-4D7A-BF98-9B443ABA8FFF}"}, - {"tcrash15", "{1A924F1C-A46D-4104-8CCE-E8DB3C6E0ED1}"}, - {"tcrash16", "{0F876BD6-7C15-4B09-8C95-9FBBA2F93E94}"}, - {"test14", "{DB2CC00C-4FA9-4DB8-A947-647CEDAEBF29}"}, - {"test15", "{24A8A3BF-5944-4D5C-A5C4-BE00DF0FB9E1}"}, - {"test16", "{5EADD81E-A98E-4F8B-BFAA-875509A51991}"}, - {"tfailv14", "{F06C3516-8706-4579-9493-881F84606E98}"}, - {"tfailv15", "{36CFD9A7-1A73-4E8A-AC05-E3013CC4F75C}"}, - {"tfailv16", "{8F9EC6E9-B89D-4C75-9E7E-A5B9B0254844}"}, - {"tmsabi14", "{87EDA0A7-ED13-4A72-9CD9-EBD4BED081AB}"}, - {"tmsabi15", "{60296D57-2572-4B16-89EC-C9DA5A558E8A}"}, - {"tmsabi16", "{1B915523-8ADD-4C66-9E8F-D73FB48A4296}"}, - {"tnoop14", "{C407CF3F-21A4-47AA-9667-63E7EEA750CB}"}, - {"tnoop15", "{FC568D82-E608-4F15-95F0-A539AB3F6E9D}"}, - {"tnoop16", "{5F4E8AD9-067B-443A-8B63-A7CC4C95B264}"}, - {"tseries114", "{0A8A3F51-3FAB-4427-848E-28590DB75AA1}"}, - {"tseries115", "{92B7AC78-1B3B-4CE6-BA39-E1F50C4F5F72}"}, - {"tseries116", "{6E7C6582-3DC4-4B48-97F2-FA43614B2B4D}"}, - {"tseries214", "{7CB65840-5FA4-4706-BC9E-86A89A56B4E0}"}, - {"tseries215", "{7CCA7DB3-C27D-4CEB-B6A5-50A4D6DE40DA}"}, - {"tseries216", "{012BF4F5-8463-490F-B6C8-E9B64D972152}"}, -}; // Default time constants. const int kDelayOneMinute = 60; const int kDelayOneHour = kDelayOneMinute * 60; const char kDefaultUpdaterChannel[] = "prod"; +// Legacy prod config containing all prod, tests and static channels with all +// SB versions of C25 and prior. const char kOmahaCobaltAppID[] = "{6D4E53F3-CC64-4CB8-B6BD-AB0B8F300E1C}"; const char kOmahaCobaltTrunkAppID[] = "{A9557415-DDCD-4948-8113-C643EFCF710C}"; const char kOmahaCobaltLTSNightlyAppID[] = "{26CD2F67-091F-4680-A9A9-2229635B65A5}"; -const char kOmahaCobaltProdSb14AppID[] = "{B3F9BCA2-8AD1-448F-9829-BB9F432815DE}"; -const char kOmahaCobaltProdSb15AppID[] = "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"; -const char kOmahaCobaltProdSb16AppID[] = "{10F11416-0D9C-4CB1-A82A-0168594E8256}"; std::string GetDeviceProperty(SbSystemPropertyId id) { char value[kSystemPropertyMaxLength]; @@ -318,26 +273,30 @@ std::string Configurator::GetAppGuidHelper(const std::string& updater_channel, return kOmahaCobaltTrunkAppID; } std::string channel(updater_channel); - if (std::regex_match(updater_channel, std::regex("2[5-9]lts\\d+"))) { + // This regex matches to all static channels for C25 and newer in the format + // of XXltsY. + // New Omaha static channel configs contain C25 and later binaries. + if (std::regex_match(updater_channel, + std::regex("(2[5-9]|[3-9][0-9])lts\\d+"))) { channel = "static"; } - auto it = kChannelAndSbVersionToOmahaIdMap.find(channel + std::to_string(sb_version)); + auto it = kChannelAndSbVersionToOmahaIdMap.find( + channel + std::to_string(sb_version)); if (it != kChannelAndSbVersionToOmahaIdMap.end()) { return it->second; } - LOG(INFO) << "Configurator::GetAppGuidHelper updater channel and starboard combination is invalid."; - - // All invalid channel requests get updates from prod config. - if (sb_version == 14) { - return kOmahaCobaltProdSb14AppID; + LOG(INFO) << "Configurator::GetAppGuidHelper updater channel and starboard " + << "combination is undefined with the new Omaha configs."; + + // All undefined channel requests go to prod configs except for static + // channel requestsf for C24 and older. + if (!std::regex_match(updater_channel, std::regex("2[0-4]lts\\d+")) && + sb_version >= 14 && sb_version <= 16) { + return kChannelAndSbVersionToOmahaIdMap.at("prod" + + std::to_string(sb_version)); } - if (sb_version == 15) { - return kOmahaCobaltProdSb15AppID; - } - if (sb_version == 16) { - return kOmahaCobaltProdSb16AppID; - } - // Should not reach here. + // Requests with other SB versions and older static channels go to the legacy + // config. LOG(INFO) << "Configurator::GetAppGuidHelper starboard version is invalid."; return kOmahaCobaltAppID; } diff --git a/chrome/updater/configurator_test.cc b/chrome/updater/configurator_test.cc index ccb4128224a..793f91fd80e 100644 --- a/chrome/updater/configurator_test.cc +++ b/chrome/updater/configurator_test.cc @@ -13,54 +13,11 @@ // limitations under the License. #include "chrome/updater/configurator.h" +#include "chrome/updater/util.h" #include "testing/gtest/include/gtest/gtest.h" namespace { -static const std::unordered_map kChannelAndSbVersionToOmahaIdMap = { - {"control14", "{5F96FC23-F232-40B6-B283-FAD8DB21E1A7}"}, - {"control15", "{409F15C9-4E10-4224-9DD1-BEE7E5A2A55B}"}, - {"control16", "{30061C09-D926-4B82-8D42-600C06B6134C}"}, - {"experiment14", "{9BCC272B-3F78-43FD-9B34-A3810AE1B85D}"}, - {"experiment15", "{C412A665-9BAD-4981-93C0-264233720222}"}, - {"experiment16", "{32B5CF5A-96A4-4F64-AD0E-7C62705222FF}"}, - {"prod14", "{B3F9BCA2-8AD1-448F-9829-BB9F432815DE}"}, - {"prod15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, - {"prod16", "{10F11416-0D9C-4CB1-A82A-0168594E8256}"}, - {"qa14","{94C5D27F-5981-46E8-BD4F-4645DBB5AFD3}"}, - {"qa15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, - {"qa16", "{B725A22D-553A-49DC-BD61-F042B07C6B22}"}, - {"rollback14", "{A83768A9-9556-48C2-8D5E-D7C845C16C19}"}, - {"rollback15", "{1526831E-B130-43C1-B31A-AEE6E90063ED}"}, - {"rollback16", "{2A1FCBE4-E4F9-4DC3-9E1A-700FBC1D551B}"}, - {"static14", "{8001FE2C-F523-4AEC-A753-887B5CC35EBB}"}, - {"static15", "{F58B7C5F-8DC5-4E32-8CF1-455F1302D609}"}, - {"static16", "{A68BE0E4-7EE3-451A-9395-A789518FF7C5}"}, - {"t1app14", "{7C8BCB72-705D-41A6-8189-D8312E795302}"}, - {"t1app15", "{12A94004-F661-42A7-9DFC-325A4DA72D29}"}, - {"t1app16", "{B677F645-A8DB-4014-BD95-C6C06715C7CE}"}, - {"tcrash14", "{328C380E-75B4-4D7A-BF98-9B443ABA8FFF}"}, - {"tcrash15", "{1A924F1C-A46D-4104-8CCE-E8DB3C6E0ED1}"}, - {"tcrash16", "{0F876BD6-7C15-4B09-8C95-9FBBA2F93E94}"}, - {"test14", "{DB2CC00C-4FA9-4DB8-A947-647CEDAEBF29}"}, - {"test15", "{24A8A3BF-5944-4D5C-A5C4-BE00DF0FB9E1}"}, - {"test16", "{5EADD81E-A98E-4F8B-BFAA-875509A51991}"}, - {"tfailv14", "{F06C3516-8706-4579-9493-881F84606E98}"}, - {"tfailv15", "{36CFD9A7-1A73-4E8A-AC05-E3013CC4F75C}"}, - {"tfailv16", "{8F9EC6E9-B89D-4C75-9E7E-A5B9B0254844}"}, - {"tmsabi14", "{87EDA0A7-ED13-4A72-9CD9-EBD4BED081AB}"}, - {"tmsabi15", "{60296D57-2572-4B16-89EC-C9DA5A558E8A}"}, - {"tmsabi16", "{1B915523-8ADD-4C66-9E8F-D73FB48A4296}"}, - {"tnoop14", "{C407CF3F-21A4-47AA-9667-63E7EEA750CB}"}, - {"tnoop15", "{FC568D82-E608-4F15-95F0-A539AB3F6E9D}"}, - {"tnoop16", "{5F4E8AD9-067B-443A-8B63-A7CC4C95B264}"}, - {"tseries114", "{0A8A3F51-3FAB-4427-848E-28590DB75AA1}"}, - {"tseries115", "{92B7AC78-1B3B-4CE6-BA39-E1F50C4F5F72}"}, - {"tseries116", "{6E7C6582-3DC4-4B48-97F2-FA43614B2B4D}"}, - {"tseries214", "{7CB65840-5FA4-4706-BC9E-86A89A56B4E0}"}, - {"tseries215", "{7CCA7DB3-C27D-4CEB-B6A5-50A4D6DE40DA}"}, - {"tseries216", "{012BF4F5-8463-490F-B6C8-E9B64D972152}"}, -}; const char kOmahaCobaltAppID[] = "{6D4E53F3-CC64-4CB8-B6BD-AB0B8F300E1C}"; const char kOmahaCobaltLTSNightlyAppID[] = "{26CD2F67-091F-4680-A9A9-2229635B65A5}"; diff --git a/chrome/updater/util.cc b/chrome/updater/util.cc index 164c1a9af22..3b68b5fadc5 100644 --- a/chrome/updater/util.cc +++ b/chrome/updater/util.cc @@ -40,6 +40,52 @@ const char kUncompressedLibraryPath[] = "lib/libcobalt.so"; } // namespace +const std::unordered_map + kChannelAndSbVersionToOmahaIdMap = { + {"control14", "{5F96FC23-F232-40B6-B283-FAD8DB21E1A7}"}, + {"control15", "{409F15C9-4E10-4224-9DD1-BEE7E5A2A55B}"}, + {"control16", "{30061C09-D926-4B82-8D42-600C06B6134C}"}, + {"experiment14", "{9BCC272B-3F78-43FD-9B34-A3810AE1B85D}"}, + {"experiment15", "{C412A665-9BAD-4981-93C0-264233720222}"}, + {"experiment16", "{32B5CF5A-96A4-4F64-AD0E-7C62705222FF}"}, + {"prod14", "{B3F9BCA2-8AD1-448F-9829-BB9F432815DE}"}, + {"prod15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, + {"prod16", "{10F11416-0D9C-4CB1-A82A-0168594E8256}"}, + {"qa14","{94C5D27F-5981-46E8-BD4F-4645DBB5AFD3}"}, + {"qa15", "{14ED1D09-DAD2-4FB2-A89B-3ADC82137BCD}"}, + {"qa16", "{B725A22D-553A-49DC-BD61-F042B07C6B22}"}, + {"rollback14", "{A83768A9-9556-48C2-8D5E-D7C845C16C19}"}, + {"rollback15", "{1526831E-B130-43C1-B31A-AEE6E90063ED}"}, + {"rollback16", "{2A1FCBE4-E4F9-4DC3-9E1A-700FBC1D551B}"}, + {"static14", "{8001FE2C-F523-4AEC-A753-887B5CC35EBB}"}, + {"static15", "{F58B7C5F-8DC5-4E32-8CF1-455F1302D609}"}, + {"static16", "{A68BE0E4-7EE3-451A-9395-A789518FF7C5}"}, + {"t1app14", "{7C8BCB72-705D-41A6-8189-D8312E795302}"}, + {"t1app15", "{12A94004-F661-42A7-9DFC-325A4DA72D29}"}, + {"t1app16", "{B677F645-A8DB-4014-BD95-C6C06715C7CE}"}, + {"tcrash14", "{328C380E-75B4-4D7A-BF98-9B443ABA8FFF}"}, + {"tcrash15", "{1A924F1C-A46D-4104-8CCE-E8DB3C6E0ED1}"}, + {"tcrash16", "{0F876BD6-7C15-4B09-8C95-9FBBA2F93E94}"}, + {"test14", "{DB2CC00C-4FA9-4DB8-A947-647CEDAEBF29}"}, + {"test15", "{24A8A3BF-5944-4D5C-A5C4-BE00DF0FB9E1}"}, + {"test16", "{5EADD81E-A98E-4F8B-BFAA-875509A51991}"}, + {"tfailv14", "{F06C3516-8706-4579-9493-881F84606E98}"}, + {"tfailv15", "{36CFD9A7-1A73-4E8A-AC05-E3013CC4F75C}"}, + {"tfailv16", "{8F9EC6E9-B89D-4C75-9E7E-A5B9B0254844}"}, + {"tmsabi14", "{87EDA0A7-ED13-4A72-9CD9-EBD4BED081AB}"}, + {"tmsabi15", "{60296D57-2572-4B16-89EC-C9DA5A558E8A}"}, + {"tmsabi16", "{1B915523-8ADD-4C66-9E8F-D73FB48A4296}"}, + {"tnoop14", "{C407CF3F-21A4-47AA-9667-63E7EEA750CB}"}, + {"tnoop15", "{FC568D82-E608-4F15-95F0-A539AB3F6E9D}"}, + {"tnoop16", "{5F4E8AD9-067B-443A-8B63-A7CC4C95B264}"}, + {"tseries114", "{0A8A3F51-3FAB-4427-848E-28590DB75AA1}"}, + {"tseries115", "{92B7AC78-1B3B-4CE6-BA39-E1F50C4F5F72}"}, + {"tseries116", "{6E7C6582-3DC4-4B48-97F2-FA43614B2B4D}"}, + {"tseries214", "{7CB65840-5FA4-4706-BC9E-86A89A56B4E0}"}, + {"tseries215", "{7CCA7DB3-C27D-4CEB-B6A5-50A4D6DE40DA}"}, + {"tseries216", "{012BF4F5-8463-490F-B6C8-E9B64D972152}"}, +}; + const char kDefaultManifestVersion[] = "1.0.0"; bool CreateProductDirectory(base::FilePath* path) { diff --git a/chrome/updater/util.h b/chrome/updater/util.h index c3dd6db657e..2ad1d8c0816 100644 --- a/chrome/updater/util.h +++ b/chrome/updater/util.h @@ -17,6 +17,10 @@ class FilePath; namespace cobalt { namespace updater { +// Map of Omaha config IDs with channel and starboard version as indices. +extern const std::unordered_map + kChannelAndSbVersionToOmahaIdMap; + // The default manifest version to assume when the actual manifest cannot be // parsed for any reason. This should not be used for installation manager // errors, or any other error unrelated to parsing the manifest.