diff options
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatch.cxx | 32 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatch.h | 3 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatchParser.cxx | 52 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatchParser.h | 29 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.cxx | 19 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.h | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackArchiveGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackCygwinSourceGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackDebGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackPackageMakerGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackSTGZGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 4 |
17 files changed, 171 insertions, 49 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 43d34ee..4eb23c1 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -24,7 +24,6 @@ #include <cmsys/RegularExpression.hxx> #include <cmGlobalGenerator.h> -#include <cmLocalGenerator.h> #include <cmSystemTools.h> #include <cmMakefile.h> #include <cmGeneratedFileStream.h> diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 5a8dc63..471c3a4 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -33,13 +33,30 @@ void cmWIXPatch::ApplyFragment( if(i == Fragments.end()) return; const cmWIXPatchElement& fragment = i->second; + + this->ApplyElementChildren(fragment, writer); + + Fragments.erase(i); +} + +void cmWIXPatch::ApplyElementChildren( + const cmWIXPatchElement& element, cmWIXSourceWriter& writer) +{ for(cmWIXPatchElement::child_list_t::const_iterator - j = fragment.children.begin(); j != fragment.children.end(); ++j) + j = element.children.begin(); j != element.children.end(); ++j) + { + cmWIXPatchNode *node = *j; + + switch(node->type()) { - ApplyElement(**j, writer); + case cmWIXPatchNode::ELEMENT: + ApplyElement(dynamic_cast<const cmWIXPatchElement&>(*node), writer); + break; + case cmWIXPatchNode::TEXT: + writer.AddTextNode(dynamic_cast<const cmWIXPatchText&>(*node).text); + break; } - - Fragments.erase(i); + } } void cmWIXPatch::ApplyElement( @@ -53,16 +70,11 @@ void cmWIXPatch::ApplyElement( writer.AddAttribute(i->first, i->second); } - for(cmWIXPatchElement::child_list_t::const_iterator - i = element.children.begin(); i != element.children.end(); ++i) - { - ApplyElement(**i, writer); - } + this->ApplyElementChildren(element, writer); writer.EndElement(element.name); } - bool cmWIXPatch::CheckForUnappliedFragments() { std::string fragmentList; diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index 7b7b2f1..d53fcb4 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -33,6 +33,9 @@ public: bool CheckForUnappliedFragments(); private: + void ApplyElementChildren(const cmWIXPatchElement& element, + cmWIXSourceWriter& writer); + void ApplyElement(const cmWIXPatchElement& element, cmWIXSourceWriter& writer); diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index e066c28..14c5413 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -16,6 +16,21 @@ #include <cm_expat.h> +cmWIXPatchNode::Type cmWIXPatchText::type() +{ + return cmWIXPatchNode::TEXT; +} + +cmWIXPatchNode::Type cmWIXPatchElement::type() +{ + return cmWIXPatchNode::ELEMENT; +} + +cmWIXPatchNode::~cmWIXPatchNode() +{ + +} + cmWIXPatchElement::~cmWIXPatchElement() { for(child_list_t::iterator i = children.begin(); i != children.end(); ++i) @@ -63,20 +78,20 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char **atts) { cmWIXPatchElement &parent = *ElementStack.back(); - parent.children.resize(parent.children.size() + 1); - cmWIXPatchElement*& currentElement = parent.children.back(); - currentElement = new cmWIXPatchElement; - currentElement->name = name; + cmWIXPatchElement *element = new cmWIXPatchElement; + parent.children.push_back(element); + + element->name = name; for(size_t i = 0; atts[i]; i += 2) { std::string key = atts[i]; std::string value = atts[i+1]; - currentElement->attributes[key] = value; + element->attributes[key] = value; } - ElementStack.push_back(currentElement); + ElementStack.push_back(element); } } @@ -117,11 +132,34 @@ void cmWIXPatchParser::EndElement(const std::string& name) } else { - ElementStack.pop_back(); + ElementStack.pop_back(); } } } +void cmWIXPatchParser::CharacterDataHandler(const char* data, int length) +{ + const char* whitespace = "\x20\x09\x0d\x0a"; + + if(State == INSIDE_FRAGMENT) + { + cmWIXPatchElement &parent = *ElementStack.back(); + + std::string text(data, length); + + std::string::size_type first = text.find_first_not_of(whitespace); + std::string::size_type last = text.find_last_not_of(whitespace); + + if(first != std::string::npos && last != std::string::npos) + { + cmWIXPatchText *text_node = new cmWIXPatchText; + text_node->text = text.substr(first, last - first + 1); + + parent.children.push_back(text_node); + } + } +} + void cmWIXPatchParser::ReportError(int line, int column, const char* msg) { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index acfb4c0..acaeae3 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -20,11 +20,33 @@ #include <map> #include <list> -struct cmWIXPatchElement +struct cmWIXPatchNode { + enum Type + { + TEXT, + ELEMENT + }; + + virtual ~cmWIXPatchNode(); + + virtual Type type() = 0; +}; + +struct cmWIXPatchText : public cmWIXPatchNode +{ + virtual Type type(); + + std::string text; +}; + +struct cmWIXPatchElement : cmWIXPatchNode +{ + virtual Type type(); + ~cmWIXPatchElement(); - typedef std::list<cmWIXPatchElement*> child_list_t; + typedef std::list<cmWIXPatchNode*> child_list_t; typedef std::map<std::string, std::string> attributes_t; std::string name; @@ -48,6 +70,9 @@ private: void StartFragment(const char **attributes); virtual void EndElement(const std::string& name); + + virtual void CharacterDataHandler(const char* data, int length); + virtual void ReportError(int line, int column, const char* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 8d38e9b..63acb27 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -102,6 +102,25 @@ void cmWIXSourceWriter::EndElement(std::string const& name) State = DEFAULT; } +void cmWIXSourceWriter::AddTextNode(std::string const& text) +{ + if(State == BEGIN) + { + File << ">"; + } + + if(Elements.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "can not add text without open WiX element in '" << + SourceFilename << "'" << std::endl); + return; + } + + File << this->EscapeAttributeValue(text); + State = DEFAULT; +} + void cmWIXSourceWriter::AddProcessingInstruction( std::string const& target, std::string const& content) { diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 3b9999c..9e303f0 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -34,6 +34,8 @@ public: void EndElement(std::string const& name); + void AddTextNode(std::string const& text); + void AddProcessingInstruction( std::string const& target, std::string const& content); diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 58bd947..db985db 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" @@ -78,7 +77,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, std::string rp = filePrefix + *fileIt; cmCPackLogger(cmCPackLog::LOG_DEBUG,"Adding file: " << rp << std::endl); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: " @@ -284,7 +283,7 @@ int cmCPackArchiveGenerator::PackageFiles() // Get the relative path to the file std::string rp = cmSystemTools::RelativePath(toplevel.c_str(), fileIt->c_str()); - archive.Add(rp); + archive.Add(rp, 0, 0, false); if(!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< " diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index 6605f16..1f905c0 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index f1e8539..f5cb53c 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index f9dfdf6..04efb71 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -95,6 +95,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -222,6 +223,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne() std::string findExpr(this->GetOption("GEN_WDIR")); findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -524,21 +526,24 @@ int cmCPackDebGenerator::createDeb() packageFiles.begin(); fileIt != packageFiles.end(); ++ fileIt ) { - std::string cmd = "\""; - cmd += cmSystemTools::GetCMakeCommand(); - cmd += "\" -E md5sum \""; - cmd += *fileIt; - cmd += "\""; - - std::string output; - int retval = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, - &retval, toplevel.c_str(), this->GeneratorVerbose, 0); - if ( !res || retval ) + // hash only regular files + if( cmSystemTools::FileIsDirectory(*fileIt) + || cmSystemTools::FileIsSymlink(*fileIt)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum " - << cmd << std::endl); + continue; } + + char md5sum[33]; + if(!cmSystemTools::ComputeFileMD5(*fileIt, md5sum)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of " + << *fileIt << std::endl); + } + + md5sum[32] = 0; + + std::string output(md5sum); + output += " " + *fileIt + "\n"; // debian md5sums entries are like this: // 014f3604694729f3bf19263bac599765 usr/bin/ccmake // thus strip the full path (with the trailing slash) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 92a4b2b..22d4bf0 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -16,7 +16,6 @@ #include "cmCPackLog.h" #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmCPackComponentGroup.h" #include "cmXMLSafe.h" @@ -367,6 +366,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install directory: " << top << std::endl); gl.RecurseOn(); + gl.SetRecurseListDirs(true); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -379,7 +379,11 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( for ( gfit = files.begin(); gfit != files.end(); ++ gfit ) { bool skip = false; - std::string &inFile = *gfit; + std::string inFile = *gfit; + if(cmSystemTools::FileIsDirectory(*gfit)) + { + inFile += '/'; + } for ( regIt= ignoreFilesRegex.begin(); regIt!= ignoreFilesRegex.end(); ++ regIt) @@ -713,13 +717,12 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmake cm; cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); cmsys::auto_ptr<cmMakefile> mf( new cmMakefile(&gg, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg( - gg.CreateLocalGenerator(mf.get())); std::string realInstallDirectory = tempInstallDirectory; if ( !installSubDirectory.empty() && installSubDirectory != "/" ) { @@ -869,6 +872,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cmsys::Glob glB; findExpr += "/*"; glB.RecurseOn(); + glB.SetRecurseListDirs(true); glB.FindFiles(findExpr); filesBefore = glB.GetFiles(); std::sort(filesBefore.begin(),filesBefore.end()); @@ -908,6 +912,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { cmsys::Glob glA; glA.RecurseOn(); + glA.SetRecurseListDirs(true); glA.FindFiles(findExpr); std::vector<std::string> filesAfter = glA.GetFiles(); std::sort(filesAfter.begin(),filesAfter.end()); @@ -1074,6 +1079,7 @@ int cmCPackGenerator::DoPackage() std::string findExpr = tempDirectory; findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseListDirs(true); gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6cdda28..5ba639f 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,7 +13,6 @@ #include "cmCPackNSISGenerator.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" @@ -158,6 +157,28 @@ int cmCPackNSISGenerator::PackageFiles() installerIconCode.c_str()); } + if (this->IsSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) + { + std::string installerBitmapCode = + "!define MUI_WELCOMEFINISHPAGE_BITMAP \""; + installerBitmapCode += + this->GetOption("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP"); + installerBitmapCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE", + installerBitmapCode.c_str()); + } + + if (this->IsSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) + { + std::string installerBitmapCode = + "!define MUI_UNWELCOMEFINISHPAGE_BITMAP \""; + installerBitmapCode += + this->GetOption("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP"); + installerBitmapCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE", + installerBitmapCode.c_str()); + } + if(this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) { std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\"; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index d533af8..8940f54 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -13,7 +13,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 880663f..8fdc036 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -13,7 +13,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmGeneratedFileStream.h" diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 109dcb7..68b893f 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -14,7 +14,6 @@ #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmSystemTools.h" #include "cmMakefile.h" #include "cmCPackLog.h" diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index cb9cbc4..c08897f 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -18,7 +18,6 @@ #include "cmCPackGenerator.h" #include "cmake.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmCPackLog.h" @@ -200,12 +199,11 @@ int main (int argc, char const* const* argv) cmake cminst; cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); + cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); cmsys::auto_ptr<cmMakefile> globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> cmlg( - cmgg.CreateLocalGenerator(globalMF.get())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); #endif |