Hi Bill,

On Tue, Apr 1, 2008 at 4:00 PM, Bill Hoffman <[EMAIL PROTECTED]> wrote:
> Mathieu Malaterre wrote:
>
>  > Ok, found the issue (*). There is an empty line. I am guessing that
>  > there is a duplicate \n in the CPACK_DEBIAN_PACKAGE_ARCHITECTURE line.
>  > This can easily be fixed applying this patch (**). Bill do you think
>  > this is enough for cmake 2.6.0 or do you want the full patch that make
>  > sure that CPACKE_DEBIAN* entry are all single line ?
>  >
>
>  I just did a commit:
>
>  [EMAIL PROTECTED] ~/My Builds/CMake/Modules
>  $ cvs commit -m "ENH: remove trailing space " CPackDeb.cmake
>
> /cvsroot/CMake/CMake/Modules/CPackDeb.cmake,v  <--  CPackDeb.cmake
>  new revision: 1.13; previous revision: 1.12
>
>  Let me know if this works, and I will move it to the 2.6 branch.

Yup, works perfectly for me ! thanks

If possible I would like another patch to be applied to the 2.6.0
branch. There is currently no way to add 'extra' script typically very
debian specific. For instance I am packaging a daemon and during the
install process I'd like that the daemon be automatically started
(which is very OS specific). To handle that I need to be able to
specify extra file that are neither target, not installed file (no
cpack do not see them).

I have implemented a solution (see attached patch).

thanks again !


-- 
Mathieu
Index: Source/CPack/cmCPackDebGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackDebGenerator.cxx,v
retrieving revision 1.21
diff -u -r1.21 cmCPackDebGenerator.cxx
--- Source/CPack/cmCPackDebGenerator.cxx	29 Mar 2008 00:23:01 -0000	1.21
+++ Source/CPack/cmCPackDebGenerator.cxx	1 Apr 2008 14:15:47 -0000
@@ -200,6 +200,33 @@
   cmd = "\"";
   cmd += cmakeExecutable;
   cmd += "\" -E tar cfz control.tar.gz ./control ./md5sums";
+  const char* control_extra = 
+    this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA");
+  if( control_extra )
+    {
+    // copy/paste from cmTarget.cxx
+    std::string depline = control_extra;
+    std::string::size_type start = 0;
+    std::string::size_type end;
+    end = depline.find( ";", start );
+    while( end != std::string::npos )
+      {
+      std::string l = depline.substr( start, end-start );
+      std::string filenamename = cmsys::SystemTools::GetFilenameName(l);
+      std::string localcopy = toplevel;
+      localcopy += "/";
+      localcopy += filenamename;
+      // if we can copy the file, it means it does exist, let's add it:
+      if( cmsys::SystemTools::CopyFileIfDifferent(l.c_str(), localcopy.c_str()) )
+        {
+        // debian is picky and need relative to ./ path in the tar.gz
+        cmd += " ./";
+        cmd += filenamename;
+        }
+      start = end+1; // skip the ;
+      end = depline.find( ";", start );
+      }
+    }
   res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
     &retVal, toplevel, this->GeneratorVerbose, 0);
 
Index: Modules/CPackDeb.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CPackDeb.cmake,v
retrieving revision 1.13
diff -u -r1.13 CPackDeb.cmake
--- Modules/CPackDeb.cmake	1 Apr 2008 13:56:41 -0000	1.13
+++ Modules/CPackDeb.cmake	1 Apr 2008 14:15:47 -0000
@@ -88,6 +88,17 @@
 # Suggests:
 # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
 
+# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
+# Typical examples are: 
+# - conffiles
+# - postinst
+# - postrm
+# - prerm"
+# Usage:
+# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 
+#    "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
+
 
 # For debian source packages:
 # debian/control
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to