summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/framework-header-fix.sh
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2018-11-04 15:55:28 +0000
committerDave Lee <davelee.com@gmail.com>2018-11-04 15:55:28 +0000
commit3d2de274c7b0511e34ee035d263a30f143e121f3 (patch)
treec40e0da7e1e3779a817d786951ad240d36115bf5 /lldb/scripts/framework-header-fix.sh
parent538d67873743ff38953ddaa92b48def2c290d342 (diff)
downloadbcm5719-llvm-3d2de274c7b0511e34ee035d263a30f143e121f3.tar.gz
bcm5719-llvm-3d2de274c7b0511e34ee035d263a30f143e121f3.zip
Update framework-header-fix to force system sed
Summary: There are 2 changes here: 1. Use system sed instead of the sed found in the user's path. This fixes this script in the case the user has gnu-sed in their $PATH before bsd sed since `-i ''` isn't compatible and you need `-i` instead. 2. `set -e` in this script so it fails as soon as one of these commands fail instead of throwing errors for each file if they fail Since this is only ran on macOS, and we're already using this absolute path below, this seems like a safe addition Reviewers: kastiglione, beanz Reviewed By: kastiglione Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D49776 llvm-svn: 346099
Diffstat (limited to 'lldb/scripts/framework-header-fix.sh')
-rwxr-xr-xlldb/scripts/framework-header-fix.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/scripts/framework-header-fix.sh b/lldb/scripts/framework-header-fix.sh
index bb259d17561..3459dd91c9e 100755
--- a/lldb/scripts/framework-header-fix.sh
+++ b/lldb/scripts/framework-header-fix.sh
@@ -1,14 +1,17 @@
#!/bin/sh
# Usage: framework-header-fix.sh <source header dir> <LLDB Version>
+
+set -e
+
for file in `find $1 -name "*.h"`
do
- sed -i.bak 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
- sed -i.bak 's|<LLDB/Utility|<LLDB|' "$file"
+ /usr/bin/sed -i.bak 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
+ /usr/bin/sed -i.bak 's|<LLDB/Utility|<LLDB|' "$file"
LLDB_VERSION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\1/g'`
LLDB_REVISION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\3/g'`
LLDB_VERSION_STRING=`echo $2`
- sed -i.bak "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
- sed -i.bak "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
- sed -i.bak "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
+ /usr/bin/sed -i.bak "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
+ /usr/bin/sed -i.bak "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
+ /usr/bin/sed -i.bak "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
rm -f "$file.bak"
done
OpenPOWER on IntegriCloud