[ed0a142] | 1 | #!/bin/bash
|
---|
| 2 | # $Id$
|
---|
[d057075] | 3 |
|
---|
| 4 | # Acknowledgment:
|
---|
| 5 | # The following code is a modified version of an original work written by
|
---|
| 6 | # Greg Schafer for the "DIY Linux" project and is included here with his
|
---|
| 7 | # permission.
|
---|
| 8 | # ref: http://www.diy-linux.org
|
---|
| 9 | #
|
---|
| 10 |
|
---|
[ed0a142] | 11 | set -e
|
---|
| 12 |
|
---|
[eddf89f5] | 13 | : <<inline_doc
|
---|
| 14 | desc: prepare current iteration files for ICA report
|
---|
| 15 | usage: do_ica_prep $DEST_ICA/$ITERATION
|
---|
| 16 | input vars: $1 directory where files from current iteration are stored
|
---|
| 17 | externals: --
|
---|
| 18 | modifies: --
|
---|
| 19 | returns: --
|
---|
| 20 | on error:
|
---|
| 21 | on success:
|
---|
| 22 | inline_doc
|
---|
| 23 |
|
---|
[7fa1d20] | 24 | CMP_DIR=$1
|
---|
[d057075] | 25 |
|
---|
[5bcccc1] | 26 | # Run ica_prep if it hasn't been done already
|
---|
| 27 | if [ ! -f "$CMP_DIR/icaprep" ]; then
|
---|
[d057075] | 28 |
|
---|
[5bcccc1] | 29 | echo -n "Removing symbolic links in ${CMP_DIR}... "
|
---|
| 30 | find $CMP_DIR -type l | xargs rm -f
|
---|
| 31 | echo "done."
|
---|
[d057075] | 32 |
|
---|
[5bcccc1] | 33 | echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
|
---|
| 34 | find $CMP_DIR -name '*.gz' | xargs gunzip
|
---|
| 35 | echo "done."
|
---|
[d057075] | 36 |
|
---|
[5bcccc1] | 37 | #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
|
---|
| 38 | #find $CMP_DIR -name '*.bz2' | xargs bunzip2
|
---|
| 39 | #echo "done."
|
---|
[d057075] | 40 |
|
---|
[5bcccc1] | 41 | # ar archives contain date & time stamp info that causes us
|
---|
| 42 | # grief when trying to find differences. Here we perform some
|
---|
| 43 | # hackery to allow easy diffing. Essentially, replace each
|
---|
| 44 | # archive with a dir of the same name and extract the object
|
---|
| 45 | # files from the archive into this dir. Despite their names,
|
---|
| 46 | # libieee.a & libmcheck.a are not actual ar archives.
|
---|
| 47 | echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
|
---|
| 48 | L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
|
---|
| 49 | for F in $L; do
|
---|
| 50 | mv $F ${F}.XX
|
---|
| 51 | mkdir $F
|
---|
| 52 | cd $F
|
---|
| 53 | BN=${F##*/}
|
---|
| 54 | ar x ../${BN}.XX || {
|
---|
| 55 | echo -e "\nError: ar archive extraction failed!\n" >&2
|
---|
| 56 | exit 1
|
---|
| 57 | }
|
---|
| 58 | rm -f ../${BN}.XX
|
---|
| 59 | done
|
---|
| 60 | echo "done."
|
---|
[d057075] | 61 |
|
---|
[5bcccc1] | 62 | echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
|
---|
| 63 | find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
|
---|
| 64 | echo "done."
|
---|
[d057075] | 65 |
|
---|
[5bcccc1] | 66 | echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
|
---|
| 67 | find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
|
---|
| 68 | echo "done."
|
---|
[d057075] | 69 |
|
---|
[5bcccc1] | 70 | # We're all done
|
---|
| 71 | echo -en "\nSuccess: ICA preparation for "
|
---|
| 72 | echo -e "${CMP_DIR} complete.\n"
|
---|
| 73 | touch $CMP_DIR/icaprep
|
---|
| 74 | else
|
---|
| 75 | echo -e "\n$CMP_DIR was already processed\n"
|
---|
| 76 | fi
|
---|
[ed0a142] | 77 |
|
---|