source: extras/do_ica_prep@ eddf89f5

experimental
Last change on this file since eddf89f5 was eddf89f5, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Added inline_doc fragments.

  • Property mode set to 100755
File size: 2.2 KB
Line 
1#!/bin/bash
2# $Id$
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
11set -e
12
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:
22inline_doc
23
24local CMP_DIR=$1
25local F L BN
26
27# Run ica_prep if it hasn't been done already
28if [ ! -f "$CMP_DIR/icaprep" ]; then
29
30 echo -n "Removing symbolic links in ${CMP_DIR}... "
31 find $CMP_DIR -type l | xargs rm -f
32 echo "done."
33
34 echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
35 find $CMP_DIR -name '*.gz' | xargs gunzip
36 echo "done."
37
38 #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
39 #find $CMP_DIR -name '*.bz2' | xargs bunzip2
40 #echo "done."
41
42 # ar archives contain date & time stamp info that causes us
43 # grief when trying to find differences. Here we perform some
44 # hackery to allow easy diffing. Essentially, replace each
45 # archive with a dir of the same name and extract the object
46 # files from the archive into this dir. Despite their names,
47 # libieee.a & libmcheck.a are not actual ar archives.
48 echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
49 L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
50 for F in $L; do
51 mv $F ${F}.XX
52 mkdir $F
53 cd $F
54 BN=${F##*/}
55 ar x ../${BN}.XX || {
56 echo -e "\nError: ar archive extraction failed!\n" >&2
57 exit 1
58 }
59 rm -f ../${BN}.XX
60 done
61 echo "done."
62
63 echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
64 find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
65 echo "done."
66
67 echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
68 find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
69 echo "done."
70
71 # We're all done
72 echo -en "\nSuccess: ICA preparation for "
73 echo -e "${CMP_DIR} complete.\n"
74 touch $CMP_DIR/icaprep
75else
76 echo -e "\n$CMP_DIR was already processed\n"
77fi
78
Note: See TracBrowser for help on using the repository browser.