bjem
bjem

Reputation: 195

scons: Unnecessarily rebuilds files during the first time-stamp only build

I am doing a timestamp-only build to bulk convert image files. Many of the converted image files already exist, but I like to make sure that they are all checked through each time.

How come SCons requires a database file (.sconsign.dblite) that it uses for MD5 hash data when it's instructed (via env.Decider("timestamp-newer")) to only deal with timestamps? It shouldn't need to keep a database between builds for timestamps because all the information is associated with the files themselves.

If the dblite database doesn't exist SCons reconverts all the images regardless of whether their timestamps imply they need to be rebuilt or not. The title is an example message I get when the dblite database does not exist.

If anyone can explain this I'd really appreciate it. I love the functional programming with Python, but SCons itself is not quite doing it for me at the moment.

Upvotes: 3

Views: 885

Answers (4)

bdbaddog
bdbaddog

Reputation: 3511

I think your question is really about why there's a .sconsign.dblite when you set the decider to just check timestamp.

One reason is that it allows SCons to keep track of the method used to produce each target. If that changes, even if the timestamp doesn't, it should rebuild the affected targets.

Have you tried building a single file, and then using the sconsign utility to examine the contents of the .sconsign.dblite file?

Upvotes: 0

Yes, I'm trying to work out the same thing, but I'm doing bulk conversion of video files which takes several days if done unnecessarily. I've already done most of it.

So I want a way to tell SCons, "For files that exist now, store their existing timestamps/MD5s, and don't rebuild unless that changes in future."

Will report back if I find a way...

Upvotes: 1

bjem
bjem

Reputation: 195

I finally got this sorted. Brady was right about how to use SCons, but I a few days ago I eventually worked out you can also control exactly what you want built by just controlling what build commands are issued in the first place. In my case I ignored any image files for which the target file already exists using os.path.exists().

Sounds simple, but it is a conceptual difference between SCons and make, because make does not save its state between builds in the way SCons does.

Upvotes: 1

Brady
Brady

Reputation: 10357

Using "timestamp-newer", SCons actually stores the timestamp info. You can see why here:

Using Time Stamps to Decide If a File Has Changed

Try using "timestamp-match" instead.

Upvotes: 2

Related Questions