[cmake-commits] hoffman committed cmCPackPackageMakerGenerator.cxx 1.22 1.23 cmCPackPackageMakerGenerator.h 1.11 1.12

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 19 14:26:22 EST 2008


Update of /cvsroot/CMake/CMake/Source/CPack
In directory public:/mounts/ram/cvs-serv11173/Source/CPack

Modified Files:
	cmCPackPackageMakerGenerator.cxx 
	cmCPackPackageMakerGenerator.h 
Log Message:
ENH: install working with symlink qt tool


Index: cmCPackPackageMakerGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackPackageMakerGenerator.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cmCPackPackageMakerGenerator.cxx	17 Dec 2007 20:27:30 -0000	1.22
+++ cmCPackPackageMakerGenerator.cxx	19 Feb 2008 19:26:19 -0000	1.23
@@ -38,6 +38,22 @@
 {
 }
 
+int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir,
+                                                    const char* script,
+                                                    const char* name)
+{
+  std::string dst = resdir;
+  dst += "/";
+  dst += name;
+  cmSystemTools::CopyFileAlways(script, dst.c_str());
+  cmSystemTools::SetPermissions(dst.c_str(),0777);
+  cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+                "copy script : " << script << "\ninto " << dst.c_str() << 
+                std::endl);
+
+  return 1;
+}
+
 //----------------------------------------------------------------------
 int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
   const char* toplevel,
@@ -50,15 +66,51 @@
   resDir += "/Resources";
   std::string preflightDirName = resDir + "/PreFlight";
   std::string postflightDirName = resDir + "/PostFlight";
-
-  if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())
-    || !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()) )
+  const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT");
+  const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT");
+  const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT");
+  // if preflight or postflight scripts not there create directories
+  // of the same name, I think this makes it work
+  if(!preflight)
     {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-      "Problem creating installer directories: "
-      << preflightDirName.c_str() << " and "
-      << postflightDirName.c_str() << std::endl);
-    return 0;
+    if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()))
+      {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+                    "Problem creating installer directory: "
+                    << preflightDirName.c_str() << std::endl);
+      return 0;
+      }
+    }
+  if(!postflight)
+    {
+    if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()))
+      {
+      cmCPackLogger(cmCPackLog::LOG_ERROR,
+                    "Problem creating installer directory: "
+                    << postflightDirName.c_str() << std::endl);
+      return 0;
+      }
+    }
+  // if preflight, postflight, or postupgrade are set 
+  // then copy them into the resource directory and make
+  // them executable
+  if(preflight)
+    {
+      this->CopyInstallScript(resDir.c_str(),
+                              preflight,
+                              "preflight");
+    }
+  if(postflight)
+    {
+      this->CopyInstallScript(resDir.c_str(),
+                              postflight,
+                              "postflight");
+    }
+  if(postupgrade)
+    {
+      this->CopyInstallScript(resDir.c_str(),
+                              postupgrade,
+                              "postupgrade");
     }
 
   if ( !this->CopyCreateResourceFile("License")

Index: cmCPackPackageMakerGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackPackageMakerGenerator.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cmCPackPackageMakerGenerator.h	5 Nov 2007 21:55:45 -0000	1.11
+++ cmCPackPackageMakerGenerator.h	19 Feb 2008 19:26:19 -0000	1.12
@@ -39,6 +39,9 @@
   virtual ~cmCPackPackageMakerGenerator();
 
 protected:
+  int CopyInstallScript(const char* resdir,
+                        const char* script,
+                        const char* name);
   virtual int InitializeInternal();
   int CompressFiles(const char* outFileName, const char* toplevel,
     const std::vector<std::string>& files);



More information about the Cmake-commits mailing list