[Scons-users] scons checking targets actually built?

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Fri Apr 19 07:05:29 EDT 2013


I must say I'd really like to see scons do this check (that the targets actually exist at the end of the build rule).

It would be a great help in tracking down broken build rules (and I've had more than a few in my time). It's more difficult to get this wrong in scons than in make, but it's still possible and it is a nightmare to track down.

And it presumably wouldn't be an expensive check to see if the file at least exists.

----- Original Message -----
From: scons-users at scons.org
To: scons-users at scons.org
At: Apr 19 2013 02:00:59


Ah... makes sense, I suppose. I just figured that with scons computing md5 hashes of sources to determine target freshness, it would have noticed that the source was missing when attempting to build the dependent target, but I suppose that's not going to be the case on the initial build because the target has never been built, so there's no "freshness" to compute.


On Thu, Apr 18, 2013 at 7:49 PM, Gary Oberbrunner <garyo at oberbrunner.com> wrote:


Hi Robert; some people make fake targets in SCons (like Make) so if SCons complained about those people's builds would probably break. I think it's expected behavior at least in that case.
On Apr 18, 2013 7:13 PM, "robert zeigler" <robert.zeigler at gmail.com> wrote:

Hi,

Fairly new to scons. I have been playing with it the last few days and like what I see. However, I stumbled on behavior today that has me troubled.

Consider a very simple build script:

Command(['a.txt'],[],"echo hi > $TARGET")
Command(['b.txt'],['a.txt'],"cat $SOURCE > $TARGET && echo foo >> $TARGET")

This runs fine:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
echo hi > a.txt
cat a.txt > b.txt && echo foo >> b.txt
scons: done building targets.

Now consider an alternative command for building a:

Command(['a.txt'],[],"echo hi > $TARGET && rm $TARGET")

Then you get:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
echo hi > a.txt && rm a.txt
cat a.txt > b.txt && echo humbug >> b.txt
cat: a.txt: No such file or directory
scons: *** [b.txt] Error 1
scons: building terminated because of errors.

The build fails, of course, but what troubles me is that it doesn't fail until we attempt to build b.txt. I would have expected scons to verify that the target was actually build by the command; failing that, I'm surprised that it attempted to build b.txt when a.txt was clearly not present for b.txt to be built?

Clarification on this is greatly appreciated. Although the case above is trivial, I ran into this issue in a non-trivial case, as well.

Robert
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users



_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8956135232485002.txt
Type: application/octet-stream
Size: 149 bytes
Desc: not available
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20130419/214da383/attachment.obj>


More information about the Scons-users mailing list