xds/third_part: revert change of envoy import script (#5667)

* Revert "xds/third_party: fixed compatibility issue of regex in BSD for import.sh sed command (#5613)"

This reverts commit affce636dd.

* added comment to avoid manual change as the script is synced with internal upstream
This commit is contained in:
Chengyuan Zhang 2019-05-04 12:23:54 -07:00 committed by GitHub
parent 63f636b4b6
commit 7712ef596c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Only run this script on Linux environment.
# Update VERSION then in this directory run ./import.sh
set -e
@ -68,6 +70,8 @@ do
cp -p "${tmpdir}/${SOURCE_PROTO_BASE_DIR}/${file}" "${file}"
done
# DO NOT TOUCH! The following section is upstreamed with an internal script.
# See google internal third_party/envoy/envoy-update.sh
# ===========================================================================
# Fix up proto imports and remove references to gogoproto.
@ -78,22 +82,19 @@ do
# Import mangling.
-e 's#import "gogoproto/gogo.proto";##'
# Remove references to gogo.proto extensions.
-e 's#option \(gogoproto\.[a-z_]+\) = (true|false);##'
-e 's#(, )?\(gogoproto\.[a-z_]+\) = (true|false),?##'
-e 's#option (gogoproto\.[a-z_]\+) = \(true\|false\);##'
-e 's#\(, \)\?(gogoproto\.[a-z_]\+) = \(true\|false\),\?##'
# gogoproto removal can result in empty brackets.
-e 's# \[\]##'
# gogoproto removal can result in four spaces on a line by itself.
-e '/^ $/d'
)
# Use a temp file to workaround `sed -i` cross-platform compatibility issue.
tmpfile="$(mktemp)"
sed -E "${commands[@]}" "$f" > "$tmpfile"
sed -i "${commands[@]}" "$f"
# gogoproto removal can leave a comma on the last element in a list.
# This needs to run separately after all the commands above have finished
# since it is multi-line and rewrites the output of the above patterns.
sed -E -e '$!N; s#(.*),([[:space:]]*\];)#\1\2#; t' -e 'P; D;' "$tmpfile" > "$f"
rm "$tmpfile"
sed -i -e '$!N; s#\(.*\),\([[:space:]]*\];\)#\1\2#; t; P; D;' "$f"
done
popd