source: extras/do_ica_prep@ 1e686d1

ablfs-more legacy trunk
Last change on this file since 1e686d1 was 7b7b5e9, checked in by Pierre Labastie <pierre@…>, 5 years ago

Various fixes for ICA

  • 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
24CMP_DIR=$1
25
26# Run ica_prep if it hasn't been done already
27if [ ! -f "$CMP_DIR/icaprep" ]; then
28
29 echo -en "\nRemoving symbolic links in ${CMP_DIR}... "
30 find $CMP_DIR -type l | xargs rm -f
31 echo "done."
32
33 echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
34 find $CMP_DIR -name '*.gz' | xargs gunzip
35 echo "done."
36
37 #echo -n "Bunzipping \".bz2\" files in ${CMP_DIR}... "
38 #find $CMP_DIR -name '*.bz2' | xargs bunzip2
39 #echo "done."
40
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 # libm.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 'libm.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."
61
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."
65
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."
69
70 # We're all done
71 echo -en "\nSuccess: ICA preparation for "
72 echo -e "${CMP_DIR} complete."
73 touch $CMP_DIR/icaprep
74else
75 echo -e "\n$CMP_DIR was already processed\n"
76fi
77
Note: See TracBrowser for help on using the repository browser.