On windows, I use the GnuWin32 tar package.  When I try to use the package task it gave me an error that windows cannot fork.  Looking online, I find this blog post http://blog.labnotes.org/2005/11/03/creating-zip-and-tar-packages-with-rake-on-windows/ which has the following

Creating a zip package worked on the first try, but tar complained that it 'Cannot fork: Function not implemented' . It turns out that Cygwin's tar can't run gzip. So once again, it's time to fix the Rake source code. This time we're talking about rake/packagetask.rb, line 117 that calls tar with the z option. I replaced that one line with a separate call to tar and gzip:

 sh %{tar cvf #{package_name}.tar #{package_name}} if flag == 'z'   sh %{gzip #{package_name}.tar} end

You'll need to be a bit more fancy if you want to support both .tar.gz and .tgz suffixes, but this little fix will allow you to create .tar.gz.


I did this and the package task worked.

On 11/7/06, Daniel Berger <[EMAIL PROTECTED]> wrote:


On 11/6/06, Jim Weirich <[EMAIL PROTECTED]> wrote:


Daniel Berger said:
> I do have gtar installed on this system, but I need a way to tell the
> GemPackageTask to use it.  Is there a way to do that?  If not, can we add
> it?

This is a reasonable request.  Got a patch?

Yep:

--- packagetask.orig    Mon Nov  6 12:28:05 2006
+++ packagetask.rb      Tue Nov  7 12:02:37 2006
@@ -68,6 +68,9 @@
     # List of files to be included in the package.
     attr_accessor :package_files
 
+    # Tar command used for gzipped or bzip2'd archives.  The default is 'tar'.
+    attr_accessor :tar_command
+
     # Create a Package Task with the given name and version.
     def initialize(name=nil, version=nil)
       init(name, version)
@@ -85,6 +88,7 @@
       @need_tar_gz = false
       @need_tar_bz2 = false
       @need_zip = false
+      @tar_command = 'tar'
     end
 
     # Create the tasks defined by this task library.
@@ -114,7 +118,7 @@
          task :package => ["#{package_dir}/#{file}"]
          file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
            chdir(package_dir) do
-             sh %{tar #{flag}cvf #{file} #{package_name}}
+             sh [EMAIL PROTECTED] #{flag}cvf #{file} #{package_name}}
            end
          end
        end
 
That's against 0.7.1, not CVS.  Let me know if that's a problem and I'll resubmit it.

Thanks,

Dan

_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel


_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to