Dockerfile, circleci: update protoc to 3.6.1, simplify install#2756
Dockerfile, circleci: update protoc to 3.6.1, simplify install#2756dperny merged 1 commit intomoby:masterfrom
Conversation
| && cd .. && rm -rf $PROTOC_TMP_DIR | ||
| RUN curl --silent --show-error --location --output protoc.zip \ | ||
| https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \ | ||
| && unzip protoc.zip -x readme.txt -d /usr/local \ |
There was a problem hiding this comment.
I kinda preferred the explicit mvs above, since it at least ensured we didn't copy whatever was in the archive, but only some files we cared about. IMO that outweighs whatever I/O we waste with the current version?
There was a problem hiding this comment.
There is nothing else in there (except for the readme.txt which we skip):
Archive: protoc.zip
creating: /usr/local/include/google/
creating: /usr/local/include/google/protobuf/
inflating: /usr/local/include/google/protobuf/struct.proto
inflating: /usr/local/include/google/protobuf/type.proto
inflating: /usr/local/include/google/protobuf/descriptor.proto
inflating: /usr/local/include/google/protobuf/api.proto
inflating: /usr/local/include/google/protobuf/empty.proto
creating: /usr/local/include/google/protobuf/compiler/
inflating: /usr/local/include/google/protobuf/compiler/plugin.proto
inflating: /usr/local/include/google/protobuf/any.proto
inflating: /usr/local/include/google/protobuf/field_mask.proto
inflating: /usr/local/include/google/protobuf/wrappers.proto
inflating: /usr/local/include/google/protobuf/timestamp.proto
inflating: /usr/local/include/google/protobuf/duration.proto
inflating: /usr/local/include/google/protobuf/source_context.proto
inflating: /usr/local/bin/protoc
I have also rechecked it with a latest version, 3.6.1:
Archive: protoc.zip
creating: /usr/local/include/google/
creating: /usr/local/include/google/protobuf/
inflating: /usr/local/include/google/protobuf/wrappers.proto
inflating: /usr/local/include/google/protobuf/field_mask.proto
inflating: /usr/local/include/google/protobuf/api.proto
inflating: /usr/local/include/google/protobuf/struct.proto
inflating: /usr/local/include/google/protobuf/descriptor.proto
inflating: /usr/local/include/google/protobuf/timestamp.proto
creating: /usr/local/include/google/protobuf/compiler/
inflating: /usr/local/include/google/protobuf/compiler/plugin.proto
inflating: /usr/local/include/google/protobuf/empty.proto
inflating: /usr/local/include/google/protobuf/any.proto
inflating: /usr/local/include/google/protobuf/source_context.proto
inflating: /usr/local/include/google/protobuf/type.proto
inflating: /usr/local/include/google/protobuf/duration.proto
inflating: /usr/local/bin/protoc
I suppose the creators of this .zip file are taking care of what's in there 😆
There was a problem hiding this comment.
Doesn't mean there'll never be anything else :) Sure, it's unlikely, but then for such a small benefit, why bother?
That being said, I don't feel super strongly about this, so as long as @dperny is okay with it, why not!
There was a problem hiding this comment.
@kolyshkin actually looking at unzip's man page:
SYNOPSIS
unzip [-Z] [-cflptTuvz[abjnoqsCDKLMUVWX$/:^]] file[.zip] [file(s) ...] [-x xfile(s) ...] [-d exdir]
[...]
[file(s)]
An optional list of archive members to be processed, separated by spaces. (VMS versions compiled with VMSCLI
defined must delimit files with commas instead. See -v in OPTIONS below.) Regular expressions (wildcards)
may be used to match multiple members; see above. Again, be sure to quote expressions that would otherwise be
expanded or modified by the operating system.
so let's white-list the bin and the includes instead of blacklisting the readme?
There was a problem hiding this comment.
Verified the list is the same as before:
Archive: protoc.zip
creating: /usr/local/include/google/
creating: /usr/local/include/google/protobuf/
inflating: /usr/local/include/google/protobuf/wrappers.proto
inflating: /usr/local/include/google/protobuf/field_mask.proto
inflating: /usr/local/include/google/protobuf/api.proto
inflating: /usr/local/include/google/protobuf/struct.proto
inflating: /usr/local/include/google/protobuf/descriptor.proto
inflating: /usr/local/include/google/protobuf/timestamp.proto
creating: /usr/local/include/google/protobuf/compiler/
inflating: /usr/local/include/google/protobuf/compiler/plugin.proto
inflating: /usr/local/include/google/protobuf/empty.proto
inflating: /usr/local/include/google/protobuf/any.proto
inflating: /usr/local/include/google/protobuf/source_context.proto
inflating: /usr/local/include/google/protobuf/type.proto
inflating: /usr/local/include/google/protobuf/duration.proto
inflating: /usr/local/bin/protoc
| # download and install protoc binary and .proto files | ||
| RUN curl --silent --show-error --location --output protoc.zip \ | ||
| https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \ | ||
| && unzip -d /usr/local protoc.zip include/\* bin\/* \ |
There was a problem hiding this comment.
Minor nitpick: I'd restrict that to bin/protoc, but feel free to ignore :)
There was a problem hiding this comment.
IMO, it is actually better to use /usr/local folder same way than it is on CircleCI config.
There was a problem hiding this comment.
I'd restrict that to
bin/protoc
I can imagine some future version of protoc which calls another binary bundled in the same zip, let's say protoc-helper, and would not work without it, leaving a cryptic message, let's say execve: no such file or directory. With that in mind, I'd rather leave bin/\* in there.
Oh and I just spotted a bug here: it was bin\/* but should be bin/\*. Fixed.
|
@kolyshkin This sounds good idea and especially migrate to Protobuf 3.6.1 as 3.5.0 version does not work anymore. I did cherry-pick you commit to #2758 but I also needed to do same modifications to CircleCI config config to make it working. So can you include olljanat@7f8d217 to this PR? |
Right, I should have made changes to circleci config as well. Commit updated. For the time being I omitted the nasty |
bcf4bbc to
e6d714f
Compare
|
@kolyshkin can you change example commit text little bit and push it here so it will trigger build running again. |
| RUN curl --silent --show-error --location --output protoc.zip \ | ||
| https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \ | ||
| && unzip -d /usr/local protoc.zip include/\* bin/\* \ | ||
| && rm -f protoc.zip |
There was a problem hiding this comment.
Arguably this could be put into an install_protoc script that could then be called both by this Dockerfile and Circle
There was a problem hiding this comment.
I would agree; maybe put it to direct.mk?
There was a problem hiding this comment.
The only problem is I'm waiting for #2750 to be merged first as it modifies Makefiles and I'd like to avoid rebasing )
There was a problem hiding this comment.
Agreed on both accounts, reviewing 2750!
While at it, let's simplify installation
Use unzip options to unpack directly to /usr/local/{include,bin},
to avoid unnecessary I/O.
Unfortunately unzip does not support unpacking from a pipe (due
to a limitation of .zip format -- the index is at EOF) so we still
have to save the .zip to disk, read it back, and remove. If they
could only provide tarballs... *sigh*
[v2: update circleci config as well]
[v3: add chmod a+r to circleci]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
done |
Codecov Report
@@ Coverage Diff @@
## master #2756 +/- ##
=========================================
+ Coverage 61.66% 61.77% +0.1%
=========================================
Files 134 134
Lines 21890 21890
=========================================
+ Hits 13499 13523 +24
+ Misses 6932 6908 -24
Partials 1459 1459 |
|
yeah LGTM, |
Use unzip options to unpack directly to /usr/local/{include,bin},
to avoid unnecessary I/O.
Unfortunately unzip does not support unpacking from a pipe (due
to a limitation of .zip format -- the index is at EOF) so we still
have to save the .zip to disk, read it back, and remove. If they
could only provide tarballs... sigh
// cc @wk8 @anshulpundir