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

Discussion in 'Ruby' started by Ed Howland, Apr 4, 2006.

  1. Ed Howland

    Ed Howland Guest

    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, Apr 4, 2006
    #1
    1. Advertising

  2. Ed Howland

    Jim Weirich Guest

    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

    --
    Posted via http://www.ruby-forum.com/.
    Jim Weirich, Apr 4, 2006
    #2
    1. Advertising

  3. T24gNC80LzA2LCBKaW0gV2VpcmljaCA8amltQHdlaXJpY2hob3VzZS5vcmc+IHdyb3RlOgo+ICgy
    KSBJJ20gY29uc2lkZXJpbmcgYWRkaW5nIHN1cHBvcnQgZm9yIHRoZSBwdXJlLXJ1YnkgdGFyIGxp
    YnJhcnkgdG8KPiBidWlsZCB0aGUgdGFyZmlsZS4gIFRoaXMgd291bGQgYWxsb3cgdGhlIHBhY2th
    Z2UgdG8gYmUgYnVpbHQgb24gd2luZG93cwo+IG1hY2hpbmVzIHRoYXQgZG9uJ3QgYSB0YXIgcHJv
    Z3JhbS4gIEJ1dCBJJ20gbm90IHN1cmUgaWYgdGhlIHB1cmUgcnVieQo+IHRhciBsaWJyYXJ5IHN1
    cHBvcnRzIGEgLWggb3B0aW9uLiAgVGhhdCB3b3VsZCBoYXZlIHRvIGJlIHZlcmZpZmllZC4KCkkg
    aGF2ZSBiZWVuIGdpdmVuIGEgcGF0Y2ggZm9yIG1pbml0YXIgdGhhdCBpcyBzdXBwb3NlZCB0byBz
    dXBwb3J0CnN5bWxpbmtzLiBJIGhhdmUgbm90IGhhZCB0aW1lIHRvIHJldmlldyBvciBhcHBseSBp
    dCB5ZXQuCgpBZGRpdGlvbmFsbHksIGEgc2lnbmlmaWNhbnQgdXBncmFkZSB0byBtaW5pdGFyIG1h
    eSBiZSBpbiB0aGUgd29ya3MgaWYKc29tZXRoaW5nIGVsc2UgSSdtIHdvcmtpbmcgb24gcGFucyBv
    dXQuCgotYXVzdGluCi0tCkF1c3RpbiBaaWVnbGVyICogaGFsb3N0YXR1ZUBnbWFpbC5jb20KICAg
    ICAgICAgICAgICAgKiBBbHRlcm5hdGU6IGF1c3RpbkBoYWxvc3RhdHVlLmNhCg==
    Austin Ziegler, Apr 4, 2006
    #3
  4. Ed Howland

    Ed Howland Guest

    On 4/4/06, Jim Weirich <> 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 =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!
    > --
    > -- Jim Weirich
    >


    Ed
    Ed Howland, Apr 4, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nicholas Van Weerdenburg

    Rake::PackageTask

    Nicholas Van Weerdenburg, Dec 22, 2004, in forum: Ruby
    Replies:
    6
    Views:
    128
    Nicholas Van Weerdenburg
    Dec 22, 2004
  2. Leo --
    Replies:
    2
    Views:
    133
    Jim Weirich
    Jan 23, 2006
  3. warhero
    Replies:
    4
    Views:
    214
    James Britt
    Jan 11, 2007
  4. Don McClean

    Rake::Filelist and symbolic links

    Don McClean, Jul 2, 2007, in forum: Ruby
    Replies:
    0
    Views:
    107
    Don McClean
    Jul 2, 2007
  5. zyng
    Replies:
    1
    Views:
    141
    Andreas Leitgeb
    Feb 3, 2014
Loading...

Share This Page