[Scons-users] solving dependency cycle
Philipp Kraus
philipp.kraus at flashpixx.de
Sat Aug 18 05:00:33 EDT 2012
On 2012-08-17 19:06:12 +0200, Chris BeHanna said:
> On Aug 17, 2012, at 06:04 , Philipp Kraus <philipp.kraus at flashpixx.de> wrote:
>
>> On 2012-08-17 12:48:09 +0200, TOM TANNER (BLOOMBERG/ LONDON) said:
>>
>>> Thats not a dependency cycle per se. Please could you give us the full
>>> error message, as that shows you what the cycle is between.
>>> Also, how do you build x?
>>
>> [...snip...]
>>
>> I have create a builder for downloading source.tar.gz (in short)
>> dw=env.Download(target.tar.gz, http://....)
>> extract = env.Command(dw, "extractdir", "tar ... $SOURCE")
>>
>> and than I build with sources within the extract target a shared library like
>>
>> env.SharedLibrary( ..., sources=[ os.join.path(str(extract),
>> source1.cpp, str(extract), source2.cpp) ]
>>
>> This does not work, because scons reports that the sources are not
>> exists, imho I need a dependency between the
>> source file and the "extract-target", which I have set with Depends and
>> this creates the dependency cycle error.
>>
>> The parts for download and extracting works well and create a correct graph:
>> +-library/jsoncpp-src-0.5.0 //1
>> +-library/jsoncpp-src-0.5.0.tar.gz
>> | +-http://sourceforge.net/projects/jsoncpp/files/latest/download
>> +-/usr/bin/tar
>>
>> The parts for building the shared library works also well (if the
>> sources exists). So I need the connection
>> between //1 and the env.SharedLibrary call
>
> I think Tom had it right. When you build a tarball extractor, your
> emitter MUST filter out all directory objects, returning only files, or
> else you end up with phony dependencies from the extracted directories.
>
> I have one that works, but I do not (yet) have permission to contribute it.
Yes, your're right, a night sleeping about the problem can help :-)
My opinion was a little short, I have hoped I can create a "pseudo
target / alias" like
Alias("helper", [a,b,c])
and than setup the dependency between my env.SharedLib and this alias.
Is my understanding correct if I write my own emitter, that write a
builder, which calls my extractor command (like tar, winrar, winzip or
7z)
and in my emitter function I need only to extract the files /
directories of the archiv? I don't think so, I need a scanner _and_ an
emitter.
I have got some understanding problems in which way emitter, builder,
scanner works:
The emitter builds my dependency graph, so it calls on each builder
object the emitter function which analysere the sources and creates a
corresponding target list.
So after all emitters are run, I have got the full dependency graph and
than checks scons on each node wich must be build and calls the builder
function.
The scanner is like a filter, so it opens the sources files and extract
other nodes that are needed for the building process.
Is this correct?
So the emitter is the "glue" between sources and targets, the scanner
creates the list for the emitter process and the builder run for
finishing over the data
In my case I need a scanner, that gets the list of the data within the
archiv file and an emitter which connects the tar.gz with the scanner's
output.
I run in Scons for extracting the tar.gz data an external tool, so I
need something like os.system / subprocess / env.Command. How can I grep
the output of the command, is there a typicall scons way?
Thanks for your greate answer
Phil
More information about the Scons-users
mailing list