mirror of https://github.com/linkerd/linkerd2.git
bin/protoc-diff: Don't assume Debian and don't install unzip (#5347)
- Do unzip check but don't install; leave installation to user - Move unzip check to bin/protoc that actually uses unzip - Make sure the protoc scripts can be called from any directory Fixes #5337 Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
This commit is contained in:
parent
cdc57d1af0
commit
377b38f0bf
|
@ -39,6 +39,8 @@ jobs:
|
||||||
container:
|
container:
|
||||||
image: golang:1.13.4
|
image: golang:1.13.4
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prerequisites
|
||||||
|
run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install unzip
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
# actions/checkout@v2
|
# actions/checkout@v2
|
||||||
uses: actions/checkout@722adc6
|
uses: actions/checkout@722adc6
|
||||||
|
|
|
@ -15,7 +15,16 @@ protocversion=3.6.0
|
||||||
protocbin=$targetbin/protoc-$protocversion
|
protocbin=$targetbin/protoc-$protocversion
|
||||||
protocurl=https://github.com/google/protobuf/releases/download/v$protocversion/protoc-$protocversion-$os-$arch.zip
|
protocurl=https://github.com/google/protobuf/releases/download/v$protocversion/protoc-$protocversion-$os-$arch.zip
|
||||||
|
|
||||||
|
require_from() {
|
||||||
|
if ! command -v "$1" >/dev/null 2>/dev/null ; then
|
||||||
|
echo "Please acquire $1 from $2" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -f "$protocbin" ]; then
|
if [ ! -f "$protocbin" ]; then
|
||||||
|
require_from curl 'https://curl.se/download.html'
|
||||||
|
require_from unzip 'http://infozip.sourceforge.net/UnZip.html#Downloads'
|
||||||
tmp=$(mktemp -d -t protoc.XXX)
|
tmp=$(mktemp -d -t protoc.XXX)
|
||||||
mkdir -p "$targetbin"
|
mkdir -p "$targetbin"
|
||||||
(
|
(
|
||||||
|
|
|
@ -2,14 +2,8 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Install unzip if not already installed (Linux only)
|
bindir=$( cd "${0%/*}" && pwd )
|
||||||
system=$(uname -s)
|
"$bindir"/protoc-go.sh
|
||||||
if [ "$system" = Linux ] && ! [ -x "$(command -v unzip)" ]; then
|
|
||||||
apt-get update
|
|
||||||
apt-get install unzip
|
|
||||||
fi
|
|
||||||
|
|
||||||
bin/protoc-go.sh
|
|
||||||
|
|
||||||
dir_dirty=$(git diff HEAD)
|
dir_dirty=$(git diff HEAD)
|
||||||
if [ -z "$dir_dirty" ]; then
|
if [ -z "$dir_dirty" ]; then
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
|
bindir=$( cd "${0%/*}" && pwd )
|
||||||
|
|
||||||
gen() {
|
gen() {
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
bin/protoc -I proto --go_out=plugins=grpc,paths=source_relative:controller/gen "$f"
|
"$bindir"/protoc -I proto --go_out=plugins=grpc,paths=source_relative:controller/gen "$f"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue