source: extras/do_ica_prep@ bea551c

trunk
Last change on this file since bea551c was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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