Mercurial > hg > aboriginal
comparison sources/more/record-commands.sh @ 897:850da666acc6
Redo command recording: no longer RECORD_COMMMANDS config entry, now sources/more/record-commands.sh run to set up the wrapper (either before or after host-tools.sh). General cleanup and simplification of code this interacted with, plus clean up bit rot in the reporting.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 21 Nov 2009 04:27:58 -0600 |
parents | |
children | 726cac165450 |
comparison
equal
deleted
inserted
replaced
896:edc150001472 | 897:850da666acc6 |
---|---|
1 #!/bin/bash | |
2 | |
3 source sources/include.sh || exit 1 | |
4 | |
5 # Build a wrapper that records each command line the build runs out of the | |
6 # host's $PATH, so we know exactly what commands the build uses. | |
7 | |
8 # (Note: this misses things called via absolute paths, such as the #!/bin/bash | |
9 # at the start of shell scripts.) | |
10 | |
11 echo "=== Setting up command recording wrapper" | |
12 | |
13 PATH="$OLDPATH" | |
14 blank_tempdir "$WRAPDIR" | |
15 blank_tempdir "$BUILD/logs" | |
16 | |
17 # Populate a directory of symlinks with every command in the $PATH. | |
18 | |
19 # For each each $PATH element, loop through each file in that directory, | |
20 # and create a symlink to the wrapper with that name. In the case of | |
21 # duplicates, keep the first one. | |
22 | |
23 echo "$PATH" | sed 's/:/\n/g' | while read i | |
24 do | |
25 ls -1 "$i" | while read j | |
26 do | |
27 ln -s wrappy "$WRAPDIR/$j" 2>/dev/null | |
28 done | |
29 done | |
30 | |
31 # Build the wrapper | |
32 $CC -Os "$SOURCES/toys/wrappy.c" -o "$WRAPDIR/wrappy" || dienow |