spec: make the same specfile work on RHEL as on Fedora
In RHEL golang dependencies must be vendored, whereas on Fedora they must be packaged separately. Add conditionals accordingly. Some macros are not yet available in RHEL, so fall back to older versions. We may want to just use macros avilable everywhere unconditionally, but I left that for a follow-up. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
fce9fa9fa2
commit
ddde71f9c1
1 changed files with 27 additions and 1 deletions
|
|
@ -19,15 +19,21 @@ License: ASL 2.0
|
|||
URL: %{gourl}
|
||||
Source0: %{gosource}
|
||||
|
||||
BuildRequires: systemd-rpm-macros
|
||||
|
||||
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
||||
BuildRequires: systemd
|
||||
%if 0%{?fedora}
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: git
|
||||
BuildRequires: golang(github.com/aws/aws-sdk-go)
|
||||
BuildRequires: golang-github-azure-storage-blob-devel
|
||||
BuildRequires: golang(github.com/BurntSushi/toml)
|
||||
BuildRequires: golang(github.com/coreos/go-systemd/activation)
|
||||
BuildRequires: golang(github.com/google/uuid)
|
||||
BuildRequires: golang(github.com/julienschmidt/httprouter)
|
||||
BuildRequires: golang(github.com/gobwas/glob)
|
||||
BuildRequires: golang(github.com/google/go-cmp/cmp)
|
||||
%endif
|
||||
|
||||
Requires: systemd
|
||||
Requires: osbuild
|
||||
|
|
@ -39,9 +45,23 @@ Provides: lorax-composer
|
|||
%{common_description}
|
||||
|
||||
%prep
|
||||
%if 0%{?rhel}
|
||||
%forgeautosetup -p1
|
||||
%else
|
||||
%goprep
|
||||
%endif
|
||||
|
||||
%build
|
||||
%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
|
||||
%gobuild -o _bin/osbuild-composer %{goipath}/cmd/osbuild-composer
|
||||
%gobuild -o _bin/osbuild-worker %{goipath}/cmd/osbuild-worker
|
||||
|
||||
|
|
@ -59,7 +79,13 @@ install -m 0644 -vp distribution/osbuild-composer.conf %{buildroot}%{_sysus
|
|||
install -m 0755 -vd %{buildroot}%{_localstatedir}/cache/osbuild-composer/dnf-cache
|
||||
|
||||
%check
|
||||
%if 0%{?rhel}
|
||||
export GOFLAGS=-mod=vendor
|
||||
export GOPATH=$PWD/_build:%{gopath}
|
||||
%gotest ./...
|
||||
%else
|
||||
%gocheck
|
||||
%endif
|
||||
|
||||
%post
|
||||
%systemd_post osbuild-composer.service osbuild-composer.socket osbuild-worker@.service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue