Skip to content

Commit

Permalink
Merge topic 'cpack-ifw-validate-input' into release-3.23
Browse files Browse the repository at this point in the history
e41f1ef CPack/IFW: Add missing referenced source file validation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
Merge-request: !7116
  • Loading branch information
bradking authored and kwrobot committed Mar 28, 2022
2 parents 0ab1bbb + e41f1ef commit 7f1573e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Source/CPack/IFW/cmCPackIFWInstaller.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void cmCPackIFWInstaller::printSkippedOptionWarning(
cmCPackIFWLogger(
WARNING,
"Option "
<< optionName << " is set to \"" << optionValue
<< optionName << " contains the value \"" << optionValue
<< "\" but will be skipped because the specified file does not exist."
<< std::endl);
}
Expand Down Expand Up @@ -276,21 +276,41 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// Control script
if (cmValue optIFW_CONTROL_SCRIPT =
this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) {
this->ControlScript = *optIFW_CONTROL_SCRIPT;
if (!cmSystemTools::FileExists(optIFW_CONTROL_SCRIPT)) {
this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_CONTROL_SCRIPT",
optIFW_CONTROL_SCRIPT);
} else {
this->ControlScript = *optIFW_CONTROL_SCRIPT;
}
}

// Resources
if (cmValue optIFW_PACKAGE_RESOURCES =
this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
this->Resources.clear();
cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
for (const auto& file : this->Resources) {
if (!cmSystemTools::FileExists(file)) {
// The warning will say skipped, but there will later be a hard error
// when the binarycreator tool tries to read the missing file.
this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_RESOURCES", file);
}
}
}

// ProductImages
if (cmValue productImages =
this->GetOption("CPACK_IFW_PACKAGE_PRODUCT_IMAGES")) {
this->ProductImages.clear();
cmExpandList(productImages, this->ProductImages);
for (const auto& file : this->ProductImages) {
if (!cmSystemTools::FileExists(file)) {
// The warning will say skipped, but there will later be a hard error
// when the binarycreator tool tries to read the missing file.
this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_PRODUCT_IMAGES",
file);
}
}
}

// Run program, run program arguments, and run program description
Expand Down

0 comments on commit 7f1573e

Please sign in to comment.