Blame SPECS/weldr-client.spec

58294b
# Pass --with tests to rpmbuild to build composer-cli-tests
58294b
%bcond_with tests
58294b
# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION)
58294b
%bcond_without signed
58294b
58294b
%global goipath         github.com/osbuild/weldr-client/v2
58294b
58294b
Name:      weldr-client
9c227e
Version:   35.5
9c227e
Release:   1%{?dist}
58294b
# Upstream license specification: Apache-2.0
58294b
License:   ASL 2.0
58294b
Summary:   Command line utility to control osbuild-composer
58294b
Url:       %{gourl}
58294b
Source0:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz
58294b
%if %{with signed}
58294b
Source1:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
58294b
Source2:   https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key
58294b
%endif
58294b
58294b
Obsoletes: composer-cli < 35.0
58294b
Provides: composer-cli = %{version}-%{release}
58294b
58294b
%gometa
58294b
58294b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
58294b
%if 0%{?fedora}
58294b
BuildRequires:  golang(github.com/BurntSushi/toml)
58294b
BuildRequires:  golang(github.com/spf13/cobra)
58294b
# Required for tests and %check
58294b
BuildRequires:  golang(github.com/stretchr/testify/assert)
58294b
BuildRequires:  golang(github.com/stretchr/testify/require)
58294b
%endif
58294b
58294b
BuildRequires: git-core
58294b
BuildRequires: make
58294b
BuildRequires: gnupg2
58294b
58294b
58294b
%description
58294b
Command line utility to control osbuild-composer
58294b
58294b
%prep
58294b
%if %{with signed}
58294b
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
58294b
%endif
58294b
%if 0%{?rhel}
58294b
%forgeautosetup -p1
58294b
%else
58294b
%goprep
58294b
%endif
58294b
58294b
%build
58294b
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
58294b
58294b
%if 0%{?rhel}
58294b
GO_BUILD_PATH=$PWD/_build
58294b
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
58294b
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
58294b
cd $GO_BUILD_PATH/src/%{goipath}
58294b
install -m 0755 -vd _bin
58294b
export PATH=$PWD/_bin${PATH:+:$PATH}
58294b
export GOPATH=$GO_BUILD_PATH:%{gopath}
58294b
export GOFLAGS=-mod=vendor
58294b
%else
58294b
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
58294b
export GO111MODULE=off
58294b
%endif
9c227e
%gobuild -o composer-cli %{goipath}/cmd/composer-cli
58294b
58294b
58294b
## TODO
58294b
##make man
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
export BUILDTAGS="integration"
58294b
58294b
# Build test binaries with `go test -c`, so that they can take advantage of
58294b
# golang's testing package. The RHEL golang rpm macros don't support building them
58294b
# directly. Thus, do it manually, taking care to also include a build id.
58294b
#
9c227e
# On Fedora go modules have already been turned off, and the path set to the one into which
58294b
# the golang-* packages install source code.
58294b
export LDFLAGS="${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')"
58294b
go test -c -tags=integration -buildmode pie -compiler gc -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr
58294b
%endif
58294b
58294b
%install
58294b
make DESTDIR=%{buildroot} install
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
make DESTDIR=%{buildroot} install-tests
58294b
%endif
58294b
58294b
%check
58294b
%if 0%{?fedora}
58294b
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
58294b
export GO111MODULE=off
58294b
%endif
58294b
58294b
# Run the unit tests
58294b
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
58294b
make test
58294b
58294b
58294b
%files
58294b
%license LICENSE
58294b
%doc examples HACKING.md README.md
58294b
%{_bindir}/composer-cli
58294b
%dir %{_sysconfdir}/bash_completion.d
58294b
%{_sysconfdir}/bash_completion.d/composer-cli
58294b
%{_mandir}/man1/composer-cli*
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
%package tests
58294b
Summary:    Integration tests for composer-cli
58294b
58294b
%description tests
58294b
Integration tests to be run on a pristine-dedicated system to test the
58294b
composer-cli package.
58294b
58294b
%files tests
58294b
%license LICENSE
58294b
%{_libexecdir}/tests/composer-cli/
58294b
%endif
58294b
58294b
58294b
%changelog
9c227e
* Tue Feb 15 2022 Brian C. Lane <bcl@redhat.com> - 35.5-1
9c227e
- New release: 35.5 (bcl)
9c227e
  Resolves: rhbz#2052604
9c227e
- docs: Explain how to undo blueprints delete (bcl)
9c227e
- test: server status no longer returns devel (bcl)
9c227e
- Use GetFrozenBlueprintsTOML for blueprints freeze save (bcl)
9c227e
- Add a test for float uid/gid in frozen blueprint (bcl)
9c227e
- Use GetBlueprintsTOML for blueprints save (bcl)
9c227e
- test: Add a test for float uid/gid in saved blueprint (bcl)
9c227e
- build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0 (49699333+dependabot[bot])
9c227e
- tests: trigger on push to main (jrusz)
9c227e
- build(deps): bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (49699333+dependabot[bot])
9c227e
- ci: add keystore for sonarqube (jrusz)
9c227e
- spec: Switch to using %%gobuild macro on Fedora (bcl)
9c227e
- ci: change workflow name (jrusz)
9c227e
- ci: add gitlab-ci and sonarqube (jrusz)
9c227e
- doc: fix example links from the README (tdecacqu)
9c227e
- build(deps): bump actions/checkout from 2.3.4 to 2.4.0 (49699333+dependabot[bot])
9c227e
- ci: Enable Coverity Scan tool (atodorov)