timestamp oddities

Ken Moffat zarniwhoop73 at googlemail.com
Sat May 1 16:51:22 PDT 2010


I've finally taken the plunge, reworked my build scripts (LFS and my
full desktop) to be less monolithic, and put them into git to keep
tabs on what changes.

 I've long used the "touch a file, untar the package and build and
install it, then look for files newer than the file I touched"  approach
 o recording what gets installed.  But of course this misses things
(typically documentation, licenses, headers that are "installed as
shipped").

 I thought I could do better, so I came up with a 'touchall' function to
recursively touch all files in a package (for gcc and glibc a similar
process seems to happen before release, so it looked like a winner).

 Turns out there are just too many idiosyncratic build systems that
require exceptions (by the time I couldn't fix 'bc' other than by
going to the alpha version, I realised this approach would require
too much maintenance long-term), so I've dropped back to only
touching headers and manpages - other docs might not be logged,
but they should hopefully be in directories specific to the package.
Still not a panacea (Python broke *again*), but manageable.

But while I was still ploughing on with 'touchall' I discovered that
I was only getting minimal logs from a python package and a perl
package.  After a lot of head scratching, 'ls --full-time' was my
friend :  When I touch a file, it has decimals of a second in the
time (this is on ext4).  But when I touch it in a construct like
  find . !  -name 'foo' -a ! -name 'bar' | xargs touch
(the actual version had a lot more tests to avoid specific regexps)
the timestamp has the decimals of the second truncated.  I guess
that's maybe a bash problem, but wherever the problem lies, I
needed something that worked now.

 So, I tried touching the "marker" file a second ago:
touch --date='1 second ago' filename

 This helped, because even the files with truncated seconds now
showed up as newer.

 Unfortunately, both of these packages took next to no time to
untar and install.  So, for the first package everything showed up
in the log.  And for the second package, all its own files, plus some
of the files from the *first* package showed up!

 Solved this, at the cost of a slight delay in the overall script,
by making sure that when I find the installed files, if the time
spent running 'find' is less than a second, I sleep for a full second.

  If anybody cares, I'll be putting my current buildscripts online
"soon"ish, but I thought I ought to record this.

ĸen
-- 
After tragedy, and farce, "OMG poneys!"



More information about the lfs-chat mailing list