From 06a9ea36ded912d83df7b20c82f48d310e93ad2a Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 3 May 2021 10:21:24 -0700 Subject: [PATCH] script/release.sh: add -a to force rebuild https://golang.org/cmd/go/#hdr-Build_and_test_caching says: > If you have made changes to the C libraries on your system, you will > need to clean the cache explicitly or else use the -a build flag > (see 'go help build') to force rebuilding of packages that depend > on the updated C libraries. This means that: 1. We need to either 'go clean -cache' or 'go build -a' when building the release binary. Adding '-a' seems less intrusive / more focused. 2. The check for existing libseccomp.a (added by commit d748280aa) is no longer needed. Signed-off-by: Kir Kolyshkin --- script/release.sh | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/script/release.sh b/script/release.sh index 2156fca39..b04fe0091 100755 --- a/script/release.sh +++ b/script/release.sh @@ -30,25 +30,6 @@ function build_project() { # Due to libseccomp being LGPL we must include its sources, # so download, install and build against it. - # Sanity check: check that the build won't use distro-provided - # libseccomp.a. If this is the case, explain and abort. - # - # Note go is not used here as it caches the build heavily, - # including, apparently, the results of pkg-config. - # shellcheck disable=SC2046 - if read -ra flags < <(pkg-config --libs --cflags libseccomp 2>/dev/null) && - cat < -int main(void) { seccomp_version(); return 0; } -EOF - set +x - echo >&2 - echo "Distro-provided libseccomp static library is installed." >&2 - echo "Unable to build a static binary against own libsecomp." >&2 - echo "Please uninstall libseccomp-static to fix." >&2 - exit 1 - fi - local libseccomp_ver='2.5.1' local tarball="libseccomp-${libseccomp_ver}.tar.gz" local prefix @@ -62,7 +43,10 @@ EOF ) mv "$tarball"{,.asc} "$builddir" - make -C "$root" PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" COMMIT_NO= static + # Add -a to go build flags to make sure it links against + # the provided libseccomp, not the system one (otherwise + # it can reuse cached pkg-config results). + make -C "$root" PKG_CONFIG_PATH="${prefix}/lib/pkgconfig" COMMIT_NO= EXTRA_FLAGS="-a" static rm -rf "$prefix" mv "$root/$project" "$1" }