diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 119 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.h | 25 | ||||
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 38 | ||||
-rw-r--r-- | Source/CTest/cmCTestCurl.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 29 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 118 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 3 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 17 |
9 files changed, 303 insertions, 50 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d1054cf..8e6ca1a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 7) -set(CMake_VERSION_PATCH 20170117) +set(CMake_VERSION_PATCH 20170124) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 9ca7750..d8bafee 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -60,6 +60,16 @@ bool cmCPackIFWInstaller::IsVersionEqual(const char* version) return Generator ? Generator->IsVersionEqual(version) : false; } +void cmCPackIFWInstaller::printSkippedOptionWarning( + const std::string& optionName, const std::string& optionValue) +{ + cmCPackLogger( + cmCPackLog::LOG_WARNING, "Option " + << optionName << " is set to \"" << optionValue + << "\" but will be skipped because the specified file does not exist." + << std::endl); +} + void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; @@ -110,7 +120,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() if (cmSystemTools::FileExists(option)) { InstallerApplicationIcon = option; } else { - // TODO: implement warning + printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); } } @@ -119,7 +129,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() if (cmSystemTools::FileExists(option)) { InstallerWindowIcon = option; } else { - // TODO: implement warning + printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); } } @@ -128,10 +138,69 @@ void cmCPackIFWInstaller::ConfigureFromOptions() if (cmSystemTools::FileExists(option)) { Logo = option; } else { - // TODO: implement warning + printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); + } + } + + // Watermark + if (const char* option = GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { + if (cmSystemTools::FileExists(option)) { + Watermark = option; + } else { + printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); } } + // Banner + if (const char* option = GetOption("CPACK_IFW_PACKAGE_BANNER")) { + if (cmSystemTools::FileExists(option)) { + Banner = option; + } else { + printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); + } + } + + // Background + if (const char* option = GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { + if (cmSystemTools::FileExists(option)) { + Background = option; + } else { + printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); + } + } + + // WizardStyle + if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { + if (WizardStyle.compare("Modern") == 0 && + WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 && + WizardStyle.compare("Classic") == 0) { + cmCPackLogger( + cmCPackLog::LOG_WARNING, + "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"" + << option << "\". Expected values are: Modern, Aero, Mac, Classic." + << std::endl); + } + + WizardStyle = option; + } + + // WizardDefaultWidth + if (const char* option = + GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) { + WizardDefaultWidth = option; + } + + // WizardDefaultHeight + if (const char* option = + GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) { + WizardDefaultHeight = option; + } + + // TitleColor + if (const char* option = GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { + TitleColor = option; + } + // Start menu if (const char* optIFW_START_MENU_DIR = this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) { @@ -313,6 +382,50 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("Logo", name); } + // Banner + if (!Banner.empty()) { + std::string name = cmSystemTools::GetFilenameName(Banner); + std::string path = Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data()); + xout.Element("Banner", name); + } + + // Watermark + if (!Watermark.empty()) { + std::string name = cmSystemTools::GetFilenameName(Watermark); + std::string path = Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data()); + xout.Element("Watermark", name); + } + + // Background + if (!Background.empty()) { + std::string name = cmSystemTools::GetFilenameName(Background); + std::string path = Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data()); + xout.Element("Background", name); + } + + // WizardStyle + if (!WizardStyle.empty()) { + xout.Element("WizardStyle", WizardStyle); + } + + // WizardDefaultWidth + if (!WizardDefaultWidth.empty()) { + xout.Element("WizardDefaultWidth", WizardDefaultWidth); + } + + // WizardDefaultHeight + if (!WizardDefaultHeight.empty()) { + xout.Element("WizardDefaultHeight", WizardDefaultHeight); + } + + // TitleColor + if (!TitleColor.empty()) { + xout.Element("TitleColor", TitleColor); + } + // Start menu if (!IsVersionLess("2.0")) { xout.Element("StartMenuDir", StartMenuDir); diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index eba9bec..4ec3e70 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -60,6 +60,27 @@ public: /// Filename for a logo std::string Logo; + /// Filename for a watermark + std::string Watermark; + + /// Filename for a banner + std::string Banner; + + /// Filename for a background + std::string Background; + + /// Wizard style name + std::string WizardStyle; + + /// Wizard width + std::string WizardDefaultWidth; + + /// Wizard height + std::string WizardDefaultHeight; + + /// Title color + std::string TitleColor; + /// Name of the default program group in the Windows Start menu std::string StartMenuDir; @@ -110,6 +131,10 @@ public: protected: void WriteGeneratedByToStrim(cmXMLWriter& xout); + +private: + void printSkippedOptionWarning(const std::string& optionName, + const std::string& optionValue); }; #endif // cmCPackIFWInstaller_h diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 9a90f54..ab1412d 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -19,6 +19,7 @@ cmCTestCurl::cmCTestCurl(cmCTest* ctest) // default is to verify https this->VerifyPeerOff = false; this->VerifyHostOff = false; + this->Quiet = false; this->TimeOutSeconds = 0; this->Curl = curl_easy_init(); } @@ -96,6 +97,13 @@ bool cmCTestCurl::InitCurl() } // enable HTTP ERROR parsing curl_easy_setopt(this->Curl, CURLOPT_FAILONERROR, 1); + + // if there is little to no activity for too long stop submitting + if (this->TimeOutSeconds) { + curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_LIMIT, 1); + curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_TIME, this->TimeOutSeconds); + } + return true; } @@ -110,12 +118,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, } /* enable uploading */ curl_easy_setopt(this->Curl, CURLOPT_UPLOAD, 1); - // if there is little to no activity for too long stop submitting - if (this->TimeOutSeconds) { - ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_LIMIT, 1); - ::curl_easy_setopt(this->Curl, CURLOPT_LOW_SPEED_TIME, - this->TimeOutSeconds); - } + /* HTTP PUT please */ ::curl_easy_setopt(this->Curl, CURLOPT_PUT, 1); ::curl_easy_setopt(this->Curl, CURLOPT_VERBOSE, 1); @@ -157,13 +160,14 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: [" - << response << "]\n"); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Curl response: [" << response << "]\n", this->Quiet); } std::string curlDebug; if (!debugData.empty()) { curlDebug = std::string(debugData.begin(), debugData.end()); - cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); + cmCTestOptionalLog(this->CTest, DEBUG, + "Curl debug: [" << curlDebug << "]\n", this->Quiet); } if (response.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" @@ -177,9 +181,10 @@ bool cmCTestCurl::HttpRequest(std::string const& url, std::string const& fields, std::string& response) { response = ""; - cmCTestLog(this->CTest, DEBUG, "HttpRequest\n" - << "url: " << url << "\n" - << "fields " << fields << "\n"); + cmCTestOptionalLog(this->CTest, DEBUG, "HttpRequest\n" + << "url: " << url << "\n" + << "fields " << fields << "\n", + this->Quiet); if (!this->InitCurl()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed"); return false; @@ -202,13 +207,16 @@ bool cmCTestCurl::HttpRequest(std::string const& url, if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); - cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n"); + cmCTestOptionalLog(this->CTest, DEBUG, + "Curl response: [" << response << "]\n", this->Quiet); } if (!debugData.empty()) { std::string curlDebug = std::string(debugData.begin(), debugData.end()); - cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); + cmCTestOptionalLog(this->CTest, DEBUG, + "Curl debug: [" << curlDebug << "]\n", this->Quiet); } - cmCTestLog(this->CTest, DEBUG, "Curl res: " << res << "\n"); + cmCTestOptionalLog(this->CTest, DEBUG, "Curl res: " << res << "\n", + this->Quiet); return (res == 0); } diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h index 17fbcff..cdce393 100644 --- a/Source/CTest/cmCTestCurl.h +++ b/Source/CTest/cmCTestCurl.h @@ -25,6 +25,7 @@ public: void SetCurlOptions(std::vector<std::string> const& args); void SetUseHttp10On() { this->UseHttp10 = true; } void SetTimeOutSeconds(int s) { this->TimeOutSeconds = s; } + void SetQuiet(bool b) { this->Quiet = b; } std::string Escape(std::string const& source); protected: @@ -40,6 +41,7 @@ private: bool VerifyHostOff; bool VerifyPeerOff; bool UseHttp10; + bool Quiet; int TimeOutSeconds; }; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 14b875f..5cf4ddc 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -157,6 +157,7 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args, bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) { if (this->CDashUpload) { + // Arguments specific to the CDASH_UPLOAD signature. if (arg == "CDASH_UPLOAD") { this->ArgumentDoing = ArgumentDoingCDashUpload; return true; @@ -167,7 +168,7 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) return true; } } else { - // Look for arguments specific to this command. + // Arguments that cannot be used with CDASH_UPLOAD. if (arg == "PARTS") { this->ArgumentDoing = ArgumentDoingParts; this->PartsMentioned = true; @@ -179,21 +180,21 @@ bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg) this->FilesMentioned = true; return true; } + } + // Arguments used by both modes. + if (arg == "RETRY_COUNT") { + this->ArgumentDoing = ArgumentDoingRetryCount; + return true; + } - if (arg == "RETRY_COUNT") { - this->ArgumentDoing = ArgumentDoingRetryCount; - return true; - } - - if (arg == "RETRY_DELAY") { - this->ArgumentDoing = ArgumentDoingRetryDelay; - return true; - } + if (arg == "RETRY_DELAY") { + this->ArgumentDoing = ArgumentDoingRetryDelay; + return true; + } - if (arg == "INTERNAL_TEST_CHECKSUM") { - this->InternalTest = true; - return true; - } + if (arg == "INTERNAL_TEST_CHECKSUM") { + this->InternalTest = true; + return true; } // Look for other arguments. diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 79c3663..5e5119d 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -1007,6 +1007,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, return -1; } cmCTestCurl curl(this->CTest); + curl.SetQuiet(this->Quiet); std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector<std::string> args; cmSystemTools::ExpandListArgument(curlopt, args); @@ -1022,6 +1023,30 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, "Only http and https are supported for CDASH_UPLOAD\n"); return -1; } + bool internalTest = cmSystemTools::IsOn(this->GetOption("InternalTest")); + + // Get RETRY_COUNT and RETRY_DELAY values if they were set. + std::string retryDelayString = this->GetOption("RetryDelay") == CM_NULLPTR + ? "" + : this->GetOption("RetryDelay"); + std::string retryCountString = this->GetOption("RetryCount") == CM_NULLPTR + ? "" + : this->GetOption("RetryCount"); + unsigned long retryDelay = 0; + if (retryDelayString != "") { + if (!cmSystemTools::StringToULong(retryDelayString.c_str(), &retryDelay)) { + cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " + << retryDelayString << std::endl); + } + } + unsigned long retryCount = 0; + if (retryCountString != "") { + if (!cmSystemTools::StringToULong(retryCountString.c_str(), &retryCount)) { + cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " + << retryCountString << std::endl); + } + } + char md5sum[33]; md5sum[32] = 0; cmSystemTools::ComputeFileMD5(file, md5sum); @@ -1058,7 +1083,33 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << "\nfile: " << file << "\n", this->Quiet); std::string response; - if (!curl.HttpRequest(url, fields, response)) { + + bool requestSucceeded = curl.HttpRequest(url, fields, response); + if (!internalTest && !requestSucceeded) { + // If request failed, wait and retry. + for (unsigned long i = 0; i < retryCount; i++) { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Request failed, waiting " << retryDelay + << " seconds...\n", + this->Quiet); + + double stop = cmSystemTools::GetTime() + static_cast<double>(retryDelay); + while (cmSystemTools::GetTime() < stop) { + cmSystemTools::Delay(100); + } + + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Retry request: Attempt " + << (i + 1) << " of " << retryCount << std::endl, + this->Quiet); + + requestSucceeded = curl.HttpRequest(url, fields, response); + if (requestSucceeded) { + break; + } + } + } + if (!internalTest && !requestSucceeded) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in HttpRequest\n" << response); return -1; @@ -1068,30 +1119,32 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, this->Quiet); Json::Value json; Json::Reader reader; - if (!reader.parse(response, json)) { + if (!internalTest && !reader.parse(response, json)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "error parsing json string [" << response << "]\n" << reader.getFormattedErrorMessages() << "\n"); return -1; } - if (json["status"].asInt() != 0) { + if (!internalTest && json["status"].asInt() != 0) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Bad status returned from CDash: " << json["status"].asInt()); return -1; } - if (json["datafilesmd5"].isArray()) { - int datares = json["datafilesmd5"][0].asInt(); - if (datares == 1) { - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "File already exists on CDash, skip upload " << file - << "\n", - this->Quiet); - return 0; + if (!internalTest) { + if (json["datafilesmd5"].isArray()) { + int datares = json["datafilesmd5"][0].asInt(); + if (datares == 1) { + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File already exists on CDash, skip upload " + << file << "\n", + this->Quiet); + return 0; + } + } else { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "bad datafilesmd5 value in response " << response << "\n"); + return -1; } - } else { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "bad datafilesmd5 value in response " << response << "\n"); - return -1; } std::string upload_as = cmSystemTools::GetFilenameName(file); @@ -1100,7 +1153,40 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, << "md5=" << md5sum << "&" << "filename=" << curl.Escape(upload_as) << "&" << "buildid=" << json["buildid"].asString(); - if (!curl.UploadFile(file, url, fstr.str(), response)) { + + bool uploadSucceeded = false; + if (!internalTest) { + uploadSucceeded = curl.UploadFile(file, url, fstr.str(), response); + } + + if (!uploadSucceeded) { + // If upload failed, wait and retry. + for (unsigned long i = 0; i < retryCount; i++) { + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Upload failed, waiting " << retryDelay + << " seconds...\n", + this->Quiet); + + double stop = cmSystemTools::GetTime() + static_cast<double>(retryDelay); + while (cmSystemTools::GetTime() < stop) { + cmSystemTools::Delay(100); + } + + cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, + " Retry upload: Attempt " + << (i + 1) << " of " << retryCount << std::endl, + this->Quiet); + + if (!internalTest) { + uploadSucceeded = curl.UploadFile(file, url, fstr.str(), response); + } + if (uploadSucceeded) { + break; + } + } + } + + if (!uploadSucceeded) { cmCTestLog(this->CTest, ERROR_MESSAGE, "error uploading to CDash. " << file << " " << url << " " << fstr.str()); return -1; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a635bf4..9efc13b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2015,7 +2015,8 @@ void cmSystemTools::FindCMakeResources(const char* argv0) // Install tree has // - "<prefix><CMAKE_BIN_DIR>/cmake" // - "<prefix><CMAKE_DATA_DIR>" - if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) { + const std::string actual_case = cmSystemTools::GetActualCaseForPath(exe_dir); + if (cmHasSuffix(actual_case, CMAKE_BIN_DIR)) { std::string const prefix = exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR)); cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9261ca8..d825e5c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -852,6 +852,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Makefile->GetBacktrace())) { return; } + if (prop == "MANUALLY_ADDED_DEPENDENCIES") { + std::ostringstream e; + e << "MANUALLY_ADDED_DEPENDENCIES property is read-only\n"; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); + return; + } if (prop == "NAME") { std::ostringstream e; e << "NAME property is read-only\n"; @@ -1168,6 +1174,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const MAKE_STATIC_PROP(COMPILE_OPTIONS); MAKE_STATIC_PROP(COMPILE_DEFINITIONS); MAKE_STATIC_PROP(IMPORTED); + MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES); MAKE_STATIC_PROP(NAME); MAKE_STATIC_PROP(BINARY_DIR); MAKE_STATIC_PROP(SOURCE_DIR); @@ -1181,6 +1188,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const specialProps.insert(propCOMPILE_OPTIONS); specialProps.insert(propCOMPILE_DEFINITIONS); specialProps.insert(propIMPORTED); + specialProps.insert(propMANUALLY_ADDED_DEPENDENCIES); specialProps.insert(propNAME); specialProps.insert(propBINARY_DIR); specialProps.insert(propSOURCE_DIR); @@ -1236,6 +1244,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const output = cmJoin(this->Internal->CompileDefinitionsEntries, ";"); return output.c_str(); } + if (prop == propMANUALLY_ADDED_DEPENDENCIES) { + if (this->Utilities.empty()) { + return CM_NULLPTR; + } + + static std::string output; + output = cmJoin(this->Utilities, ";"); + return output.c_str(); + } if (prop == propIMPORTED) { return this->IsImported() ? "TRUE" : "FALSE"; } |