https://bugzilla.redhat.com/show_bug.cgi?id=1945771 --- Comment #5 from Robert-André Mauchin 🐧 <zebob.m@xxxxxxxxx> --- > I may be missing the reasoning behind some of your changes, so if this still needs work please explain in a bit more detail. Most of the change are related to the fact we don't have macros on RHEL/EPEL so we set up the gobuildflags manually: %if 0%{?rhel} %bcond_without vendor %ifnarch ppc64 %global gobuildflags -buildmode pie -compiler gc -tags=\\\"rpm_crashtraceback ${BUILDTAGS:-}\\\" -ldflags \\\"${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false\\\" -a -v -x %else %global gobuildflags -compiler gc -tags=\\\"rpm_crashtraceback ${BUILDTAGS:-}\\\" -ldflags \\\"${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false\\\" -a -v -x %endif %endif and then use vendoring + go modules for RHEL/EPEL: %define setgoconfig() %{expand: # On Fedora, turn off go modules and set the path to the one into which # the golang-* packages install source code. %if %{without vendor} export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off %else export GO111MODULE=on export GOFLAGS=-mod=vendor %endif export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " } About the Makefile: BUILDFLAGS ?= -ldflags="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=${VERSION}" GOBUILDFLAGS ?= build: composer-cli composer-cli: go build ${BUILDFLAGS} ${GOBUILDFLAGS} ./cmd/composer-cli Here you pass ldflags via the variable BUILDFLAGS, however %GOBUILDFLAGS already defines -ldflags, so it overwrites your BUILDFLAGS The solution is to erase the BUILDTAGS from go build ${BUILDFLAGS} ${GOBUILDFLAGS} ./cmd/composer-cli and pass: export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " before the build in the spec so it will be passed to GOBUILDFLAGS at -ldflags "${LDFLAGS:-} We have the same issue here: integration: composer-cli-tests composer-cli-tests: go test -c -tags=integration ${BUILDFLAGS} ${GOBUILDFLAGS} -o composer-cli-tests ./weldr/ you are passing -tags=integration but %gobuildflags already contains -tags="rpm_crashtraceback ${BUILDTAGS:-}", so it erasing this tag. The solution is to remove -tags=integration in the Makefile and define the $BUILDTAGS="integration" in the SPEC: =================================================================================================================== - This is only needed for EPEL: BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} - Please specify all the import paths used: %if 0%{?fedora} BuildRequires: golang(github.com/BurntSushi/toml) BuildRequires: golang(github.com/spf13/cobra) %endif %if %{with tests} || 0%{?rhel} BuildRequires: golang(github.com/stretchr/testify) %endif → BuildRequires: golang(github.com/BurntSushi/toml) BuildRequires: golang(github.com/spf13/cobra) BuildRequires: golang(github.com/spf13/cobra/doc) %if %{with tests} # Tests BuildRequires: golang(github.com/stretchr/testify/assert) BuildRequires: golang(github.com/stretchr/testify/require) %endif - Not needed if you do not support EPEL: %if 0%{?rhel} %forgeautosetup -p1 %else %if 0%{?rhel} GO_BUILD_PATH=$PWD/_build install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath}) ln -fs $PWD $GO_BUILD_PATH/src/%{goipath} cd $GO_BUILD_PATH/src/%{goipath} install -m 0755 -vd _bin export PATH=$PWD/_bin${PATH:+:$PATH} export GOPATH=$GO_BUILD_PATH:%{gopath} export GOFLAGS=-mod=vendor %endif - Please set the GOPATH and GO111MODULE manually since you don't use %gobuild: export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off - You'll also need it in tests: %check export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off - Split the description to stay below 80 characters per line: %description tests Integration tests to be run on a pristine-dedicated system to test the composer-cli package. ================================================================================================= Proposed spec without EPEL: # Generated by go2rpm 1.3 # Pass --with tests to rpmbuild to build composer-cli-tests %bcond_with tests # https://github.com/osbuild/weldr-client %global goipath github.com/osbuild/weldr-client Version: 35.0 %gometa %global common_description %{expand: Command line utility to control osbuild-composer.} Name: weldr-client Release: 1%{?dist} Summary: Command line utility to control osbuild-composer # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: https://github.com/osbuild/weldr-client Source0: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc Source2: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB4C6B451E4FA8B4232CA191E117E8C168EFE3A7F#/bcl-gpg.key Obsoletes: composer-cli < 34.0 Provides: composer-cli = %{version}-%{release} BuildRequires: golang(github.com/BurntSushi/toml) BuildRequires: golang(github.com/spf13/cobra) BuildRequires: golang(github.com/spf13/cobra/doc) %if %{with tests} # Tests BuildRequires: golang(github.com/stretchr/testify/assert) BuildRequires: golang(github.com/stretchr/testify/require) %endif BuildRequires: git-core BuildRequires: make BuildRequires: gnupg2 %description %{common_description} %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %goprep # Makefile modification # 1. We pass tags already through BUILDTAGS in gobuildflags # 2. We export LDFLAGS in the SPEC so it is used in gobuildflags # 3. -v is already present in gobuildflags sed -i "s|go test -c -tags=integration|go test -c |; \ s|\${BUILDFLAGS}||; \ s|-v -covermode=atomic |-covermode=atomic |;" \ Makefile %build export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " export GOBUILDFLAGS="%{gobuildflags}" %make_build # TODO # make man %if %{with tests} # Build test binaries with `go test -c`, so that they can take advantage of # golang's testing package. The golang rpm macros don't support building them # directly. Thus, do it manually, taking care to also include a build id. export BUILDTAGS="integration" export GOBUILDFLAGS="%{gobuildflags}" %make_build integration %endif %install %make_install %if %{with tests} make DESTDIR=%{buildroot} install-tests %endif %if %{with tests} %check export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off export GOBUILDFLAGS="%{gobuildflags}" make test %endif %files %license LICENSE %doc examples HACKING.md README.md %{_bindir}/composer-cli %dir %{_sysconfdir}/bash_completion.d %{_sysconfdir}/bash_completion.d/composer-cli %{_mandir}/man1/composer-cli* %if %{with tests} %package tests Summary: Integration tests for composer-cli %description tests Integration tests to be run on a pristine-dedicated system to test the composer-cli package. %files tests %license LICENSE %{_libexecdir}/tests/composer-cli/ %endif %changelog -- You are receiving this mail because: You are on the CC list for the bug. You are always notified about changes to this product and component _______________________________________________ package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure