[Scons-users] Recursive Install/Copy after each successful build.

Stijn De Ruyck Stijn.DeRuyck at onsemi.com
Thu Dec 11 12:37:55 EST 2014


Hi,

I would like to let SCons copy some directories to another location after each successful build (and have them cleaned when appropriate).

Situation:

-          build/<debug, release, coverage> (build output dir, .o files)

-          dist/<debug, release, coverage> (executable output dir)

-          etc/, doc/, sourcedirs, ...

-          one file in etc/ depends on another target in one of the sourcedirs (generated file, using custom builder). So this copy can only run AFTER that builder has run.

-          etc/ contains A LOT of files in A LOT of subdirectories

I would like to turn dist/<debug, release, coverage>  into a complete distributable package by copying etc (actually only certain etc subdirs) & doc to dist after each successful build.

I tried Install()
=> but this is not recursive. It is impossible to list each file manually. Etc contains too many files.

I tried Install() with Glob
=>  but this is not recursive either.

I tried Install() with my own recursive Glob (one that I also use to feed my .cc files to the builders),
=> but this installs all files in subdirectories and ALSO into the root target directory for some reason... (etc/some/sub/dir/file.txt => dist/etc/some/sub/dir/file.txt AND dist/debug/file.txt)

I tried Command()+Copy() builder, like so: env.Command("dist/debug/etc/testers/", "etc/testers/", Copy("$TARGET", "$SOURCE"))
=> dependencies between individual files aren't set up (change etc/testers/file.txt does not trigger a re-copy)
=> the target files & directories never get cleaned

I tried Command() + "shell" builder, like so: env.Command("dist/debug/etc/testers/", "etc/testers/", "cp -R etc/testers/ dist/debug/etc/testers")
=> same as above

I tried the above + added env.Clean(".","dist/debug/etc/testers/").
=> Targets get cleaned, but there's still the dependency problem.

I tried the RecursiveInstaller() I found on http://xtargets.com/2010/04/21/recursive-install-builder-for-scons/
=> dependencies ok, recopy when necessary.
=> Target files get cleaned, but empty subdirs get left behind...
=> instead of printing a single line for an entire recursive copy like the above Commands did, SCons prints an "Install file: ..." line for each and every file to standard output. Because there are so many files, "normal" SCons output gets pushed of the screen. Same when cleaning.

In all workflows, the copied files are also stored in the cache. I don't want that. Our cache is big enough as it is and I don't see any benefit in storing these kinds of files in the cache. But env.NoCache() requires me to list each individual file again...


TLDR;
I just want to run some copies from etc to dist/debug/etc AFTER the program is successfully built.
- This would cover the dependency problem because I would just recopy the entire directories after each successful build, changed files or not... Not efficient, but fast enough. I could even just use symlinks. Also because the copy would run as final step, I'm always sure that I don't copy that one auto-generated file in etc too early.
- The thousands of files in etc are left out of SCons' dependency tree, speeding things up.
- This also covers the "standard output flooding" problem of RecursiveInstaller() and env.Clean()
- And finally this would also cover the "cache fill problem".

Any ideas?
Thank you,

Stijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141211/d0c0ef75/attachment-0001.html>


More information about the Scons-users mailing list