Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

Cheating header file dependencies with touch and checkin -ptime.

Posted by peeterjoot on March 19, 2010

In our build (DB2) we have some header files, that if changed will result in thousands of source files being recompiled. Sometimes you make a change to a header that you know doesn’t really require rebuilding everything. One way of cheating the build dependency system is to judiciously use the touch command to force the date backwards, as in

touch -t197301010000 /vbs/engn/include/sqleSmartArrayDefines.h
cleartool checkin -nc -ptime /vbs/engn/include/sqleSmartArrayDefines.h

An ls -l command after this will show the file time ‘1973-01-01’ (somewhat arbitrarily picked). Thirty five years or so should be early enough to not have make notice it;)

Since we use clearcase for our version control, a checkin of the file into your working branch will change the timestamp unless the -ptime option is used. Care has to be required if you are going to cheat, but I’ve seen people turning off all dependency checking in their build to try to avoid full builds after touching headers, so selecting cheating in a controlled fashion if you are going to do it is a much better option.

Another handy way to do this sort of cheating is ‘touch –reference’. This is a gnu-touch specific (ie: works on Linux) option, that allows you to specify the timestamp using a file instead of a hardcoded date, so you can match the file modification time to some previous point.


touch --reference sqle_ca_smart_array_cmd.h@@/main/temp_peeterj_db2_galileo_defect_saDeleteDebug/2 sqle_ca_smart_array_cmd.h

In this example, the checked out version (from clearcase) was touched to the predecessor version timestamp after making a change to just a comment that I didn’t want to rebuild everything for.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: