From fa3c1817b13362ef10e332e384553df33fb21d97 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Wed, 19 May 2010 11:20:30 -0400 Subject: Cost-based test scheduling should only be done in parallel mode. --- Source/CTest/cmCTestMultiProcessHandler.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index c1ca9ea273..8a69780084 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -453,15 +453,24 @@ void cmCTestMultiProcessHandler::CreateTestCostList() for(TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { - std::string name = this->Properties[i->first]->Name; - if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), - name) != this->LastTestsFailed.end()) + //We only want to schedule them by cost in a parallel situation + if(this->ParallelLevel > 1) { - this->TestCosts[FLT_MAX].insert(i->first); + std::string name = this->Properties[i->first]->Name; + if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), + name) != this->LastTestsFailed.end()) + { + this->TestCosts[FLT_MAX].insert(i->first); + } + else + { + this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); + } } - else + else //we ignore their cost { - this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); + this->TestCosts[this->Tests.size() + - this->Properties[i->first]->Index].insert(i->first); } } } -- cgit v1.2.1 From 45d7200a73edc947b6e3672bc7cff65143b82179 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 19 May 2010 15:40:48 -0600 Subject: Fix for fix to bug #9975 --- Source/QtDialog/CMakeSetup.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index fc61709743..28f4697d0f 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -164,7 +164,7 @@ int main(int argc, char** argv) QStringList args = app.arguments(); if(args.count() == 2) { - cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(".."); + cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toAscii().data()); cmsys_stl::string buildFilePath = cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str()); cmsys_stl::string srcFilePath = -- cgit v1.2.1 From 1d4e121d9cdb0b250c49a9d0d8d5f726ed7c69d4 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 25 May 2010 09:23:25 -0400 Subject: Add php coverage to ctest. --- Source/CMakeLists.txt | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 34 +++-- Source/CTest/cmCTestCoverageHandler.h | 60 ++------ Source/CTest/cmParsePHPCoverage.cxx | 252 ++++++++++++++++++++++++++++++++ Source/CTest/cmParsePHPCoverage.h | 48 ++++++ 5 files changed, 334 insertions(+), 62 deletions(-) create mode 100644 Source/CTest/cmParsePHPCoverage.cxx create mode 100644 Source/CTest/cmParsePHPCoverage.h (limited to 'Source') diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 49cbda74f2..dc73cecd2d 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -366,6 +366,7 @@ SET(CTEST_SRCS cmCTest.cxx CTest/cmCTestConfigureHandler.cxx CTest/cmCTestCoverageCommand.cxx CTest/cmCTestCoverageHandler.cxx + CTest/cmParsePHPCoverage.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestGenericHandler.cxx CTest/cmCTestHandlerCommand.cxx @@ -502,4 +503,3 @@ IF(APPLE) ENDIF(APPLE) INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h) - diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index da5aed0e7a..3235bfdce8 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmCTestCoverageHandler.h" +#include "cmParsePHPCoverage.h" #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" @@ -125,20 +126,6 @@ private: }; -//---------------------------------------------------------------------- -//********************************************************************** -class cmCTestCoverageHandlerContainer -{ -public: - int Error; - std::string SourceDir; - std::string BinaryDir; - typedef std::vector SingleFileCoverageVector; - typedef std::map TotalCoverageMap; - TotalCoverageMap TotalCoverage; - std::ostream* OFS; -}; -//********************************************************************** //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -391,6 +378,11 @@ int cmCTestCoverageHandler::ProcessHandler() return error; } file_count += this->HandleTracePyCoverage(&cont); + if ( file_count < 0 ) + { + return error; + } + file_count += this->HandlePHPCoverage(&cont); if ( file_count < 0 ) { return error; @@ -524,7 +516,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmOStringStream ostr; ostr << "Problem reading source file: " << fullFileName.c_str() - << " line:" << cc; + << " line:" << cc << " out total: " << fcov.size()-1; errorsWhileAccumulating.push_back(ostr.str()); error ++; break; @@ -747,6 +739,18 @@ bool IsFileInDir(const std::string &infile, const std::string &indir) return false; } +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandlePHPCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + cmParsePHPCoverage cov(*cont, this->CTest); + std::string coverageDir = this->CTest->GetBinaryDir() + "/xdebugCoverage"; + if(cmSystemTools::FileIsDirectory(coverageDir.c_str())) + { + cov.ReadPHPCoverageDirectory(coverageDir.c_str()); + } + return static_cast(cont->TotalCoverage.size()); +} //---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer* cont) diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index f0564e81e4..d3e8503e13 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -20,8 +20,17 @@ #include class cmGeneratedFileStream; -class cmCTestCoverageHandlerContainer; - +class cmCTestCoverageHandlerContainer +{ +public: + int Error; + std::string SourceDir; + std::string BinaryDir; + typedef std::vector SingleFileCoverageVector; + typedef std::map TotalCoverageMap; + TotalCoverageMap TotalCoverage; + std::ostream* OFS; +}; /** \class cmCTestCoverageHandler * \brief A class that handles coverage computaiton for ctest * @@ -59,6 +68,9 @@ private: int HandleGCovCoverage(cmCTestCoverageHandlerContainer* cont); void FindGCovFiles(std::vector& files); + //! Handle coverage using xdebug php coverage + int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage using Bullseye int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); @@ -94,54 +106,10 @@ private: std::set FindUncoveredFiles( cmCTestCoverageHandlerContainer* cont); - - struct cmCTestCoverage - { - cmCTestCoverage() - { - this->AbsolutePath = ""; - this->FullPath = ""; - this->Covered = false; - this->Tested = 0; - this->UnTested = 0; - this->Lines.clear(); - this->Show = false; - } - cmCTestCoverage(const cmCTestCoverage& rhs) : - AbsolutePath(rhs.AbsolutePath), - FullPath(rhs.FullPath), - Covered(rhs.Covered), - Tested(rhs.Tested), - UnTested(rhs.UnTested), - Lines(rhs.Lines), - Show(rhs.Show) - { - } - cmCTestCoverage& operator=(const cmCTestCoverage& rhs) - { - this->AbsolutePath = rhs.AbsolutePath; - this->FullPath = rhs.FullPath; - this->Covered = rhs.Covered; - this->Tested = rhs.Tested; - this->UnTested = rhs.UnTested; - this->Lines = rhs.Lines; - this->Show = rhs.Show; - return *this; - } - std::string AbsolutePath; - std::string FullPath; - bool Covered; - int Tested; - int UnTested; - std::vector Lines; - bool Show; - }; - std::vector CustomCoverageExclude; std::vector CustomCoverageExcludeRegex; std::vector ExtraCoverageGlobs; - typedef std::map CoverageMap; // Map from source file to label ids. class LabelSet: public std::set {}; diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx new file mode 100644 index 0000000000..32c1ec1103 --- /dev/null +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -0,0 +1,252 @@ +#include "cmStandardIncludes.h" +#include "cmSystemTools.h" +#include "cmParsePHPCoverage.h" +#include + +/* + To setup coverage for php. + + - edit php.ini to add auto prepend and append php files from phpunit + auto_prepend_file = + auto_append_file = + - run the tests + - run this program on all the files in c:/tmp + +*/ + +cmParsePHPCoverage::cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest) + :Coverage(cont), CTest(ctest) +{ +} + +bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until) +{ + char c = 0; + while(in.get(c) && c != until) + { + } + if(c != until) + { + return false; + } + return true; +} +bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in, + cmStdString const& fileName) +{ + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector + = this->Coverage.TotalCoverage[fileName]; + + char c; + char buf[4]; + in.read(buf, 3); + buf[3] = 0; + if(strcmp(buf, ";a:") != 0) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read start of coverage array, found : " + << buf << "\n"); + return false; + } + int size = 0; + if(!this->ReadInt(in, size)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read size "); + return false; + } + if(!in.get(c) && c == '{') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read open {\n"); + return false; + } + for(int i =0; i < size; i++) + { + this->ReadUntil(in, ':'); + int line = 0; + this->ReadInt(in, line); + // ok xdebug may have a bug here + // it seems to be 1 based but often times + // seems to have a 0'th line. + line--; + if(line < 0) + { + line = 0; + } + this->ReadUntil(in, ':'); + int value = 0; + this->ReadInt(in, value); + // make sure the vector is the right size and is + // initialized with -1 for each line + while(coverageVector.size() <= static_cast(line) ) + { + coverageVector.push_back(-1); + } + // if value is less than 0, set it to zero + // TODO figure out the difference between + // -1 and -2 in xdebug coverage?? For now + // assume less than 0 is just not covered + // CDash expects -1 for non executable code (like comments) + // and 0 for uncovered code, and a positive value + // for number of times a line was executed + if(value < 0) + { + value = 0; + } + // if unset then set it to value + if(coverageVector[line] == -1) + { + coverageVector[line] = value; + } + // otherwise increment by value + else + { + coverageVector[line] += value; + } + } + return true; +} + +bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v) +{ + std::string s; + char c = 0; + while(in.get(c) && c != ':' && c != ';') + { + s += c; + } + v = atoi(s.c_str()); + return true; +} + +bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size) +{ + char c = 0; + in.get(c); + if(c != 'a') + { + return false; + } + if(in.get(c) && c == ':') + { + if(this->ReadInt(in, size)) + { + return true; + } + } + return false; +} + +bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in) +{ + char buf[4]; + in.read(buf, 2); + buf[2] = 0; + if(strcmp(buf, "s:") != 0) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read start of file info found: [" << buf << "]\n"); + return false; + } + char c; + int size = 0; + if(this->ReadInt(in, size)) + { + size++; // add one for null termination + char* s = new char[size+1]; + // read open quote + if(in.get(c) && c != '"') + { + return false; + } + // read the string data + in.read(s, size-1); + s[size-1] = 0; + cmStdString fileName = s; + delete [] s; + // read close quote + if(in.get(c) && c != '"') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read close quote\n" + << "read [" << c << "]\n"); + return false; + } + if(!this->ReadCoverageArray(in, fileName) ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read coverage array for file: " + << fileName << "\n"); + return false; + } + return true; + } + return false; +} + + +bool cmParsePHPCoverage::ReadPHPData(const char* file) +{ + std::ifstream in(file); + if(!in) + { + return false; + } + int size = 0; + this->ReadArraySize(in, size); + char c = 0; + in.get(c); + if(c != '{') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read open array\n"); + return false; + } + for(int i =0; i < size; i++) + { + if(!this->ReadFileInformation(in)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Failed to read file #" << i << "\n"); + return false; + } + in.get(c); + if(c != '}') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read close array\n"); + return false; + } + } + return true; +} + +bool cmParsePHPCoverage::ReadPHPCoverageDirectory(const char* d) +{ + cmsys::Directory dir; + if(!dir.Load(d)) + { + return false; + } + size_t numf; + unsigned int i; + numf = dir.GetNumberOfFiles(); + for (i = 0; i < numf; i++) + { + std::string file = dir.GetFile(i); + if(file != "." && file != ".." + && !cmSystemTools::FileIsDirectory(file.c_str())) + { + std::string path = d; + path += "/"; + path += file; + if(!this->ReadPHPData(path.c_str())) + { + return false; + } + } + } + return true; +} diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h new file mode 100644 index 0000000000..ce5741d0b0 --- /dev/null +++ b/Source/CTest/cmParsePHPCoverage.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmParsePHPCoverage_h +#define cmParsePHPCoverage_h + +#include "cmStandardIncludes.h" +#include "cmCTestCoverageHandler.h" + +/** \class cmParsePHPCoverage + * \brief Parse xdebug PHP coverage information + * + * This class is used to parse php coverage information produced + * by xdebug. The data is stored as a php dump of the array + * return by xdebug coverage. It is an array of arrays. + */ +class cmParsePHPCoverage +{ +public: + cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + bool ReadPHPCoverageDirectory(const char* dir); + void PrintCoverage(); +private: + bool ReadPHPData(const char* file); + bool ReadArraySize(std::ifstream& in, int& size); + bool ReadFileInformation(std::ifstream& in); + bool ReadInt(std::ifstream& in, int& v); + bool ReadCoverageArray(std::ifstream& in, cmStdString const&); + bool ReadUntil(std::ifstream& in, char until); + typedef std::map FileLineCoverage; + std::map FileToCoverage; + std::map FileCoverage; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; + + +#endif -- cgit v1.2.1 From f67139ae6fdf964218a93e5506722a367e781c6f Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 27 May 2010 12:21:56 -0400 Subject: Improve FILE(DOWNLOAD) and ExternalProject. Improve FILE(DOWNLOAD ...): - Add percent complete progress output to the FILE DOWNLOAD command. This progress output is off by default to preserve existing behavior. To turn it on, pass SHOW_PROGRESS as an argument. - Add EXPECTED_MD5 argument. Verify that the downloaded file has the expected md5 sum after download is complete. - Add documentation for SHOW_PROGRESS and EXPECTED_MD5. When the destination file exists already and has the expected md5 sum, then do not bother re-downloading the file. ("Short circuit" return.) Also, add a test that checks for the status output indicating that the short circuit behavior is actually occurring. Use a binary file for the test so that the md5 sum is guaranteed to be the same on all platforms regardless of "shifting text file line ending" issues. Improve ExternalProject: - Add argument URL_MD5. - Add verify step that compares md5 sum of .tar.gz file before extracting it. - Add md5 check to download step, too, to prevent unnecessary downloads. - Emit a warning message when a file is not verified. Indicate that the file may be corrupt or that no checksum was specified. --- Source/cmFileCommand.cxx | 247 ++++++++++++++++++++++++++++++++++++++++++++--- Source/cmFileCommand.h | 10 +- 2 files changed, 239 insertions(+), 18 deletions(-) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 561152714a..539ed0fc9c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2443,7 +2443,8 @@ namespace{ fout->write(chPtr, realsize); return realsize; } - + + static size_t cmFileCommandCurlDebugCallback(CURL *, curl_infotype, char *chPtr, size_t size, void *data) @@ -2456,6 +2457,69 @@ namespace{ } + class cURLProgressHelper + { + public: + cURLProgressHelper(cmFileCommand *fc) + { + this->CurrentPercentage = -1; + this->FileCommand = fc; + } + + bool UpdatePercentage(double value, double total, std::string &status) + { + int OldPercentage = this->CurrentPercentage; + + if (0.0 == total) + { + this->CurrentPercentage = 100; + } + else + { + this->CurrentPercentage = static_cast(value/total*100.0 + 0.5); + } + + bool updated = (OldPercentage != this->CurrentPercentage); + + if (updated) + { + cmOStringStream oss; + oss << "[download " << this->CurrentPercentage << "% complete]"; + status = oss.str(); + } + + return updated; + } + + cmFileCommand *GetFileCommand() + { + return this->FileCommand; + } + + private: + int CurrentPercentage; + cmFileCommand *FileCommand; + }; + + + static int + cmFileCommandCurlProgressCallback(void *clientp, + double dltotal, double dlnow, + double ultotal, double ulnow) + { + cURLProgressHelper *helper = + reinterpret_cast(clientp); + + std::string status; + if (helper->UpdatePercentage(dlnow, dltotal, status)) + { + cmFileCommand *fc = helper->GetFileCommand(); + cmMakefile *mf = fc->GetMakefile(); + mf->DisplayStatus(status.c_str(), -1); + } + + return 0; + } } #endif @@ -2469,8 +2533,8 @@ namespace { cURLEasyGuard(CURL * easy) : Easy(easy) {} - - ~cURLEasyGuard(void) + + ~cURLEasyGuard(void) { if (this->Easy) { @@ -2491,6 +2555,7 @@ namespace { } #endif + bool cmFileCommand::HandleDownloadCommand(std::vector const& args) @@ -2508,9 +2573,13 @@ cmFileCommand::HandleDownloadCommand(std::vector ++i; std::string file = *i; ++i; + long timeout = 0; std::string verboseLog; std::string statusVar; + std::string expectedMD5sum; + bool showProgress = false; + while(i != args.end()) { if(*i == "TIMEOUT") @@ -2549,9 +2618,65 @@ cmFileCommand::HandleDownloadCommand(std::vector } statusVar = *i; } + else if(*i == "EXPECTED_MD5") + { + ++i; + if( i == args.end()) + { + this->SetError("FILE(DOWNLOAD url file EXPECTED_MD5 sum) missing " + "sum value for EXPECTED_MD5."); + return false; + } + expectedMD5sum = cmSystemTools::LowerCase(*i); + } + else if(*i == "SHOW_PROGRESS") + { + showProgress = true; + } ++i; } + // If file exists already, and caller specified an expected md5 sum, + // and the existing file already has the expected md5 sum, then simply + // return. + // + if(cmSystemTools::FileExists(file.c_str()) && + !expectedMD5sum.empty()) + { + char computedMD5[32]; + + if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + { + this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " + "pre-existing file"); + return false; + } + + std::string actualMD5sum = cmSystemTools::LowerCase( + std::string(computedMD5, 32)); + + if (expectedMD5sum == actualMD5sum) + { + this->Makefile->DisplayStatus( + "FILE(DOWNLOAD ) returning early: file already exists with " + "expected MD5 sum", -1); + + if(statusVar.size()) + { + cmOStringStream result; + result << (int)0 << ";\"" + "returning early: file already exists with expected MD5 sum\""; + this->Makefile->AddDefinition(statusVar.c_str(), + result.str().c_str()); + } + + return true; + } + } + + // Make sure parent directory exists so we can write to the file + // as we receive downloaded bits from curl... + // std::string dir = cmSystemTools::GetFilenamePath(file.c_str()); if(!cmSystemTools::FileExists(dir.c_str()) && !cmSystemTools::MakeDirectory(dir.c_str())) @@ -2570,6 +2695,7 @@ cmFileCommand::HandleDownloadCommand(std::vector "file for write."); return false; } + ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); curl = ::curl_easy_init(); @@ -2585,28 +2711,31 @@ cmFileCommand::HandleDownloadCommand(std::vector ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: "; - errstring += ::curl_easy_strerror(res); + std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, - cmFileCommandWriteMemoryCallback); + cmFileCommandWriteMemoryCallback); if (res != CURLE_OK) - { - std::string errstring = - "FILE(DOWNLOAD ) error; cannot set write function: "; - errstring += ::curl_easy_strerror(res); + { + std::string errstring = + "FILE(DOWNLOAD ) error; cannot set write function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, - cmFileCommandCurlDebugCallback); + cmFileCommandCurlDebugCallback); if (res != CURLE_OK) { - std::string errstring = - "FILE(DOWNLOAD ) error; cannot set debug function: "; - errstring += ::curl_easy_strerror(res); + std::string errstring = + "FILE(DOWNLOAD ) error; cannot set debug function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } @@ -2618,14 +2747,16 @@ cmFileCommand::HandleDownloadCommand(std::vector { std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: "; + std::string errstring = "FILE(DOWNLOAD ) error; cannot set debug data: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } @@ -2637,24 +2768,70 @@ cmFileCommand::HandleDownloadCommand(std::vector { std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } } + if(timeout > 0) { res = ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout ); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: "; + std::string errstring = "FILE(DOWNLOAD ) error; cannot set timeout: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } } + + // Need the progress helper's scope to last through the duration of + // the curl_easy_perform call... so this object is declared at function + // scope intentionally, rather than inside the "if(showProgress)" + // block... + // + cURLProgressHelper helper(this); + + if(showProgress) + { + res = ::curl_easy_setopt(curl, + CURLOPT_NOPROGRESS, 0); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set noprogress value: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + + res = ::curl_easy_setopt(curl, + CURLOPT_PROGRESSFUNCTION, cmFileCommandCurlProgressCallback); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + + res = ::curl_easy_setopt(curl, + CURLOPT_PROGRESSDATA, reinterpret_cast(&helper)); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress data: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + } + res = ::curl_easy_perform(curl); + /* always cleanup */ g_curl.release(); ::curl_easy_cleanup(curl); + if(statusVar.size()) { cmOStringStream result; @@ -2662,7 +2839,44 @@ cmFileCommand::HandleDownloadCommand(std::vector this->Makefile->AddDefinition(statusVar.c_str(), result.str().c_str()); } + ::curl_global_cleanup(); + + // Explicitly flush/close so we can measure the md5 accurately. + // + fout.flush(); + fout.close(); + + // Verify MD5 sum if requested: + // + if (!expectedMD5sum.empty()) + { + char computedMD5[32]; + + if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + { + this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " + "downloaded file"); + return false; + } + + std::string actualMD5sum = cmSystemTools::LowerCase( + std::string(computedMD5, 32)); + + if (expectedMD5sum != actualMD5sum) + { + cmOStringStream oss; + oss << "FILE(DOWNLOAD ) error; expected and actual MD5 sums differ" + << std::endl + << " for file: [" << file << "]" << std::endl + << " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl + << " actual MD5 sum: [" << actualMD5sum << "]" << std::endl + ; + this->SetError(oss.str().c_str()); + return false; + } + } + if(chunkDebug.size()) { chunkDebug.push_back(0); @@ -2680,6 +2894,7 @@ cmFileCommand::HandleDownloadCommand(std::vector this->Makefile->AddDefinition(verboseLog.c_str(), &*chunkDebug.begin()); } + return true; #else this->SetError("FILE(DOWNLOAD ) " diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index c6da30125c..e771092170 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -80,7 +80,8 @@ public: " file(RELATIVE_PATH variable directory file)\n" " file(TO_CMAKE_PATH path result)\n" " file(TO_NATIVE_PATH path result)\n" - " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log])\n" + " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log]\n" + " [EXPECTED_MD5 sum] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " "if it does not exist.\n" @@ -152,7 +153,12 @@ public: "and the second element is a string value for the error. A 0 " "numeric error means no error in the operation. " "If TIMEOUT time is specified, the operation will " - "timeout after time seconds, time should be specified as an integer." + "timeout after time seconds, time should be specified as an integer. " + "If EXPECTED_MD5 sum is specified, the operation will verify that the " + "downloaded file's actual md5 sum matches the expected value. If it " + "does not match, the operation fails with an error. " + "If SHOW_PROGRESS is specified, progress information will be printed " + "as status messages until the operation is complete." "\n" "The file() command also provides COPY and INSTALL signatures:\n" " file( files... DESTINATION \n" -- cgit v1.2.1 From 0efa5f3747d604b117119561949b3e70548ba478 Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 27 May 2010 14:49:38 -0400 Subject: Fix unused variable warning in new code. --- Source/cmFileCommand.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 539ed0fc9c..8260cc74e0 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2510,6 +2510,9 @@ namespace{ cURLProgressHelper *helper = reinterpret_cast(clientp); + static_cast(ultotal); + static_cast(ulnow); + std::string status; if (helper->UpdatePercentage(dlnow, dltotal, status)) { -- cgit v1.2.1 From 7458d465dde88a5e85b51d32b7b37f9dcfb9d216 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 May 2010 10:20:10 -0400 Subject: Fix LINK_FLAGS_ in VS 6 generator Add the flags to the link step, not the compile step! --- Source/cmLocalVisualStudio6Generator.cxx | 74 +++++++++++++++++++------------- 1 file changed, 45 insertions(+), 29 deletions(-) (limited to 'Source') diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 89bfd054ec..d7ffcf7d95 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1142,6 +1142,10 @@ void cmLocalVisualStudio6Generator // Get extra linker options for this target type. std::string extraLinkOptions; + std::string extraLinkOptionsDebug; + std::string extraLinkOptionsRelease; + std::string extraLinkOptionsMinSizeRel; + std::string extraLinkOptionsRelWithDebInfo; if(target.GetType() == cmTarget::EXECUTABLE) { extraLinkOptions = @@ -1165,6 +1169,33 @@ void cmLocalVisualStudio6Generator extraLinkOptions += targetLinkFlags; } + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG")) + { + extraLinkOptionsDebug += " "; + extraLinkOptionsDebug += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELEASE")) + { + extraLinkOptionsRelease += " "; + extraLinkOptionsRelease += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_MINSIZEREL")) + { + extraLinkOptionsMinSizeRel += " "; + extraLinkOptionsMinSizeRel += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) + { + extraLinkOptionsRelWithDebInfo += " "; + extraLinkOptionsRelWithDebInfo += targetLinkFlags; + } + + + + // Get standard libraries for this language. if(targetBuilds) { @@ -1259,13 +1290,21 @@ void cmLocalVisualStudio6Generator target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY) { - this->ComputeLinkOptions(target, "Debug", extraLinkOptions, + extraLinkOptionsDebug = + extraLinkOptions + " " + extraLinkOptionsDebug; + extraLinkOptionsRelease = + extraLinkOptions + " " + extraLinkOptionsRelease; + extraLinkOptionsMinSizeRel = + extraLinkOptions + " " + extraLinkOptionsMinSizeRel; + extraLinkOptionsRelWithDebInfo = + extraLinkOptions + " " + extraLinkOptionsRelWithDebInfo; + this->ComputeLinkOptions(target, "Debug", extraLinkOptionsDebug, optionsDebug); - this->ComputeLinkOptions(target, "Release", extraLinkOptions, + this->ComputeLinkOptions(target, "Release", extraLinkOptionsRelease, optionsRelease); - this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptions, + this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptionsMinSizeRel, optionsMinSizeRel); - this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptions, + this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptionsRelWithDebInfo, optionsRelWithDebInfo); } @@ -1519,41 +1558,18 @@ void cmLocalVisualStudio6Generator std::string flagVar = baseFlagVar + "_RELEASE"; flagsRelease = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_RELEASE")) - { - flagsRelease += targetLinkFlags; - flagsRelease += " "; - } + flagVar = baseFlagVar + "_MINSIZEREL"; flagsMinSize = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_MINSIZEREL")) - { - flagsMinSize += targetLinkFlags; - flagsMinSize += " "; - } - + flagVar = baseFlagVar + "_DEBUG"; flagsDebug = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\" "; - if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG")) - { - flagsDebug += targetLinkFlags; - flagsDebug += " "; - } flagVar = baseFlagVar + "_RELWITHDEBINFO"; flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) - { - flagsDebugRel += targetLinkFlags; - flagsDebugRel += " "; - } - } // if unicode is not found, then add -D_MBCS -- cgit v1.2.1 From 159606c3667e006bba59490c2cae82871f25d773 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 May 2010 11:00:31 -0400 Subject: Implement LINK_FLAGS_ in VS 10 generator Add support for the per-config LINK_FLAGS property in VS 10. This was simply missing. --- Source/cmVisualStudio10TargetGenerator.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Source') diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9f64473171..13bbc74b3d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -860,6 +860,13 @@ OutputLinkIncremental(std::string const& configName) flags += " "; flags += targetLinkFlags; } + std::string flagsProp = "LINK_FLAGS_"; + flagsProp += CONFIG; + if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) + { + flags += " "; + flags += flagsConfig; + } if(flags.find("INCREMENTAL:NO") != flags.npos) { incremental = "false"; @@ -1099,6 +1106,13 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += " "; flags += targetLinkFlags; } + std::string flagsProp = "LINK_FLAGS_"; + flagsProp += CONFIG; + if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) + { + flags += " "; + flags += flagsConfig; + } cmVisualStudioGeneratorOptions linkOptions(this->LocalGenerator, 10, cmVisualStudioGeneratorOptions::Linker, -- cgit v1.2.1 From fe971d97cae4df94d3643c5203b79336cfd31e05 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 May 2010 10:45:54 -0400 Subject: Add STATIC_LIBRARY_FLAGS_ property (#10768) This is a per-configuration version of STATIC_LIBRARY_FLAGS. --- Source/cmLocalVisualStudio6Generator.cxx | 40 +++++++++++++++++++++++++++++ Source/cmLocalVisualStudio7Generator.cxx | 15 ++++++++++- Source/cmMakefileLibraryTargetGenerator.cxx | 4 +++ Source/cmTarget.cxx | 5 ++++ Source/cmVisualStudio10TargetGenerator.cxx | 15 +++++++---- 5 files changed, 73 insertions(+), 6 deletions(-) (limited to 'Source') diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d7ffcf7d95..539816d3c6 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1381,11 +1381,43 @@ void cmLocalVisualStudio6Generator cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str()); } std::string staticLibOptions; + std::string staticLibOptionsDebug; + std::string staticLibOptionsRelease; + std::string staticLibOptionsMinSizeRel; + std::string staticLibOptionsRelWithDebInfo; if(target.GetType() == cmTarget::STATIC_LIBRARY ) { if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) { staticLibOptions = libflags; + staticLibOptionsDebug = libflags; + staticLibOptionsRelease = libflags; + staticLibOptionsMinSizeRel = libflags; + staticLibOptionsRelWithDebInfo = libflags; + } + if(const char* libflagsDebug = + target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG")) + { + staticLibOptionsDebug += " "; + staticLibOptionsDebug = libflagsDebug; + } + if(const char* libflagsRelease = + target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE")) + { + staticLibOptionsRelease += " "; + staticLibOptionsRelease = libflagsRelease; + } + if(const char* libflagsMinSizeRel = + target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL")) + { + staticLibOptionsMinSizeRel += " "; + staticLibOptionsMinSizeRel = libflagsMinSizeRel; + } + if(const char* libflagsRelWithDebInfo = + target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO")) + { + staticLibOptionsRelWithDebInfo += " "; + staticLibOptionsRelWithDebInfo = libflagsRelWithDebInfo; } } @@ -1417,6 +1449,14 @@ void cmLocalVisualStudio6Generator mfcFlag); if(target.GetType() == cmTarget::STATIC_LIBRARY ) { + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG", + staticLibOptionsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELEASE", + staticLibOptionsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_MINSIZEREL", + staticLibOptionsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELWITHDEBINFO", + staticLibOptionsRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS", staticLibOptions.c_str()); } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2d8197c6d1..136c177f6f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -915,7 +915,20 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } fout << "\t\t\tLocalGenerator->AppendFlags (extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS")); + std::string staticLibraryFlagsConfig = "STATIC_LIBRARY_FLAGS_"; + staticLibraryFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); + this->LocalGenerator->AppendFlags + (extraFlags, this->Target->GetProperty(staticLibraryFlagsConfig.c_str())); this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 54b1815c58..45ba358443 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -707,6 +707,11 @@ void cmTarget::DefineProperties(cmake *cm) "Extra flags to use when linking static libraries.", "Extra flags to use when linking a static library."); + cm->DefineProperty + ("STATIC_LIBRARY_FLAGS_", cmProperty::TARGET, + "Per-configuration flags for creating a static library.", + "This is the configuration-specific version of STATIC_LIBRARY_FLAGS."); + cm->DefineProperty ("SUFFIX", cmProperty::TARGET, "What comes after the library name.", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 13bbc74b3d..53d6594962 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1023,22 +1023,27 @@ WriteRCOptions(std::string const& , } -void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& - ) +void +cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) { if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { return; } - if(const char* libflags = this->Target - ->GetProperty("STATIC_LIBRARY_FLAGS")) + const char* libflags = this->Target->GetProperty("STATIC_LIBRARY_FLAGS"); + std::string flagsConfigVar = "STATIC_LIBRARY_FLAGS_"; + flagsConfigVar += cmSystemTools::UpperCase(config); + const char* libflagsConfig = + this->Target->GetProperty(flagsConfigVar.c_str()); + if(libflags || libflagsConfig) { this->WriteString("\n", 2); cmVisualStudioGeneratorOptions libOptions(this->LocalGenerator, 10, cmVisualStudioGeneratorOptions::Linker, cmVS10LibFlagTable, 0, this); - libOptions.Parse(libflags); + libOptions.Parse(libflags?libflags:""); + libOptions.Parse(libflagsConfig?libflagsConfig:""); libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); libOptions.OutputFlagMap(*this->BuildFileStream, " "); this->WriteString("\n", 2); -- cgit v1.2.1 From 5c49aa0c8622b5253b6041e85ba32a5b5ce26d74 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 May 2010 13:23:31 -0400 Subject: Xcode: Archives use STATIC_LIBRARY_FLAGS, not LINK_FLAGS The LINK_FLAGS property is defined only for targets that really link. These include executables and shared libraries. For static libraries we define the STATIC_LIBRARY_FLAGS property. Teach the Xcode generator to make this distinction. --- Source/cmGlobalXCodeGenerator.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0d6e389ec4..537a88f308 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1514,8 +1514,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, extraLinkOptions = this->CurrentMakefile-> GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); } - - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + + const char* linkFlagsProp = "LINK_FLAGS"; + if(target.GetType() == cmTarget::STATIC_LIBRARY) + { + linkFlagsProp = "STATIC_LIBRARY_FLAGS"; + } + const char* targetLinkFlags = target.GetProperty(linkFlagsProp); if(targetLinkFlags) { extraLinkOptions += " "; @@ -1523,7 +1528,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } if(configName && *configName) { - std::string linkFlagsVar = "LINK_FLAGS_"; + std::string linkFlagsVar = linkFlagsProp; + linkFlagsVar += "_"; linkFlagsVar += cmSystemTools::UpperCase(configName); if(const char* linkFlags = target.GetProperty(linkFlagsVar.c_str())) { -- cgit v1.2.1 From eaee8a2cb17fb53fe4f721813b8ddae111a4a07a Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 2 Jun 2010 00:01:04 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8cd4ff3b35..6dde3b3b54 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 01) +SET(KWSYS_DATE_STAMP_DAY 02) -- cgit v1.2.1 From 3ac3dea6f0eb1ce68b321020ecdd336b3db8a0fe Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 3 Jun 2010 00:01:02 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 6dde3b3b54..09a6912885 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 03) -- cgit v1.2.1 From 85cbdaade22c7ba6dac7a806c0b88ebc32caa4c1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Jun 2010 10:46:38 -0400 Subject: Really trust umask in file(WRITE) command (#10789, #10126) Commit 8d0161c8 (Trust umask for file permissions, 2010-01-12) taught these commands to set permissions to 0666 explicitly. The intention was to let the open() call inside ofstream handle permsisions so that umask would be honored. Now we set permissions only when we need to preserve those on an existing file. New files will be created with umask-based permissions. --- Source/cmFileCommand.cxx | 19 +++++++------------ Source/cmWriteFileCommand.cxx | 19 +++++++------------ 2 files changed, 14 insertions(+), 24 deletions(-) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 561152714a..9bd84d84ce 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -183,24 +183,16 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); - mode_t mode = -#if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR -#else - 0666 -#endif - ; + mode_t mode = 0; // Set permissions to writable if ( cmSystemTools::GetPermissions(fileName.c_str(), mode) ) { cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE + mode | S_IWRITE #else - 0666 + mode | S_IWUSR | S_IWGRP #endif ); } @@ -217,7 +209,10 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, } file << message; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index f46b87fed3..ec558b6dd9 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -54,24 +54,16 @@ bool cmWriteFileCommand std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); - mode_t mode = -#if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR -#else - 0666 -#endif - ; + mode_t mode = 0; // Set permissions to writable if ( cmSystemTools::GetPermissions(fileName.c_str(), mode) ) { cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE + mode | S_IWRITE #else - 0666 + mode | S_IWUSR | S_IWGRP #endif ); } @@ -89,7 +81,10 @@ bool cmWriteFileCommand } file << message << std::endl; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } -- cgit v1.2.1 From cae85c9f65c87bfa05376077f70cb05c26b2bc66 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Jun 2010 11:18:39 -0400 Subject: Borland: No S_IWGRP is available --- Source/cmFileCommand.cxx | 2 ++ Source/cmWriteFileCommand.cxx | 2 ++ 2 files changed, 4 insertions(+) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9bd84d84ce..df9863fd9e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -191,6 +191,8 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) mode | S_IWRITE +#elif defined( __BORLANDC__ ) + mode | S_IWUSR #else mode | S_IWUSR | S_IWGRP #endif diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index ec558b6dd9..b2acb2bc15 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -62,6 +62,8 @@ bool cmWriteFileCommand cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) mode | S_IWRITE +#elif defined( __BORLANDC__ ) + mode | S_IWUSR #else mode | S_IWUSR | S_IWGRP #endif -- cgit v1.2.1 From b8a1319c354b7f257e6c0b82e428cfe94dcbf4ff Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Jun 2010 11:57:02 -0400 Subject: Avoid use of CopyAFile "copyPermissions" parameter Commit 0fafdb7e (Do not copy permissions of files when making the copy in an install rule, 2008-12-18) added special behavior to KWSys file copy methods for this special case. Use a local solution to avoid use of the special behavior so it can be removed later. --- Source/cmFileCommand.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 561152714a..60a81f34a9 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1507,7 +1507,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, this->ReportCopy(toFile, TypeFile, copy); // Copy the file. - if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false)) + if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) { cmOStringStream e; e << this->Name << " cannot copy file \"" << fromFile @@ -1519,6 +1519,13 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, // Set the file modification time of the destination file. if(copy && !this->Always) { + // Add write permission so we can set the file time. + // Permissions are set unconditionally below anyway. + mode_t perm = 0; + if(cmSystemTools::GetPermissions(toFile, perm)) + { + cmSystemTools::SetPermissions(toFile, perm | mode_owner_write); + } if (!cmSystemTools::CopyFileTime(fromFile, toFile)) { cmOStringStream e; -- cgit v1.2.1 From c15ed3294c68cc819d9471c4ea41dc3d2a95aadd Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Jun 2010 12:46:11 -0400 Subject: KWSys: Avoid stat in CopyFileAlways (#10790) On Windows 7 the file size reported by 'stat' on a new file sometimes reports zero even though the real size is correct. This causes our CopyFileAlways method to falsely detect copy failure. Work around the problem by trusting the state of ofstream after writing the file. --- Source/kwsys/SystemTools.cxx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'Source') diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index afc724076d..a2e194ad93 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1924,22 +1924,10 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, fin.close(); fout.close(); - // More checks. - struct stat statSource, statDestination; - statSource.st_size = 12345; - statDestination.st_size = 12345; - if(stat(source, &statSource) != 0) - { - return false; - } - else if(stat(destination, &statDestination) != 0) + if(!fout) { return false; } - else if(statSource.st_size != statDestination.st_size) - { - return false; - } if ( copyPermissions && perms ) { if ( !SystemTools::SetPermissions(destination, perm) ) -- cgit v1.2.1 From d093abef7e1b965cd6bc8a347852905d6c2b0913 Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 3 Jun 2010 13:43:39 -0400 Subject: Fix failing ExternalProject test on Borland dashboards. If there is a .bat or .cmd file used as a custom command then the Borland Makefiles generator (specifically) requires using the "call " syntax before the name of the .bat or .cmd file. This fix applies to all Makefile based generators where WindowsShell is true. --- Source/cmLocalUnixMakefileGenerator3.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Source') diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fce5a9c9d0..004d19a2d4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -973,6 +973,24 @@ cmLocalUnixMakefileGenerator3 this->ConfigurationName.c_str()); if (cmd.size()) { + // Use "call " before any invocations of .bat or .cmd files + // invoked as custom commands in the WindowsShell. + // + bool useCall = false; + + if (this->WindowsShell) + { + std::string suffix; + if (cmd.size() > 4) + { + suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size()-4)); + if (suffix == ".bat" || suffix == ".cmd") + { + useCall = true; + } + } + } + cmSystemTools::ReplaceString(cmd, "/./", "/"); // Convert the command to a relative path only if the current // working directory will be the start-output directory. @@ -1044,6 +1062,10 @@ cmLocalUnixMakefileGenerator3 } } } + if (useCall && launcher.empty()) + { + cmd = "call " + cmd; + } commands1.push_back(cmd); } } -- cgit v1.2.1 From 5f4ac98bc5c2c208b8c34c2b12b6b3a7ca9e8c91 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 4 Jun 2010 00:01:03 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 09a6912885..1a0fec76f8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 03) +SET(KWSYS_DATE_STAMP_DAY 04) -- cgit v1.2.1 From ef491f78218e255339278656bf6dc26073fef264 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 4 Jun 2010 13:38:07 -0400 Subject: Allow redirects: set CURLOPT_FOLLOWLOCATION to 1 Enable file(DOWNLOAD ...) to follow redirects. Thanks to Michael Wild for requesting the addition and providing the majority of the patch. --- Source/cmFileCommand.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source') diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8260cc74e0..d06014c8e3 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2763,6 +2763,15 @@ cmFileCommand::HandleDownloadCommand(std::vector return false; } + res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set follow-redirect option: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + if(verboseLog.size()) { res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); -- cgit v1.2.1 From fdb5f78705f1a603d176a0976c931dd197567ff9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Jun 2010 14:32:08 -0400 Subject: CPack: Try harder to remove temporary dir (#10793) Windows filesystems sometimes lock files temporarily. Try removing the CPack temp install folder multiple times before giving up. --- Source/CPack/cmCPackGenerator.cxx | 4 ++-- Source/cmSystemTools.cxx | 15 +++++++++++++++ Source/cmSystemTools.h | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6224b4070c..4a4b428fc2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -789,7 +789,7 @@ int cmCPackGenerator::DoPackage() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " << toplevelDirectory << std::endl); - if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) ) + if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " @@ -1084,7 +1084,7 @@ int cmCPackGenerator::CleanTemporaryDirectory() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Clean temporary : " << tempInstallDirectory << std::endl); - if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory)) + if(!cmSystemTools::RepeatedRemoveDirectory(tempInstallDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing temporary directory: " << diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d914203bfb..5f7cfa3988 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2938,3 +2938,18 @@ bool cmSystemTools::CheckRPath(std::string const& file, return false; #endif } + +//---------------------------------------------------------------------------- +bool cmSystemTools::RepeatedRemoveDirectory(const char* dir) +{ + // Windows sometimes locks files temporarily so try a few times. + for(int i = 0; i < 10; ++i) + { + if(cmSystemTools::RemoveADirectory(dir)) + { + return true; + } + cmSystemTools::Delay(100); + } + return false; +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index ed924dd616..da5da319b6 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -436,6 +436,9 @@ public: static bool CheckRPath(std::string const& file, std::string const& newRPath); + /** Remove a directory; repeat a few times in case of locked files. */ + static bool RepeatedRemoveDirectory(const char* dir); + private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; -- cgit v1.2.1 From ac17dc4a43e7350d7a6daed252adb35a8986fd4b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Jun 2010 16:02:00 -0400 Subject: KWSys: Remove "copyPermissions" parameters The CopyFileIfDifferent, CopyFileAlways, CopyAFile and CopyADirectory methods should always copy permissions. The special cases in which a caller would pass copyPermissions=false should be handled at the call site. The parameter needlessly complicates the interface and semantics of these methods. --- Source/kwsys/SystemTools.cxx | 27 +++++++++++---------------- Source/kwsys/SystemTools.hxx.in | 23 +++++++---------------- 2 files changed, 18 insertions(+), 32 deletions(-) (limited to 'Source') diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index a2e194ad93..3153235519 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1722,8 +1722,7 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path) } bool SystemTools::CopyFileIfDifferent(const char* source, - const char* destination, - bool copyPermissions) + const char* destination) { // special check for a destination that is a directory // FilesDiffer does not handle file to directory compare @@ -1736,8 +1735,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source, new_destination += SystemTools::GetFilenameName(source_name); if(SystemTools::FilesDiffer(source, new_destination.c_str())) { - return SystemTools::CopyFileAlways(source, destination, - copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } else { @@ -1750,7 +1748,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source, // are different if(SystemTools::FilesDiffer(source, destination)) { - return SystemTools::CopyFileAlways(source, destination, copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } // at this point the files must be the same so return true return true; @@ -1836,8 +1834,7 @@ bool SystemTools::FilesDiffer(const char* source, /** * Copy a file named by "source" to the file named by "destination". */ -bool SystemTools::CopyFileAlways(const char* source, const char* destination, - bool copyPermissions) +bool SystemTools::CopyFileAlways(const char* source, const char* destination) { // If files are the same do not copy if ( SystemTools::SameFile(source, destination) ) @@ -1928,7 +1925,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, { return false; } - if ( copyPermissions && perms ) + if ( perms ) { if ( !SystemTools::SetPermissions(destination, perm) ) { @@ -1940,15 +1937,15 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, //---------------------------------------------------------------------------- bool SystemTools::CopyAFile(const char* source, const char* destination, - bool always, bool copyPermissions) + bool always) { if(always) { - return SystemTools::CopyFileAlways(source, destination, copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } else { - return SystemTools::CopyFileIfDifferent(source, destination, copyPermissions); + return SystemTools::CopyFileIfDifferent(source, destination); } } @@ -1957,7 +1954,7 @@ bool SystemTools::CopyAFile(const char* source, const char* destination, * "destination". */ bool SystemTools::CopyADirectory(const char* source, const char* destination, - bool always, bool copyPermissions) + bool always) { Directory dir; dir.Load(source); @@ -1981,16 +1978,14 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, fullDestPath += dir.GetFile(static_cast(fileNum)); if (!SystemTools::CopyADirectory(fullPath.c_str(), fullDestPath.c_str(), - always, - copyPermissions)) + always)) { return false; } } else { - if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always, - copyPermissions)) + if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always)) { return false; } diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index fd35742d33..ec70320d4e 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -500,14 +500,10 @@ public: /** * Copy the source file to the destination file only - * if the two files differ. If the "copyPermissions" - * argument is true, the permissions of the copy are - * set to be the same as the permissions of the - * original. + * if the two files differ. */ static bool CopyFileIfDifferent(const char* source, - const char* destination, - bool copyPermissions = true); + const char* destination); /** * Compare the contents of two files. Return true if different @@ -520,22 +516,17 @@ public: static bool SameFile(const char* file1, const char* file2); /** - * Copy a file. If the "copyPermissions" argument is true, the - * permissions of the copy are set to be the same as the permissions - * of the original. + * Copy a file. */ - static bool CopyFileAlways(const char* source, const char* destination, - bool copyPermissions = true); + static bool CopyFileAlways(const char* source, const char* destination); /** * Copy a file. If the "always" argument is true the file is always * copied. If it is false, the file is copied only if it is new or - * has changed. If the "copyPermissions" argument is true, the - * permissions of the copy are set to be the same as the permissions - * of the original. + * has changed. */ static bool CopyAFile(const char* source, const char* destination, - bool always = true, bool copyPermissions = true); + bool always = true); /** * Copy content directory to another directory with all files and @@ -544,7 +535,7 @@ public: * are new are copied. */ static bool CopyADirectory(const char* source, const char* destination, - bool always = true, bool copyPermissions = true); + bool always = true); /** * Remove a file -- cgit v1.2.1 From d0a1b9efd00ae2a6125f46dc7a4a8114e5afc61a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Jun 2010 17:01:23 -0400 Subject: Fix ctest_update log prefix for git submodule update Commit 67277bac (Teach ctest_update about Git submodules, 2010-05-04) accidentally logged "git submodule update" with the prefixes "pull-out" and "pull-err". Fix it to use "submodule-out" and "submodule-err" instead. --- Source/CTest/cmCTestGIT.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 156a938ea9..f5ba36120b 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -119,7 +119,7 @@ bool cmCTestGIT::UpdateImpl() char const* git_submodule[] = {git, "submodule", "update", 0}; OutputLogger out2(this->Log, "submodule-out> "); OutputLogger err2(this->Log, "submodule-err> "); - return this->RunChild(git_submodule, &out, &err); + return this->RunChild(git_submodule, &out2, &err2); } return false; } -- cgit v1.2.1 From dc6ed8ee8c75fb8aaf5d88f868f8ddf17dc2baa5 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 5 Jun 2010 00:01:03 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 1a0fec76f8..0fa6c0a3a8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 04) +SET(KWSYS_DATE_STAMP_DAY 05) -- cgit v1.2.1 From c06dae9e6792efb5727635eb2c667b6822579b5f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 6 Jun 2010 00:01:03 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 0fa6c0a3a8..05b717ed55 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 05) +SET(KWSYS_DATE_STAMP_DAY 06) -- cgit v1.2.1 From 2847d86c68590f8b330bd97b3f78f7033a3c87e0 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 7 Jun 2010 00:01:04 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 05b717ed55..26e162756c 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 06) +SET(KWSYS_DATE_STAMP_DAY 07) -- cgit v1.2.1 From ddf0de132b680e5794406f4d698a0e5262926dd8 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Tue, 8 Jun 2010 00:01:03 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 26e162756c..0ad8ba64c9 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 07) +SET(KWSYS_DATE_STAMP_DAY 08) -- cgit v1.2.1 From 86de1d6504737510e2107aa0323ec761d666bfaa Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 9 Jun 2010 00:01:09 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 0ad8ba64c9..a9a8261d08 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 08) +SET(KWSYS_DATE_STAMP_DAY 09) -- cgit v1.2.1 From c452d5b646183f665cabdfc8b85c899217cd2118 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 10 Jun 2010 00:01:03 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index a9a8261d08..627d15ae10 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 09) +SET(KWSYS_DATE_STAMP_DAY 10) -- cgit v1.2.1 From 3f929475246a3d89ca5d4c5db301d1c4705d0d69 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Jun 2010 09:26:32 -0400 Subject: KWSys: Configure DynamicLoader library prefix/suffix The DynamicLoader::LibPrefix and DynamicLoader::LibExtension methods previously hard-coded the module name components for each platform. Set them from the CMAKE_SHARED_MODULE_PREFIX and CMAKE_SHARED_MODULE_SUFFIX CMake variables instead. This ensures consistency in a program that uses these methods to construct the file names for its own modules. --- Source/kwsys/CMakeLists.txt | 8 ++++ Source/kwsys/DynamicLoader.cxx | 84 --------------------------------------- Source/kwsys/DynamicLoader.hxx.in | 8 ++-- 3 files changed, 12 insertions(+), 88 deletions(-) (limited to 'Source') diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 62042e86e6..f440ff92a5 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -309,6 +309,14 @@ IF(NOT KWSYS_IN_SOURCE_BUILD) ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE) ENDIF(NOT KWSYS_IN_SOURCE_BUILD) +# Select plugin module file name convention. +IF(NOT KWSYS_DynamicLoader_PREFIX) + SET(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX}) +ENDIF() +IF(NOT KWSYS_DynamicLoader_SUFFIX) + SET(KWSYS_DynamicLoader_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX}) +ENDIF() + #----------------------------------------------------------------------------- # We require ANSI support from the C compiler. Add any needed flags. IF(CMAKE_ANSI_CFLAGS) diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 58e02c76bd..c4ee095519 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -69,19 +69,6 @@ DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const char* sy return *reinterpret_cast(&result); } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".sl"; -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { // TODO: Need implementation with errno/strerror @@ -175,21 +162,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return *reinterpret_cast(&result); } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - // NSCreateObjectFileImageFromFile fail when dealing with dylib image - // it returns NSObjectFileImageInappropriateFile - //return ".dylib"; - return ".so"; -} - //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { @@ -284,22 +256,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( #endif } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ -#ifdef __MINGW32__ - return "lib"; -#else - return ""; -#endif -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".dll"; -} - //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { @@ -417,18 +373,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return result.psym; } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".so"; -} - //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { @@ -475,18 +419,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return 0; } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() - { - return "lib"; - } - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() - { - return ".a"; - } - //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { @@ -539,22 +471,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return result.psym; } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ -#ifdef __CYGWIN__ - return ".dll"; -#else - return ".so"; -#endif -} - //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in index 325e956fe5..64468ecd37 100644 --- a/Source/kwsys/DynamicLoader.hxx.in +++ b/Source/kwsys/DynamicLoader.hxx.in @@ -86,11 +86,11 @@ public: /** Find the address of the symbol in the given library. */ static SymbolPointer GetSymbolAddress(LibraryHandle, const char*); - /** Return the library prefix for the given architecture */ - static const char* LibPrefix(); + /** Return the default module prefix for the current platform. */ + static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; } - /** Return the library extension for the given architecture. */ - static const char* LibExtension(); + /** Return the default module suffix for the current platform. */ + static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; } /** Return the last error produced from a calls made on this class. */ static const char* LastError(); -- cgit v1.2.1 From 6ce85691eb0a56ea1a9ae3858ff0e18a86a7c377 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 11 Jun 2010 00:01:32 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 627d15ae10..62103d405d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 10) +SET(KWSYS_DATE_STAMP_DAY 11) -- cgit v1.2.1 From 60478de3e5032a0db59f27e913fef222fe767518 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 11 Jun 2010 10:15:19 -0400 Subject: KWSys: Process tree kill for Solaris --- Source/kwsys/ProcessUNIX.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Source') diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 9cb787a0c8..adadef15f3 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -2377,6 +2377,9 @@ static pid_t kwsysProcessFork(kwsysProcess* cp, || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) # define KWSYSPE_PS_COMMAND "ps axo pid,ppid" # define KWSYSPE_PS_FORMAT "%d %d\n" +#elif defined(__sun) && (defined(__SVR4) || defined(__svr4__)) /* Solaris */ +# define KWSYSPE_PS_COMMAND "ps -e -o pid,ppid" +# define KWSYSPE_PS_FORMAT "%d %d\n" #elif defined(__hpux) || defined(__sun__) || defined(__sgi) || defined(_AIX) \ || defined(__sparc) # define KWSYSPE_PS_COMMAND "ps -ef" -- cgit v1.2.1 From b9e3c243d476efa04479d253cfc4f76ecbdb6fe3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 11 Jun 2010 11:00:38 -0400 Subject: KWSys: Teach Process to error on empty command Do not try to execute a child with no command line. Previously this led to a silent hang. --- Source/kwsys/ProcessUNIX.c | 8 ++++++++ Source/kwsys/ProcessWin32.c | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'Source') diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index adadef15f3..9c66a44866 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -720,6 +720,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) { diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index c5ea6db206..5aa4d8bf6e 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -987,6 +987,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) { -- cgit v1.2.1 From a7abcd1442828792fc39397ced96a28cda95b032 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sat, 12 Jun 2010 00:01:05 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 62103d405d..46cdbca127 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 11) +SET(KWSYS_DATE_STAMP_DAY 12) -- cgit v1.2.1 From 8d29fa46abba732410147aa80cbcc58ceb265835 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Sun, 13 Jun 2010 00:01:02 -0400 Subject: KWSys Nightly Date Stamp --- Source/kwsys/kwsysDateStamp.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 46cdbca127..77da3c253f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 12) +SET(KWSYS_DATE_STAMP_DAY 13) -- cgit v1.2.1