Rake's PackageTask should have tar -h for symbolic links

Hi,

I have a need to have Rake::PackageTask implement the -h option on tar
+gz and bz2. This would allow for tar to include any linked
files/folders. The workaround is to cp -r the entire contents of the
linked dir. This is klunky at best.

Any chance of this? Any other workarounds?

Thanks
Ed

Ed Howland wrote:

Hi,

I have a need to have Rake::PackageTask implement the -h option on tar
+gz and bz2. This would allow for tar to include any linked
files/folders. The workaround is to cp -r the entire contents of the
linked dir. This is klunky at best.

Any chance of this? Any other workarounds?

Two issues:

(1) Rake actually makes a copy of the directory and tars that up. That
way the tar file will not accidently pick up non-package files that
might be laying around. It will use hard links on Unix do keep the disk
space usage down (Windows, however, uses a full copy). Any symbolic
links would have to be added to that copied directory structure for the
package task to pick it up.

(2) I’m considering adding support for the pure-ruby tar library to
build the tarfile. This would allow the package to be built on windows
machines that don’t a tar program. But I’m not sure if the pure ruby
tar library supports a -h option. That would have to be verfified.

I’m open to patches for supporting the -h option given the above
constraints.


– Jim W.

On 4/4/06, Jim W. [email protected] wrote:

(2) I’m considering adding support for the pure-ruby tar library to
build the tarfile. This would allow the package to be built on windows
machines that don’t a tar program. But I’m not sure if the pure ruby
tar library supports a -h option. That would have to be verfified.

I have been given a patch for minitar that is supposed to support
symlinks. I have not had time to review or apply it yet.

Additionally, a significant upgrade to minitar may be in the works if
something else I’m working on pans out.

-austin

On 4/4/06, Jim W. [email protected] wrote:

Ed Howland wrote:
Two issues:

(1) Rake actually makes a copy of the directory and tars that up. That
way the tar file will not accidently pick up non-package files that
might be laying around. It will use hard links on Unix do keep the disk
space usage down (Windows, however, uses a full copy). Any symbolic
links would have to be added to that copied directory structure for the
package task to pick it up.

The workaround I came up with does the copy, but at the time time of
Rake’s copy:

require ‘find’
Rake::PackageTask.new(“mytarball”, “3-31-2006”) do |p|
p.need_tar_gz = true
Find.find(‘mydir’) do |path|
p.package_files << path
end
end

It works on any symbolic links by just recursing down the other tree
and adding pathnames to the package’s file list. So it minimizes the
disk space usage to only what Rake uses.

(2) I’m considering adding support for the pure-ruby tar library to
build the tarfile. This would allow the package to be built on windows
machines that don’t a tar program. But I’m not sure if the pure ruby
tar library supports a -h option. That would have to be verfified.

I’m open to patches for supporting the -h option given the above
constraints.

That would be nice. Would using the pure-ruby tar library in Rake
avoid the need to do the copy to pkg/? My Rakefile tasks leave
everything in a final folder to be tarballed. It seems an unneccesary
step to create the pkg directory and copy everything in there. Could
an option be added to PackageTask to just tar an existing dir?

BTW, Curt H. just taught us StL Rubyists how to use Rake. It is
great!


– Jim W.

Ed