From d121ec1de041abfb3a22b3abf74645cbc9b19a5d Mon Sep 17 00:00:00 2001 From: caodongxia <315816521@qq.com> Date: Tue, 15 Feb 2022 15:07:45 +0800 Subject: [PATCH] fix bad build flags --- fix-bad-build-flags.patch | 53 +++++++++++++++++++++++++++++++++++++++ umoci.spec | 6 ++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 fix-bad-build-flags.patch diff --git a/fix-bad-build-flags.patch b/fix-bad-build-flags.patch new file mode 100644 index 0000000..ca269d9 --- /dev/null +++ b/fix-bad-build-flags.patch @@ -0,0 +1,53 @@ +From a5d1ee156b76c4f823ae2554a0fd2e2ab9aaccaa Mon Sep 17 00:00:00 2001 +From: Aleksa Sarai +Date: Thu, 8 Apr 2021 18:55:40 +1000 +Subject: [PATCH] makefile: fix bad build flags + +Fix mistake in the Makefile which prevents the version field (as well as +some other build flags) from being passed to "go build". Update the +"runc --version" integration test to make sure that the contents of +VERSION are actually present. + +Fixes: 6fbd32e48b66 ("Make Makefile more portable") +Signed-off-by: Aleksa Sarai +--- + Makefile | 2 +- + test/help.bats | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index d760e928..1fdcf650 100644 +--- a/Makefile ++++ b/Makefile +@@ -71,7 +71,7 @@ BASE_LDFLAGS := -s -w -X ${PROJECT}.gitCommit=${COMMIT} -X ${PROJECT}.version=${ + + # Specific build flags for build type. + ifeq ($(GOOS), linux) +- TEST_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS} -X ${PROJECT}/pkg/testutils.binaryType=test" DYN_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS}" ++ DYN_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS}" + TEST_BUILD_FLAGS := ${BASE_FLAGS} -buildmode=pie -ldflags "${BASE_LDFLAGS} -X ${PROJECT}/pkg/testutils.binaryType=test" + else + DYN_BUILD_FLAGS := ${BASE_FLAGS} -ldflags "${BASE_LDFLAGS}" +diff --git a/test/help.bats b/test/help.bats +index 3d6dc975..a3826435 100644 +--- a/test/help.bats ++++ b/test/help.bats +@@ -17,13 +17,15 @@ + load helpers + + @test "umoci --version" { ++ VERSION="$(cat "$INTEGRATION_ROOT/../VERSION")" ++ + umoci --version + [ "$status" -eq 0 ] +- [[ "$output" =~ "umoci version "+ ]] ++ [[ "$output" =~ "umoci version $VERSION"+ ]] + + umoci -v + [ "$status" -eq 0 ] +- [[ "$output" =~ "umoci version "+ ]] ++ [[ "$output" =~ "umoci version $VERSION"+ ]] + } + + @test "umoci --help" { + \ No newline at end of file diff --git a/umoci.spec b/umoci.spec index 9506d2f..e2447e0 100644 --- a/umoci.spec +++ b/umoci.spec @@ -4,12 +4,13 @@ Name: umoci Version: 0.4.7 -Release: 1 +Release: 2 Summary: Open Container Image manipulation tool License: ISC and MIT and Apache-2.0 URL: https://github.com/opencontainers/umoci Source0: https://github.com/opencontainers/umoci/archive/v0.4.7.tar.gz Source1: https://github.com/cpuguy83/go-md2man/archive/v1.0.10.tar.gz +Patch0000: fix-bad-build-flags.patch BuildRequires: fdupes go >= 1.6 %description @@ -54,6 +55,9 @@ done %{_mandir}/man1/umoci* %changelog +* Tue Feb 15 2022 caodongxia - 0.4.7-2 +- fix bad build flags + * Tue Jan 18 2022 SimpleUpdate Robot - 0.4.7-1 - Upgrade to version 0.4.7 -- Gitee