Skip to content

Commit 3be451d

Browse files
authored
Merge pull request kubernetes#91936 from SataQiu/fix-update-bazel-20200609
Fix bazel BUILD rule and suppress pkg-config errors
2 parents 7401f8e + 2281e57 commit 3be451d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hack/update-bazel.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ for repo in "${staging_repos[@]}"; do
6060
touch "${KUBE_ROOT}/staging/src/${repo}/BUILD"
6161
done
6262

63+
# Warning: Please be careful when ignoring these pkg-config errors.
64+
# As gazelle doesn't support pkg-config, if we suppress these errors here, we actually need to modify the script below to handle it manually.
65+
# For instance, in the case of `libseccomp`, we set the link option `-lseccomp` to make it work properly.
66+
KNOWN_PKG_CONFIG_ERRORS=(
67+
"vendor/github.com/seccomp/libseccomp-golang/seccomp(_internal)?.go: pkg-config not supported: #cgo pkg-config: libseccomp"
68+
"vendor/github.com/google/cadvisor/nvm/machine_libipmctl.go: pkg-config not supported: #cgo pkg-config: libipmctl"
69+
)
70+
6371
# Run gazelle to update Go rules in BUILD files.
6472
# filter out known pkg-config error (see buildozer workaround below)
6573
# NOTE: the `|| exit "${PIPESTATUS[0]}"` is to ignore grep errors
@@ -69,7 +77,7 @@ gazelle fix \
6977
-mode=fix \
7078
-repo_root "${KUBE_ROOT}" \
7179
"${KUBE_ROOT}" \
72-
2>&1 | grep -Ev "vendor/github.com/seccomp/libseccomp-golang/seccomp(_internal)?.go: pkg-config not supported: #cgo pkg-config: libseccomp" || (exit "${PIPESTATUS[0]}")
80+
2>&1 | grep -Ev "$(kube::util::join \| "${KNOWN_PKG_CONFIG_ERRORS[@]}")" || (exit "${PIPESTATUS[0]}")
7381

7482
# Run kazel to update the pkg-srcs and all-srcs rules as well as handle
7583
# Kubernetes code generators.

0 commit comments

Comments
 (0)