[Lldb-commits] [lldb] r346099 - Update framework-header-fix to force system sed

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 4 07:55:28 PST 2018


Author: kastiglione
Date: Sun Nov  4 07:55:28 2018
New Revision: 346099

URL: http://llvm.org/viewvc/llvm-project?rev=346099&view=rev
Log:
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

Modified:
    lldb/trunk/scripts/framework-header-fix.sh

Modified: lldb/trunk/scripts/framework-header-fix.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/framework-header-fix.sh?rev=346099&r1=346098&r2=346099&view=diff
==============================================================================
--- lldb/trunk/scripts/framework-header-fix.sh (original)
+++ lldb/trunk/scripts/framework-header-fix.sh Sun Nov  4 07:55:28 2018
@@ -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




More information about the lldb-commits mailing list