cmCPackIFWGenerator.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmCPackIFWGenerator.h"
  4. #include <sstream>
  5. #include <utility>
  6. #include "cmCPackComponentGroup.h"
  7. #include "cmCPackGenerator.h"
  8. #include "cmCPackIFWCommon.h"
  9. #include "cmCPackIFWInstaller.h"
  10. #include "cmCPackIFWPackage.h"
  11. #include "cmCPackIFWRepository.h"
  12. #include "cmCPackLog.h" // IWYU pragma: keep
  13. #include "cmDuration.h"
  14. #include "cmGeneratedFileStream.h"
  15. #include "cmStringAlgorithms.h"
  16. #include "cmSystemTools.h"
  17. #include "cmValue.h"
  18. cmCPackIFWGenerator::cmCPackIFWGenerator()
  19. {
  20. this->Generator = this;
  21. }
  22. cmCPackIFWGenerator::~cmCPackIFWGenerator() = default;
  23. int cmCPackIFWGenerator::PackageFiles()
  24. {
  25. cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl);
  26. // Installer configuragion
  27. this->Installer.GenerateInstallerFile();
  28. // Packages configuration
  29. this->Installer.GeneratePackageFiles();
  30. std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
  31. std::string ifwTmpFile = cmStrCat(ifwTLD, "/IFWOutput.log");
  32. // Run repogen
  33. if (!this->Installer.RemoteRepositories.empty()) {
  34. std::vector<std::string> ifwCmd;
  35. std::string ifwArg;
  36. ifwCmd.emplace_back(this->RepoGen);
  37. if (this->IsVersionLess("2.0.0")) {
  38. ifwCmd.emplace_back("-c");
  39. ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
  40. }
  41. ifwCmd.emplace_back("-p");
  42. ifwCmd.emplace_back(this->toplevel + "/packages");
  43. if (!this->PkgsDirsVector.empty()) {
  44. for (std::string const& it : this->PkgsDirsVector) {
  45. ifwCmd.emplace_back("-p");
  46. ifwCmd.emplace_back(it);
  47. }
  48. }
  49. if (!this->RepoDirsVector.empty()) {
  50. if (!this->IsVersionLess("3.1")) {
  51. for (std::string const& rd : this->RepoDirsVector) {
  52. ifwCmd.emplace_back("--repository");
  53. ifwCmd.emplace_back(rd);
  54. }
  55. } else {
  56. cmCPackIFWLogger(WARNING,
  57. "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
  58. << "variable is set, but content will be skipped, "
  59. << "because this feature available only since "
  60. << "QtIFW 3.1. Please update your QtIFW instance."
  61. << std::endl);
  62. }
  63. }
  64. if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
  65. ifwCmd.emplace_back("-i");
  66. auto it = this->DownloadedPackages.begin();
  67. ifwArg = (*it)->Name;
  68. ++it;
  69. while (it != this->DownloadedPackages.end()) {
  70. ifwArg += "," + (*it)->Name;
  71. ++it;
  72. }
  73. ifwCmd.emplace_back(ifwArg);
  74. }
  75. ifwCmd.emplace_back(this->toplevel + "/repository");
  76. cmCPackIFWLogger(VERBOSE,
  77. "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
  78. << std::endl);
  79. std::string output;
  80. int retVal = 1;
  81. cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
  82. bool res = cmSystemTools::RunSingleCommand(
  83. ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
  84. cmDuration::zero());
  85. if (!res || retVal) {
  86. cmGeneratedFileStream ofs(ifwTmpFile);
  87. ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
  88. << std::endl
  89. << "# Output:" << std::endl
  90. << output << std::endl;
  91. cmCPackIFWLogger(
  92. ERROR,
  93. "Problem running IFW command: "
  94. << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
  95. << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
  96. return 0;
  97. }
  98. if (!this->Repository.RepositoryUpdate.empty() &&
  99. !this->Repository.PatchUpdatesXml()) {
  100. cmCPackIFWLogger(WARNING,
  101. "Problem patch IFW \"Updates\" "
  102. << "file: \"" << this->toplevel
  103. << "/repository/Updates.xml\"" << std::endl);
  104. }
  105. cmCPackIFWLogger(OUTPUT,
  106. "- repository: \"" << this->toplevel
  107. << "/repository\" generated"
  108. << std::endl);
  109. }
  110. // Run binary creator
  111. {
  112. std::vector<std::string> ifwCmd;
  113. std::string ifwArg;
  114. ifwCmd.emplace_back(this->BinCreator);
  115. ifwCmd.emplace_back("-c");
  116. ifwCmd.emplace_back(this->toplevel + "/config/config.xml");
  117. if (!this->Installer.Resources.empty()) {
  118. ifwCmd.emplace_back("-r");
  119. auto it = this->Installer.Resources.begin();
  120. std::string path = this->toplevel + "/resources/";
  121. ifwArg = path + *it;
  122. ++it;
  123. while (it != this->Installer.Resources.end()) {
  124. ifwArg += "," + path + *it;
  125. ++it;
  126. }
  127. ifwCmd.emplace_back(ifwArg);
  128. }
  129. ifwCmd.emplace_back("-p");
  130. ifwCmd.emplace_back(this->toplevel + "/packages");
  131. if (!this->PkgsDirsVector.empty()) {
  132. for (std::string const& it : this->PkgsDirsVector) {
  133. ifwCmd.emplace_back("-p");
  134. ifwCmd.emplace_back(it);
  135. }
  136. }
  137. if (!this->RepoDirsVector.empty()) {
  138. if (!this->IsVersionLess("3.1")) {
  139. for (std::string const& rd : this->RepoDirsVector) {
  140. ifwCmd.emplace_back("--repository");
  141. ifwCmd.emplace_back(rd);
  142. }
  143. } else {
  144. cmCPackIFWLogger(WARNING,
  145. "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
  146. << "variable is set, but content will be skipped, "
  147. << "because this feature available only since "
  148. << "QtIFW 3.1. Please update your QtIFW instance."
  149. << std::endl);
  150. }
  151. }
  152. if (this->OnlineOnly) {
  153. ifwCmd.emplace_back("--online-only");
  154. } else if (!this->DownloadedPackages.empty() &&
  155. !this->Installer.RemoteRepositories.empty()) {
  156. ifwCmd.emplace_back("-e");
  157. auto it = this->DownloadedPackages.begin();
  158. ifwArg = (*it)->Name;
  159. ++it;
  160. while (it != this->DownloadedPackages.end()) {
  161. ifwArg += "," + (*it)->Name;
  162. ++it;
  163. }
  164. ifwCmd.emplace_back(ifwArg);
  165. } else if (!this->DependentPackages.empty()) {
  166. ifwCmd.emplace_back("-i");
  167. ifwArg.clear();
  168. // Binary
  169. auto bit = this->BinaryPackages.begin();
  170. while (bit != this->BinaryPackages.end()) {
  171. ifwArg += (*bit)->Name + ",";
  172. ++bit;
  173. }
  174. // Depend
  175. auto it = this->DependentPackages.begin();
  176. ifwArg += it->second.Name;
  177. ++it;
  178. while (it != this->DependentPackages.end()) {
  179. ifwArg += "," + it->second.Name;
  180. ++it;
  181. }
  182. ifwCmd.emplace_back(ifwArg);
  183. }
  184. // TODO: set correct name for multipackages
  185. if (!this->packageFileNames.empty()) {
  186. ifwCmd.emplace_back(this->packageFileNames[0]);
  187. } else {
  188. ifwCmd.emplace_back("installer" + this->OutputExtension);
  189. }
  190. cmCPackIFWLogger(VERBOSE,
  191. "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd)
  192. << std::endl);
  193. std::string output;
  194. int retVal = 1;
  195. cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
  196. bool res = cmSystemTools::RunSingleCommand(
  197. ifwCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
  198. cmDuration::zero());
  199. if (!res || retVal) {
  200. cmGeneratedFileStream ofs(ifwTmpFile);
  201. ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd)
  202. << std::endl
  203. << "# Output:" << std::endl
  204. << output << std::endl;
  205. cmCPackIFWLogger(
  206. ERROR,
  207. "Problem running IFW command: "
  208. << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl
  209. << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl);
  210. return 0;
  211. }
  212. }
  213. return 1;
  214. }
  215. const char* cmCPackIFWGenerator::GetPackagingInstallPrefix()
  216. {
  217. const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix();
  218. std::string tmpPref = defPrefix ? defPrefix : "";
  219. if (this->Components.empty()) {
  220. tmpPref += "packages/" + this->GetRootPackageName() + "/data";
  221. }
  222. this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref);
  223. return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX")->c_str();
  224. }
  225. const char* cmCPackIFWGenerator::GetOutputExtension()
  226. {
  227. return this->OutputExtension.c_str();
  228. }
  229. int cmCPackIFWGenerator::InitializeInternal()
  230. {
  231. // Search Qt Installer Framework tools
  232. const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
  233. const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
  234. const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION";
  235. if (!this->IsSet(BinCreatorOpt) || !this->IsSet(RepoGenOpt) ||
  236. !this->IsSet(FrameworkVersionOpt)) {
  237. this->ReadListFile("CPackIFW.cmake");
  238. }
  239. // Look 'binarycreator' executable (needs)
  240. cmValue BinCreatorStr = this->GetOption(BinCreatorOpt);
  241. if (!BinCreatorStr || cmIsNOTFOUND(BinCreatorStr)) {
  242. this->BinCreator.clear();
  243. } else {
  244. this->BinCreator = *BinCreatorStr;
  245. }
  246. if (this->BinCreator.empty()) {
  247. cmCPackIFWLogger(ERROR,
  248. "Cannot find QtIFW compiler \"binarycreator\": "
  249. "likely it is not installed, or not in your PATH"
  250. << std::endl);
  251. return 0;
  252. }
  253. // Look 'repogen' executable (optional)
  254. cmValue repoGen = this->GetOption(RepoGenOpt);
  255. if (!repoGen || cmIsNOTFOUND(repoGen)) {
  256. this->RepoGen.clear();
  257. } else {
  258. this->RepoGen = *repoGen;
  259. }
  260. // Framework version
  261. if (cmValue frameworkVersion = this->GetOption(FrameworkVersionOpt)) {
  262. this->FrameworkVersion = *frameworkVersion;
  263. } else {
  264. this->FrameworkVersion = "1.9.9";
  265. }
  266. // Variables that Change Behavior
  267. // Resolve duplicate names
  268. this->ResolveDuplicateNames =
  269. this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
  270. // Additional packages dirs
  271. this->PkgsDirsVector.clear();
  272. if (cmValue dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
  273. cmExpandList(dirs, this->PkgsDirsVector);
  274. }
  275. // Additional repositories dirs
  276. this->RepoDirsVector.clear();
  277. if (cmValue dirs = this->GetOption("CPACK_IFW_REPOSITORIES_DIRECTORIES")) {
  278. cmExpandList(dirs, this->RepoDirsVector);
  279. }
  280. // Installer
  281. this->Installer.Generator = this;
  282. this->Installer.ConfigureFromOptions();
  283. // Repository
  284. this->Repository.Generator = this;
  285. this->Repository.Name = "Unspecified";
  286. if (cmValue site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
  287. this->Repository.Url = *site;
  288. this->Installer.RemoteRepositories.push_back(&this->Repository);
  289. }
  290. // Repositories
  291. if (cmValue RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
  292. std::vector<std::string> RepoAllVector = cmExpandedList(RepoAllStr);
  293. for (std::string const& r : RepoAllVector) {
  294. this->GetRepository(r);
  295. }
  296. }
  297. if (cmValue ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
  298. this->OnlineOnly = cmIsOn(ifwDownloadAll);
  299. } else if (cmValue cpackDownloadAll =
  300. this->GetOption("CPACK_DOWNLOAD_ALL")) {
  301. this->OnlineOnly = cmIsOn(cpackDownloadAll);
  302. } else {
  303. this->OnlineOnly = false;
  304. }
  305. if (!this->Installer.RemoteRepositories.empty() && this->RepoGen.empty()) {
  306. cmCPackIFWLogger(ERROR,
  307. "Cannot find QtIFW repository generator \"repogen\": "
  308. "likely it is not installed, or not in your PATH"
  309. << std::endl);
  310. return 0;
  311. }
  312. // Executable suffix
  313. std::string exeSuffix(this->GetOption("CMAKE_EXECUTABLE_SUFFIX"));
  314. std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
  315. if (sysName == "Linux") {
  316. this->ExecutableSuffix = ".run";
  317. } else if (sysName == "Windows") {
  318. this->ExecutableSuffix = ".exe";
  319. } else if (sysName == "Darwin") {
  320. this->ExecutableSuffix = ".app";
  321. } else {
  322. this->ExecutableSuffix = exeSuffix;
  323. }
  324. // Output extension
  325. if (cmValue optOutExt =
  326. this->GetOption("CPACK_IFW_PACKAGE_FILE_EXTENSION")) {
  327. this->OutputExtension = *optOutExt;
  328. } else if (sysName == "Darwin") {
  329. this->OutputExtension = ".dmg";
  330. } else {
  331. this->OutputExtension = this->ExecutableSuffix;
  332. }
  333. if (this->OutputExtension.empty()) {
  334. this->OutputExtension = this->cmCPackGenerator::GetOutputExtension();
  335. }
  336. return this->Superclass::InitializeInternal();
  337. }
  338. std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
  339. const std::string& componentName)
  340. {
  341. const std::string prefix = "packages/";
  342. const std::string suffix = "/data";
  343. if (this->componentPackageMethod == this->ONE_PACKAGE) {
  344. return std::string(prefix + this->GetRootPackageName() + suffix);
  345. }
  346. return prefix +
  347. this->GetComponentPackageName(&this->Components[componentName]) + suffix;
  348. }
  349. cmCPackComponent* cmCPackIFWGenerator::GetComponent(
  350. const std::string& projectName, const std::string& componentName)
  351. {
  352. auto cit = this->Components.find(componentName);
  353. if (cit != this->Components.end()) {
  354. return &(cit->second);
  355. }
  356. cmCPackComponent* component =
  357. this->cmCPackGenerator::GetComponent(projectName, componentName);
  358. if (!component) {
  359. return component;
  360. }
  361. std::string name = this->GetComponentPackageName(component);
  362. auto pit = this->Packages.find(name);
  363. if (pit != this->Packages.end()) {
  364. return component;
  365. }
  366. cmCPackIFWPackage* package = &this->Packages[name];
  367. package->Name = name;
  368. package->Generator = this;
  369. if (package->ConfigureFromComponent(component)) {
  370. package->Installer = &this->Installer;
  371. this->Installer.Packages.insert(
  372. std::pair<std::string, cmCPackIFWPackage*>(name, package));
  373. this->ComponentPackages.insert(
  374. std::pair<cmCPackComponent*, cmCPackIFWPackage*>(component, package));
  375. if (component->IsDownloaded) {
  376. this->DownloadedPackages.insert(package);
  377. } else {
  378. this->BinaryPackages.insert(package);
  379. }
  380. } else {
  381. this->Packages.erase(name);
  382. cmCPackIFWLogger(ERROR,
  383. "Cannot configure package \""
  384. << name << "\" for component \"" << component->Name
  385. << "\"" << std::endl);
  386. }
  387. return component;
  388. }
  389. cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
  390. const std::string& projectName, const std::string& groupName)
  391. {
  392. cmCPackComponentGroup* group =
  393. this->cmCPackGenerator::GetComponentGroup(projectName, groupName);
  394. if (!group) {
  395. return group;
  396. }
  397. std::string name = this->GetGroupPackageName(group);
  398. auto pit = this->Packages.find(name);
  399. if (pit != this->Packages.end()) {
  400. return group;
  401. }
  402. cmCPackIFWPackage* package = &this->Packages[name];
  403. package->Name = name;
  404. package->Generator = this;
  405. if (package->ConfigureFromGroup(group)) {
  406. package->Installer = &this->Installer;
  407. this->Installer.Packages.insert(
  408. std::pair<std::string, cmCPackIFWPackage*>(name, package));
  409. this->GroupPackages.insert(
  410. std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(group, package));
  411. this->BinaryPackages.insert(package);
  412. } else {
  413. this->Packages.erase(name);
  414. cmCPackIFWLogger(ERROR,
  415. "Cannot configure package \""
  416. << name << "\" for component group \"" << group->Name
  417. << "\"" << std::endl);
  418. }
  419. return group;
  420. }
  421. enum cmCPackGenerator::CPackSetDestdirSupport
  422. cmCPackIFWGenerator::SupportsSetDestdir() const
  423. {
  424. return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED;
  425. }
  426. bool cmCPackIFWGenerator::SupportsAbsoluteDestination() const
  427. {
  428. return false;
  429. }
  430. bool cmCPackIFWGenerator::SupportsComponentInstallation() const
  431. {
  432. return true;
  433. }
  434. bool cmCPackIFWGenerator::IsOnePackage() const
  435. {
  436. return this->componentPackageMethod == cmCPackGenerator::ONE_PACKAGE;
  437. }
  438. std::string cmCPackIFWGenerator::GetRootPackageName()
  439. {
  440. // Default value
  441. std::string name = "root";
  442. if (cmValue optIFW_PACKAGE_GROUP =
  443. this->GetOption("CPACK_IFW_PACKAGE_GROUP")) {
  444. // Configure from root group
  445. cmCPackIFWPackage package;
  446. package.Generator = this;
  447. package.ConfigureFromGroup(optIFW_PACKAGE_GROUP);
  448. name = package.Name;
  449. } else if (cmValue optIFW_PACKAGE_NAME =
  450. this->GetOption("CPACK_IFW_PACKAGE_NAME")) {
  451. // Configure from root package name
  452. name = *optIFW_PACKAGE_NAME;
  453. } else if (cmValue optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) {
  454. // Configure from package name
  455. name = *optPACKAGE_NAME;
  456. }
  457. return name;
  458. }
  459. std::string cmCPackIFWGenerator::GetGroupPackageName(
  460. cmCPackComponentGroup* group) const
  461. {
  462. std::string name;
  463. if (!group) {
  464. return name;
  465. }
  466. if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) {
  467. return package->Name;
  468. }
  469. cmValue option =
  470. this->GetOption("CPACK_IFW_COMPONENT_GROUP_" +
  471. cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
  472. name = option ? *option : group->Name;
  473. if (group->ParentGroup) {
  474. cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup);
  475. bool dot = !this->ResolveDuplicateNames;
  476. if (dot && !cmHasPrefix(name, package->Name)) {
  477. name = package->Name + "." + name;
  478. }
  479. }
  480. return name;
  481. }
  482. std::string cmCPackIFWGenerator::GetComponentPackageName(
  483. cmCPackComponent* component) const
  484. {
  485. std::string name;
  486. if (!component) {
  487. return name;
  488. }
  489. if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) {
  490. return package->Name;
  491. }
  492. std::string prefix = "CPACK_IFW_COMPONENT_" +
  493. cmsys::SystemTools::UpperCase(component->Name) + "_";
  494. cmValue option = this->GetOption(prefix + "NAME");
  495. name = option ? *option : component->Name;
  496. if (component->Group) {
  497. cmCPackIFWPackage* package = this->GetGroupPackage(component->Group);
  498. if ((this->componentPackageMethod ==
  499. cmCPackGenerator::ONE_PACKAGE_PER_GROUP) ||
  500. this->IsOn(prefix + "COMMON")) {
  501. return package->Name;
  502. }
  503. bool dot = !this->ResolveDuplicateNames;
  504. if (dot && !cmHasPrefix(name, package->Name)) {
  505. name = package->Name + "." + name;
  506. }
  507. }
  508. return name;
  509. }
  510. cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
  511. cmCPackComponentGroup* group) const
  512. {
  513. auto pit = this->GroupPackages.find(group);
  514. return pit != this->GroupPackages.end() ? pit->second : nullptr;
  515. }
  516. cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
  517. cmCPackComponent* component) const
  518. {
  519. auto pit = this->ComponentPackages.find(component);
  520. return pit != this->ComponentPackages.end() ? pit->second : nullptr;
  521. }
  522. cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
  523. const std::string& repositoryName)
  524. {
  525. auto rit = this->Repositories.find(repositoryName);
  526. if (rit != this->Repositories.end()) {
  527. return &(rit->second);
  528. }
  529. cmCPackIFWRepository* repository = &this->Repositories[repositoryName];
  530. repository->Name = repositoryName;
  531. repository->Generator = this;
  532. if (repository->ConfigureFromOptions()) {
  533. if (repository->Update == cmCPackIFWRepository::None) {
  534. this->Installer.RemoteRepositories.push_back(repository);
  535. } else {
  536. this->Repository.RepositoryUpdate.push_back(repository);
  537. }
  538. } else {
  539. this->Repositories.erase(repositoryName);
  540. repository = nullptr;
  541. cmCPackIFWLogger(WARNING,
  542. "Invalid repository \""
  543. << repositoryName << "\""
  544. << " configuration. Repository will be skipped."
  545. << std::endl);
  546. }
  547. return repository;
  548. }