Debian Codegraph @

script/util/verify-no-patent.sh

raw
1 #!/bin/bash
2
3 # Copyright The containerd Authors.
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8
9 # http://www.apache.org/licenses/LICENSE-2.0
10
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Copied from https://github.com/containerd/nerdctl/blob/v1.1.0/hack/verify-no-patent.sh
18 # Modified for stargz snapshotter project
19
20 CONTEXT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/"
21 REPO="${CONTEXT}../../"
22
23 echo "Verifying that the patented NewARC() is NOT compiled in (https://github.com/hashicorp/golang-lru/blob/v0.5.4/arc.go#L15)"
24 set -eux -o pipefail
25
26 # Clear GO_BUILD_LDFLAGS to embed the symbols
27 (cd $REPO && GO_BUILD_LDFLAGS="" make)
28
29 for O in containerd-stargz-grpc ctr-remote stargz-store ; do
30 go tool nm ${REPO}/out/$O >${REPO}/out/$O.sym
31
32 if ! grep -w -F main.main ${REPO}/out/$O.sym; then
33 echo >&2 "ERROR: the symbol file seems corrupted"
34 exit 1
35 fi
36
37 if grep -w NewARC ${REPO}/out/$O.sym; then
38 echo >&2 "ERROR: patented NewARC() might be compiled in?"
39 exit 1
40 fi
41 done
42
43 echo "OK"