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

E

Ed Howland

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
 
J

Jim Weirich

Ed said:
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.
 
A

Austin Ziegler

T24gNC80LzA2LCBKaW0gV2VpcmljaCA8amltQHdlaXJpY2hob3VzZS5vcmc+IHdyb3RlOgo+ICgy
KSBJJ20gY29uc2lkZXJpbmcgYWRkaW5nIHN1cHBvcnQgZm9yIHRoZSBwdXJlLXJ1YnkgdGFyIGxp
YnJhcnkgdG8KPiBidWlsZCB0aGUgdGFyZmlsZS4gIFRoaXMgd291bGQgYWxsb3cgdGhlIHBhY2th
Z2UgdG8gYmUgYnVpbHQgb24gd2luZG93cwo+IG1hY2hpbmVzIHRoYXQgZG9uJ3QgYSB0YXIgcHJv
Z3JhbS4gIEJ1dCBJJ20gbm90IHN1cmUgaWYgdGhlIHB1cmUgcnVieQo+IHRhciBsaWJyYXJ5IHN1
cHBvcnRzIGEgLWggb3B0aW9uLiAgVGhhdCB3b3VsZCBoYXZlIHRvIGJlIHZlcmZpZmllZC4KCkkg
aGF2ZSBiZWVuIGdpdmVuIGEgcGF0Y2ggZm9yIG1pbml0YXIgdGhhdCBpcyBzdXBwb3NlZCB0byBz
dXBwb3J0CnN5bWxpbmtzLiBJIGhhdmUgbm90IGhhZCB0aW1lIHRvIHJldmlldyBvciBhcHBseSBp
dCB5ZXQuCgpBZGRpdGlvbmFsbHksIGEgc2lnbmlmaWNhbnQgdXBncmFkZSB0byBtaW5pdGFyIG1h
eSBiZSBpbiB0aGUgd29ya3MgaWYKc29tZXRoaW5nIGVsc2UgSSdtIHdvcmtpbmcgb24gcGFucyBv
dXQuCgotYXVzdGluCi0tCkF1c3RpbiBaaWVnbGVyICogaGFsb3N0YXR1ZUBnbWFpbC5jb20KICAg
ICAgICAgICAgICAgKiBBbHRlcm5hdGU6IGF1c3RpbkBoYWxvc3RhdHVlLmNhCg==
 
E

Ed Howland

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 =3D 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!
Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top