[bcp] Enhancements to bcp extract and namespace rename

John, as promised, here's a couple of enhancement requests to bcp, relative to namespace renaming. I know time can be (very) limited, so I'll help in any way I can, or maybe we can see if someone is looking for a relatively small contribution they can make to Boost, in a useful utility. I can file trac tickets, if you'd like (I haven't before, so will need to look at the process). First, a statement of project needs (and I would expect others have similar needs): --- My workgroup provides software libraries (using Boost) to another group (this is within a large aerospace company in the Seattle area) that also uses Boost. Unfortunately the Boost versions can be (and typically are) different. Both sets of software (libraries) are compiled into the same executable. The namespace rename feature of bcp allows multiple versions of Boost to co-exist in the same executable. The one restriction is that for a given translation unit (.cpp file), the same version of Boost must be used. (I know Artyom, I believe, also has a tool that allows multiple versions of Boost even in the same translation unit, but this is not something we need, and I would guess is a corner case for most developers.) Enhancement requests: -- I couldn't find a way to "wildcard" extract and rename all Boost libraries. I ended up performing the extract / rename one-by-one. I suppose I could generate a list of the libraries and compose an invocation of bcp with all libraries explicitly listed (assuming command line buffers won't be exhausted), or write a script to do this, but it seems that it wouldn't be hard for bcp to do it inside the code. -- Related to above, when extracting (and renaming) one-by-one, the same dependent libraries are copied out (and overwritten) over and over. With a "wildcard" (or "full list of libraries") I assume that shared dependent libraries would only be copied once. -- Related to above, if there's a "full copy, rename namespace for all libraries" facility, managing multiple shared dependent libraries becomes a moot point, since all libraries will be copied (dependent or not). And related to this is copying the few remaining non-source files that make up a release. So it comes down to using bcp not to extract a subset of dependent libraries, but instead to perform a full copy of a release, renaming namespaces in source code as appropriate. What do you think? Again, thanks for the quick and excellent help, Cliff

On 08/04/2010 09:12 PM, Cliff Green wrote:
-- I couldn't find a way to "wildcard" extract and rename all Boost libraries.
Have you tried to put only the top level boost directory path in the module list, something like:
cd /repo/boost bcp --namespace=boost144 --namespace-alias . /tmp/boost144
note: do this on a clean boost download as it scans/copies all files recursively and will take a long time if you have done build and test. Or if you have a svn working directory, you can do
bcp --svn --namespace=boost144 --namespace-alias . /tmp/boost144
and it will only consider known to svn. -- Bjørn

Enhancement requests:
-- I couldn't find a way to "wildcard" extract and rename all Boost libraries. I ended up performing the extract / rename one-by-one. I suppose I could generate a list of the libraries and compose an invocation of bcp with all libraries explicitly listed (assuming command line buffers won't be exhausted), or write a script to do this, but it seems that it wouldn't be hard for bcp to do it inside the code.
Just use "." as the libraryname/path to copy and everything will get copied, or you could use "boost" which would copy all the headers, plus their source file dependencies, but not tests/docs/tools. In general you can use any path into a subset of boost as the thing to copy, you can also specify multiple libraries or paths to be copied on the one command line, and then the dependency tree only gets built and copied once # copy two libraries at once: bcp thread regex my_destination # copy everything at once: bcp . my_destination # copy headers and source only: bcp boost my_destination # copy all libraries, including tests and docs, but no tools: bcp libs my_destination Does this help? Cheers, John.

From: "John Maddock" <boost.regex@virgin.net>
Just use "." as the libraryname/path to copy and everything will get copied, or you could use "boost" which would copy all the headers, plus their source file dependencies, but not tests/docs/tools. In general you can use any path into a subset of boost as the thing to copy, you can also specify multiple libraries or paths to be copied on the one command line, and then the dependency tree only gets built and copied once
# copy two libraries at once: bcp thread regex my_destination
# copy everything at once: bcp . my_destination
# copy headers and source only: bcp boost my_destination
# copy all libraries, including tests and docs, but no tools: bcp libs my_destination
Does this help?
Definitely - I should have thought of "." immediately after trying "*". :) These examples above would be great to add to the examples documentation of bcp. There are a couple of libraries with errors in the latest release beta, but I'll reply to the other bcp namespace rename thread in a couple of minutes with details. Cliff
participants (3)
-
Bjørn Roald
-
Cliff Green
-
John Maddock