Blame SPECS/weldr-client.spec

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