hijacking .sconsign

I have a lot of functional tests for SCons processes. At some moment, I improved one of the first steps in the process. As result, now most tests fail due to "rebuilding `file' because the contents of the build action changed". It's impossible to re-made the tests. Instead, I decided to correct information in the .sconsign files.

Quick look into the SCons source code revealed that .sconsign is created using cPickle module. Then I wrote a Python program to convert .sconsign to ASCII:

""" Convert pickle data (for example, in .sconsign) from binary to ASCII """
import pickle
import sys

for f in sys.argv[1:]:
  print f
  o = pickle.load(open(f))
  pickle.dump(o, open(f, 'w'), 0)

Now, there are step-by-step instructions how to repair a corrupted test.

1. Make a copy of the test

cp -r before/ x

In this example, before is the folder with the test, x is the folder for the copy.

2. Convert all .sconsign files to ASCII:

find . -name .sconsign | xargs python .../pickle2ascii.py

3. Run SCons over the copy and re-convert to ASCII:

cd x; scons
find . -name .sconsign | xargs python .../pickle2ascii.py

4. Compare the new and original .sconsign files

for i in `find . -name .sconsign`; do diff -u $i ../before/$i; done

5.-X.

Decide what to do further. In my case, as I want to correct build signatures, I check for changed bsig fields.

Categories: consodoc

Updated: