[Cmake-commits] [cmake-commits] david.cole committed cmCPackPackageMakerGenerator.cxx 1.24 1.25 cmCPackPackageMakerGenerator.h 1.13 1.14

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jun 18 07:08:38 EDT 2008


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

Modified Files:
	cmCPackPackageMakerGenerator.cxx 
	cmCPackPackageMakerGenerator.h 
Log Message:
BUG: Workaround PackageMaker 3.0 issue for new CPack components feature. Thanks again to Doug Gregor for the patch.


Index: cmCPackPackageMakerGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackPackageMakerGenerator.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -C 2 -d -r1.24 -r1.25
*** cmCPackPackageMakerGenerator.cxx	17 Jun 2008 15:39:26 -0000	1.24
--- cmCPackPackageMakerGenerator.cxx	18 Jun 2008 11:08:33 -0000	1.25
***************
*** 70,76 ****
    (void) files; // TODO: Fix api to not need files.
    (void) toplevel; // TODO: Use toplevel
    // Create directory structure
-   std::string resDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
-   resDir += "/Resources";
    std::string preflightDirName = resDir + "/PreFlight";
    std::string postflightDirName = resDir + "/PostFlight";
--- 70,118 ----
    (void) files; // TODO: Fix api to not need files.
    (void) toplevel; // TODO: Use toplevel
+ 
+   std::string resDir; // Where this package's resources will go.
+   std::string packageDirFileName
+     = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+   if (this->Components.empty())
+     {
+     packageDirFileName += ".pkg";
+     resDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+     resDir += "/Resources";
+     }
+   else
+     {
+     packageDirFileName += ".mpkg";
+     if ( !cmsys::SystemTools::MakeDirectory(packageDirFileName.c_str()))
+       {
+       cmCPackLogger(cmCPackLog::LOG_ERROR,
+                     "unable to create package directory " 
+                     << packageDirFileName << std::endl);
+         return 0;
+       }
+ 
+     resDir = packageDirFileName;
+     resDir += "/Contents";
+     if ( !cmsys::SystemTools::MakeDirectory(resDir.c_str()))
+       {
+       cmCPackLogger(cmCPackLog::LOG_ERROR,
+                     "unable to create package subdirectory " << resDir 
+                     << std::endl);
+         return 0;
+       }
+ 
+     resDir += "/Resources";
+     if ( !cmsys::SystemTools::MakeDirectory(resDir.c_str()))
+       {
+       cmCPackLogger(cmCPackLog::LOG_ERROR,
+                     "unable to create package subdirectory " << resDir 
+                     << std::endl);
+         return 0;
+       }
+ 
+     resDir += "/en.lproj";
+     }
+ 
+ 
    // Create directory structure
    std::string preflightDirName = resDir + "/PreFlight";
    std::string postflightDirName = resDir + "/PostFlight";
***************
*** 125,130 ****
      {
      // Create the directory where component packages will be installed.
!     std::string basePackageDir = toplevel;
!     basePackageDir += "/packages";
      if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str()))
        {
--- 167,172 ----
      {
      // Create the directory where component packages will be installed.
!     std::string basePackageDir = packageDirFileName;
!     basePackageDir += "/Contents/Packages";
      if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str()))
        {
***************
*** 158,166 ****
  
    // Copy or create all of the resource files we need.
!   if ( !this->CopyCreateResourceFile("License")
!     || !this->CopyCreateResourceFile("ReadMe")
!     || !this->CopyCreateResourceFile("Welcome")
!     || !this->CopyResourcePlistFile("Info.plist")
!     || !this->CopyResourcePlistFile("Description.plist") )
      {
      cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
--- 200,208 ----
  
    // Copy or create all of the resource files we need.
!   if ( !this->CopyCreateResourceFile("License", resDir.c_str())
!        || !this->CopyCreateResourceFile("ReadMe", resDir.c_str())
!        || !this->CopyCreateResourceFile("Welcome", resDir.c_str())
!        || !this->CopyResourcePlistFile("Info.plist")
!        || !this->CopyResourcePlistFile("Description.plist") )
      {
      cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
***************
*** 169,214 ****
      }
  
-   std::string packageDirFileName
-     = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
    if (this->Components.empty())
      {
!     packageDirFileName += ".pkg";
!     }
!   else
!     {
!     packageDirFileName += ".mpkg";
!     if (this->PackageMakerVersion == 3.0)
        {
!       cmCPackLogger(cmCPackLog::LOG_ERROR,
!          "PackageMaker 3.0 cannot build component-based installations."
!          << std::endl << "Please use PackageMaker 2.5 instead." << std::endl);
        }
!     }
! 
!   cmOStringStream pkgCmd;
!   pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
!          << "\" -build -p \"" << packageDirFileName << "\"";
!   if (this->Components.empty())
!     {
!     pkgCmd << " -f \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY");
      }
    else
      {
!     pkgCmd << " -mi \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY")
!            << "/packages/";
!     }
!   pkgCmd << "\" -r \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY")
!          << "/Resources\" -i \""
!          << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/Info.plist\" -d \""
!          << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/Description.plist\"";
!   if ( this->PackageMakerVersion > 2.0 )
!     {
!     pkgCmd << " -v";
!     }
!   if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str()))
!     return 0;
! 
!   if (!this->Components.empty())
!     {
      WriteDistributionFile(packageDirFileName.c_str());
      }
--- 211,246 ----
      }
  
    if (this->Components.empty())
      {
!     // Use PackageMaker to build the package.
!     cmOStringStream pkgCmd;
!     pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
!            << "\" -build -p \"" << packageDirFileName << "\"";
!     if (this->Components.empty())
        {
!       pkgCmd << " -f \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY");
        }
!     else
!       {
!       pkgCmd << " -mi \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY")
!              << "/packages/";
!       }
!     pkgCmd << "\" -r \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY")
!            << "/Resources\" -i \""
!            << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") 
!            << "/Info.plist\" -d \""
!            << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") 
!            << "/Description.plist\"";
!     if ( this->PackageMakerVersion > 2.0 )
!       {
!       pkgCmd << " -v";
!       }
!     if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str()))
!       return 0;
      }
    else
      {
!     // We have built the package in place. Generate the
!     // distribution.dist file to describe it for the installer.
      WriteDistributionFile(packageDirFileName.c_str());
      }
***************
*** 332,336 ****
  
  //----------------------------------------------------------------------
! bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name)
  {
    std::string uname = cmSystemTools::UpperCase(name);
--- 364,369 ----
  
  //----------------------------------------------------------------------
! bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name,
!                                                           const char* dirName)
  {
    std::string uname = cmSystemTools::UpperCase(name);
***************
*** 362,369 ****
      }
  
!   std::string destFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
!   destFileName += "/Resources/";
    destFileName += name + ext;
  
  
    cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " 
--- 395,406 ----
      }
  
!   std::string destFileName = dirName;
!   destFileName += '/';
    destFileName += name + ext;
  
+   // Set this so that distribution.dist gets the right name (without
+   // the path).
+   this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(),
+                   (name + ext).c_str());
  
    cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " 
***************
*** 510,516 ****
           << "\" -build -p \"" << packageFile << "\""
           << " -f \"" << packageDir << "\""
!          << "-i \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") 
           << "/" << infoFileName << "\""
!          << "-d \"" << descriptionFile << "\""; 
    return RunPackageMaker(pkgCmd.str().c_str(), packageFile);
  }
--- 547,553 ----
           << "\" -build -p \"" << packageFile << "\""
           << " -f \"" << packageDir << "\""
!          << " -i \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") 
           << "/" << infoFileName << "\""
!          << " -d \"" << descriptionFile << "\""; 
    return RunPackageMaker(pkgCmd.str().c_str(), packageFile);
  }

Index: cmCPackPackageMakerGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackPackageMakerGenerator.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmCPackPackageMakerGenerator.h	17 Jun 2008 15:39:26 -0000	1.13
--- cmCPackPackageMakerGenerator.h	18 Jun 2008 11:08:33 -0000	1.14
***************
*** 53,57 ****
    virtual const char* GetOutputPostfix() { return "darwin"; }
  
!   bool CopyCreateResourceFile(const char* name);
    bool CopyResourcePlistFile(const char* name, const char* outName = 0);
  
--- 53,62 ----
    virtual const char* GetOutputPostfix() { return "darwin"; }
  
!   // Copies or creates the resource file with the given name to the
!   // package or package staging directory dirName. The variable
!   // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
!   // version of name) specifies the input file to use for this file,
!   // which will be configured via ConfigureFile.
!   bool CopyCreateResourceFile(const char* name, const char *dirName);
    bool CopyResourcePlistFile(const char* name, const char* outName = 0);
  



More information about the Cmake-commits mailing list