Boost logo

Boost-Build :

From: Bilokon, Paul (paul.bilokon_at_[hidden])
Date: 2008-06-04 12:04:42


Hi Jurko, Phillip,

This is what I ended up using. I haven't debugged this properly, and it's not platform-independent (tested on "NT"), but it kind of works in principle:

###

import common ;
import make ;
import path ;
import regex ;

rule copy-file ( source_file target_file )
{
    source_file = [ path.native $(source_file) ] ;
    target_file = [ path.native $(target_file) ] ;
    echo "Copying file '$(source_file)' to '$(target_file)'..." ;

    do-copy-file $(source_file) $(target_file) ;
    Depends all : $(target_file) ;
}

actions do-copy-file
{
    copy "$(1)" "$(2)"
}

rule make-dir ( new_dir )
{
    new_dir = [ path.native $(new_dir) ] ;
    echo "Creating directory: '$(new_dir)'..." ;

    local parent_dir = [ path.parent $(new_dir) ] ;

    do-make-dir $(new_dir) ;
    Depends all : $(new_dir) ;
}

actions do-make-dir
{
    mkdir "$(1)"
}

rule copy-dir-tree ( source : target )
{
    echo "Copying directory tree '$(source)' to '$(target)'..." ;

    make-dir $(target) ;

    local source_files = [ path.glob-tree $(source) : * ] ;
    for local source_file in $(source_files)
    {
        local source_rel_file = [ path.relative-to $(source) $(source_file) ] ;
        target_file = [ path.join $(target) $(source_rel_file) ] ;

        if ! [ CHECK_IF_FILE $(source_file) ]
        {
            # This is a directory
            make-dir $(target_file) ;
        }
        else
        {
            # This is not a directory
            copy-file $(source_file) $(target_file) ;
        }
    }
}

make-dir "Some Folder/FOO/BAR/BAZ/BLAH/FOO1/BAR1/BAZ1/BLAH1/FOO/BAR/BAZ/BLAH" ;

copy-dir-tree CopyMeDir : DestDir ;

###

Many thanks for your help,
Paul

-----Original Message-----
From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Jurko Gospodnetic
Sent: Wednesday, June 04, 2008 1:35 PM
To: boost-build_at_[hidden]
Subject: Re: [Boost-build] Suppressing Variant Directories

   Hi Paul.

> What about copying directory trees in Bjam? I can't get "install" to achieve this.

   You can use the install rule in combination with any of the globbing rules.

   For example:

install somewhereOverTheRainbow
:
     [ path.glob-tree gugu/gaga/data : *.* : .svn ] ;

   Hope this helps.

   Best regards,
     Jurko Gospodnetiæ

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk