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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
822a498b26a2cb7d1f0f2e7e37ce61b2?d=identicon&s=25 Ed Howland (Guest)
on 2006-04-04 18:06
(Received via mailing list)
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
10d4acbfdaccb4eee687a428ca00a5d8?d=identicon&s=25 Jim Weirich (weirich)
on 2006-04-04 19:43
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 Weirich
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-04-04 20:30
(Received via mailing list)
On 4/4/06, Jim Weirich <jim@weirichhouse.org> 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
822a498b26a2cb7d1f0f2e7e37ce61b2?d=identicon&s=25 Ed Howland (Guest)
on 2006-04-04 23:14
(Received via mailing list)
On 4/4/06, Jim Weirich <jim@weirichhouse.org> 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 Hibbs just taught us StL Rubyists how to use Rake. It is
great!
> --
> -- Jim Weirich
>

Ed
This topic is locked and can not be replied to.